/* ========== RESET & BASE ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: #0a0a0a;
    color: #ffffff;
    height: 100%;
    width: 100%;
    overflow: hidden;
    line-height: 1.5;
}

/* ========== SCREEN SYSTEM ========== */
.pantalla {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    flex-direction: column;
    background: #0a0a0a;
    overflow: hidden;
    animation: fadeIn 0.3s ease;
}

.pantalla.activa {
    display: flex;
}

@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.98); }
    to { opacity: 1; transform: scale(1); }
}

.pantalla-contenido {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    padding-bottom: 80px;
    scrollbar-width: thin;
    scrollbar-color: #00d68f #1a1a1a;
}

.pantalla-contenido::-webkit-scrollbar { width: 4px; }
.pantalla-contenido::-webkit-scrollbar-track { background: #1a1a1a; }
.pantalla-contenido::-webkit-scrollbar-thumb { background: #00d68f; border-radius: 4px; }

/* ========== APP HEADER ========== */
.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: #0a0a0a;
    border-bottom: 1px solid #1a1a1a;
    z-index: 100;
}

.app-header h2 {
    font-size: 1.1rem;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: 2px;
}

.btn-atras, .btn-menu {
    background: none;
    border: none;
    color: #ffffff;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 4px 8px;
}

/* ========== HOME SCREEN ========== */
.inicio-contenido {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px;
    text-align: center;
    position: relative;
}

.logo-ecolens { margin-bottom: 16px; }

.logo-icono {
    font-size: 3.5rem;
    margin-bottom: 8px;
    filter: drop-shadow(0 0 20px rgba(0, 214, 143, 0.5));
}

.logo-ecolens h1 {
    font-size: 2.2rem;
    font-weight: 800;
    color: #ffffff;
    letter-spacing: 4px;
}

.inicio-frase {
    color: #a0a0a0;
    font-size: 0.95rem;
    margin-bottom: 32px;
    line-height: 1.6;
}

.inicio-ilustracion {
    width: 220px;
    height: 220px;
    position: relative;
    margin-bottom: 32px;
    border-radius: 50%;
    overflow: hidden;
    border: 3px solid #00d68f;
    box-shadow: 0 0 40px rgba(0, 214, 143, 0.2);
}

.planeta-mitad {
    position: absolute;
    width: 50%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 4rem;
}

.planeta-sano { left: 0; background: linear-gradient(180deg, #0d3328 0%, #1a5c3d 100%); }
.planeta-danado { right: 0; background: linear-gradient(180deg, #3d1a0d 0%, #5c2e1a 100%); }

.laser-scan {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 2px;
    height: 100%;
    background: linear-gradient(to bottom, transparent, #00d68f, transparent);
    transform: translate(-50%, -50%);
    animation: scanLaser 2s ease-in-out infinite;
}

@keyframes scanLaser {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 1; box-shadow: 0 0 10px #00d68f; }
}

.btn-analizar {
    background: transparent;
    border: 2px solid #00d68f;
    border-radius: 30px;
    padding: 16px 32px;
    color: #00d68f;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
    width: 90%;
    max-width: 320px;
}

.btn-analizar:hover {
    background: rgba(0, 214, 143, 0.1);
    box-shadow: 0 0 30px rgba(0, 214, 143, 0.3);
}

.btn-icono-camara { font-size: 2rem; }

/* ========== BOTTOM NAVIGATION ========== */
.nav-bottom {
    display: flex;
    justify-content: space-around;
    padding: 8px 0;
    background: #0a0a0a;
    border-top: 1px solid #1a1a1a;
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    z-index: 100;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
    padding: 4px 16px;
    transition: color 0.2s;
}

.nav-item.activo,
.nav-item:hover { color: #00d68f; }

.nav-icon { font-size: 1.4rem; }
.nav-label { font-size: 0.7rem; font-weight: 500; }

/* ========== ECOLENS CARDS ========== */
.card-ecolens {
    background: #0a0a0a;
    border: 2px solid #00d68f;
    border-radius: 24px;
    padding: 20px;
    margin-bottom: 16px;
    position: relative;
}

.card-badge {
    background: #333;
    color: #fff;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 0.85rem;
    display: inline-block;
    margin-bottom: 12px;
}

.card-desc {
    color: #888;
    font-size: 0.9rem;
    margin-bottom: 16px;
}

/* ========== MAIN BUTTONS ========== */
.btn-principal {
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, #00d68f 0%, #00a86b 100%);
    border: none;
    border-radius: 16px;
    color: #000;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
    margin-top: 12px;
}

.btn-principal:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 214, 143, 0.4);
}

.btn-principal:disabled {
    background: #333;
    color: #666;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-glow {
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.3) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.3s;
}

.btn-principal:hover .btn-glow { opacity: 1; }

.btn-secundario {
    padding: 12px 20px;
    background: #1a1a1a;
    border: 2px solid #333;
    border-radius: 12px;
    color: #fff;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: 8px;
    margin-right: 8px;
}

.btn-secundario:hover {
    border-color: #00d68f;
    background: #1a2a22;
}

.btn-outline {
    background: transparent;
    border-color: #555;
    color: #888;
}

.btn-siguiente {
    width: 100%;
    padding: 14px;
    background: transparent;
    border: 2px solid #00d68f;
    border-radius: 16px;
    color: #00d68f;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: 8px;
}

.btn-siguiente:hover { background: rgba(0, 214, 143, 0.1); }

/* ========== STATUS ========== */
.estado {
    padding: 12px 16px;
    border-radius: 12px;
    margin-top: 12px;
    font-size: 0.9rem;
    display: none;
    text-align: center;
}

.estado.visible { display: block; }

.estado.cargando {
    background: rgba(251, 191, 36, 0.15);
    color: #fbbf24;
    border: 1px solid rgba(251, 191, 36, 0.3);
}

.estado.exito {
    background: rgba(0, 214, 143, 0.15);
    color: #00d68f;
    border: 1px solid rgba(0, 214, 143, 0.3);
}

.estado.error {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.estado.info {
    background: rgba(59, 130, 246, 0.15);
    color: #60a5fa;
    border: 1px solid rgba(59, 130, 246, 0.3);
}

/* ========== DETAILS & HIDDEN ========== */
.detalles {
    margin-top: 16px;
    animation: fadeIn 0.4s ease;
}

.detalles.hidden { display: none; }

/* ========== INFO GRID / BUBBLES ========== */
.info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.info-bubble {
    background: #111;
    border: 1px solid #222;
    border-radius: 16px;
    padding: 12px;
    text-align: center;
}

.info-bubble.full { grid-column: 1 / -1; }

.info-label {
    display: block;
    font-size: 0.7rem;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.info-valor {
    display: block;
    font-size: 0.95rem;
    font-weight: 700;
    color: #fff;
}

/* ========== AQI DISPLAY ========== */
.aqi-display {
    text-align: center;
    padding: 20px;
    margin-bottom: 16px;
}

.aqi-numero {
    font-size: 4rem;
    font-weight: 800;
    color: #fff;
    line-height: 1;
    text-shadow: 0 0 20px rgba(0, 214, 143, 0.3);
}

.aqi-etiqueta {
    font-size: 1rem;
    font-weight: 600;
    margin-top: 8px;
    padding: 8px 24px;
    border-radius: 20px;
    display: inline-block;
    color: #000;
}

.barra-aqi {
    width: 100%;
    height: 10px;
    background: #1a1a1a;
    border-radius: 5px;
    overflow: hidden;
    margin-bottom: 20px;
    border: 1px solid #333;
}

.barra-fill {
    height: 100%;
    border-radius: 5px;
    transition: width 0.8s ease, background-color 0.5s ease;
    width: 0%;
}

.aqi-bueno { background: #22c55e; }
.aqi-moderado { background: #eab308; }
.aqi-insalubre-grupos { background: #f97316; }
.aqi-insaluble { background: #ef4444; }
.aqi-muy-insalubre { background: #a855f7; }
.aqi-peligroso { background: #7f1d1d; }

/* ========== RESULTS 1: IMPACT SUMMARY ========== */
.resultados-card { text-align: center; }

.residuo-nombre {
    font-size: 1.3rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 16px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.impacto-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 20px;
}

.stat-box {
    background: #111;
    border: 1px solid #222;
    border-radius: 16px;
    padding: 14px;
}

.stat-box-eco {
    border: 2px solid #00d68f;
    background: rgba(0, 214, 143, 0.05);
}

.stat-label {
    display: block;
    font-size: 0.7rem;
    color: #888;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-valor {
    display: block;
    font-size: 1.1rem;
    font-weight: 700;
    color: #ef4444;
}

.nivel-badge { color: #ef4444; }

.nivel-badge.exito { color: #22c55e; }
.nivel-badge.advertencia { color: #f97316; }
.nivel-badge.peligro { color: #ef4444; }

/* CO2 block */
.co2-bloque {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin: 16px 0 24px;
}

.co2-item {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #111;
    border: 1px solid #222;
    border-radius: 16px;
    padding: 12px;
    text-align: left;
}

.co2-icon {
    font-size: 1.6rem;
    flex-shrink: 0;
}

.co2-label {
    display: block;
    font-size: 0.65rem;
    color: #888;
    text-transform: uppercase;
    margin-bottom: 2px;
}

.co2-valor {
    display: block;
    font-size: 0.95rem;
    font-weight: 700;
    color: #ef4444;
}

.co2-pos { color: #22c55e; }

.impacto-subtitulo {
    color: #00d68f;
    text-align: left;
    font-size: 0.95rem;
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.impacto-barras { margin: 12px 0 4px; }

.barra-item {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    padding: 8px 0;
}

.barra-icon { font-size: 1.4rem; width: 30px; text-align: center; }

.barra-label {
    width: 60px;
    font-size: 0.9rem;
    color: #ccc;
    font-weight: 500;
}

.barra-track {
    flex: 1;
    height: 8px;
    background: #1a1a1a;
    border-radius: 4px;
    overflow: hidden;
}

.barra-progreso {
    height: 100%;
    background: linear-gradient(90deg, #00d68f 0%, #00a86b 100%);
    border-radius: 4px;
    transition: width 1s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 0 8px rgba(0, 214, 143, 0.4);
}

.barra-porcentaje {
    width: 50px;
    text-align: right;
    font-size: 0.9rem;
    font-weight: 700;
    color: #00d68f;
}

/* ========== ALERTS ========== */
.alerta {
    padding: 14px 16px;
    border-radius: 12px;
    margin: 12px 0;
    font-size: 0.9rem;
    display: none;
    text-align: center;
}

.alerta.visible { display: block; }

.alerta.peligro {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.alerta.advertencia {
    background: rgba(251, 191, 36, 0.15);
    color: #fbbf24;
    border: 1px solid rgba(251, 191, 36, 0.3);
}

.alerta.info {
    background: rgba(59, 130, 246, 0.15);
    color: #60a5fa;
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.alerta.exito {
    background: rgba(0, 214, 143, 0.15);
    color: #00d68f;
    border: 1px solid rgba(0, 214, 143, 0.3);
}

/* ========== FORM (manual location) ========== */
.formulario-manual {
    margin-top: 16px;
    padding: 16px;
    background: #111;
    border-radius: 16px;
    border: 2px dashed #333;
    animation: fadeIn 0.4s ease;
}

.formulario-manual.hidden { display: none; }

.manual-title {
    font-weight: 600;
    color: #ccc;
    margin-bottom: 12px;
    font-size: 0.9rem;
}

.manual-inputs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 12px;
}

.input-group label {
    display: block;
    font-size: 0.75rem;
    color: #888;
    margin-bottom: 4px;
}

.input-group input {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid #222;
    border-radius: 10px;
    font-size: 0.9rem;
    background: #0a0a0a;
    color: #fff;
}

.input-group input:focus {
    outline: none;
    border-color: #00d68f;
}

/* ========== MAP ========== */
.mapa-mini {
    width: 100%;
    height: 180px;
    border-radius: 16px;
    margin-top: 12px;
    border: 2px solid #222;
    overflow: hidden;
}

.mapa-full {
    width: 100%;
    height: calc(100vh - 110px);
    border: none;
}

/* ========== HISTORY ========== */
.historial-lista {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.historial-item {
    display: flex;
    align-items: center;
    gap: 14px;
    background: #111;
    border: 2px solid #222;
    border-radius: 20px;
    padding: 14px 16px;
    transition: border-color 0.2s, transform 0.2s;
}

.historial-item:hover {
    border-color: #00d68f;
    transform: translateY(-2px);
}

.historial-icono { font-size: 2.5rem; flex-shrink: 0; }
.historial-info { flex: 1; min-width: 0; }

.historial-nombre {
    font-size: 1rem;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.historial-fecha {
    font-size: 0.75rem;
    color: #888;
    margin-top: 2px;
}

.historial-impacto {
    font-size: 1rem;
    font-weight: 700;
    flex-shrink: 0;
}

.impacto-alto { color: #ef4444; }
.impacto-medio { color: #f97316; }
.impacto-bajo { color: #22c55e; }

.historial-vacio {
    text-align: center;
    color: #666;
    padding: 40px;
    font-size: 0.9rem;
}

/* ========== SPINNER ========== */
.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #00d68f;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-right: 8px;
    vertical-align: middle;
}

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

/* ============================================================ */
/* ========== CAMERA SCREEN (with pinch-to-zoom) ============= */
/* ============================================================ */

.camara-contenido {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #000;
    overflow: hidden;
    padding-bottom: 70px;
}

.camara-instruccion {
    text-align: center;
    padding: 14px 16px;
    color: #fff;
    font-size: 0.9rem;
    font-weight: 500;
    background: rgba(20, 20, 20, 0.85);
    border-bottom: 1px solid #1a1a1a;
    position: relative;
    z-index: 5;
}

.camara-instruccion span {
    margin-right: 6px;
}

.camara-preview {
    position: relative;
    width: 100%;
    flex: 1;
    background: #000;
    overflow: hidden;
    min-height: 280px;
    transition: box-shadow 0.3s;
    /* Enable touch events for pinch-to-zoom */
    touch-action: none;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

.camara-preview.scanning {
    box-shadow: inset 0 0 0 3px #00d68f, inset 0 0 60px rgba(0, 214, 143, 0.25);
}

#videoCamara {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    /* Smooth transition for CSS zoom fallback */
    transition: transform 0.1s ease-out;
}

#canvasCamara {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: none;
}

#canvasCamara.active { display: block; }

.camara-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #666;
    gap: 10px;
    text-align: center;
    padding: 16px;
}

.camara-placeholder p { font-size: 0.95rem; margin: 0; }
.camara-placeholder-sub { font-size: 0.8rem; color: #555; }

/* Pinch-to-zoom hint overlay */
.zoom-hint {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    color: #00d68f;
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.5s ease;
    z-index: 15;
    white-space: nowrap;
}

.zoom-hint.visible {
    opacity: 1;
}

/* Scan line animation */
.camara-scan-line {
    position: absolute;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, #00d68f, transparent);
    top: 0;
    display: none;
    animation: sweepCamara 1.6s ease-in-out infinite;
    z-index: 10;
    pointer-events: none;
}

.scanning .camara-scan-line { display: block; }

@keyframes sweepCamara {
    0%   { top: 0%;   opacity: 0; }
    10%  { opacity: 1; }
    90%  { opacity: 1; }
    100% { top: 100%; opacity: 0; }
}

.camara-marca {
    position: absolute;
    inset: 12% 8% 12% 8%;
    border: 2px dashed #00d68f;
    border-radius: 16px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s;
}

.camara-marca.visible { opacity: 0.6; }

/* Camera controls */
.camara-controles {
    display: flex;
    align-items: center;
    justify-content: space-around;
    padding: 18px 24px 14px;
    background: #000;
    border-top: 1px solid #1a1a1a;
}

.camara-btn-icono {
    background: transparent;
    border: none;
    color: #fff;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s;
}

.camara-btn-icono:hover { background: rgba(255, 255, 255, 0.1); }

.camara-shutter {
    width: 76px;
    height: 76px;
    border-radius: 50%;
    background: transparent;
    border: 4px solid #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
    transition: transform 0.15s, box-shadow 0.2s;
    box-shadow: 0 0 0 2px rgba(0,0,0,0.3);
}

.camara-shutter:hover {
    box-shadow: 0 0 0 4px rgba(0, 214, 143, 0.3), 0 0 30px rgba(0, 214, 143, 0.4);
}

.camara-shutter:active { transform: scale(0.92); }

.camara-shutter-inner {
    display: block;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #00d68f;
    transition: background 0.2s;
}

.camara-shutter:hover .camara-shutter-inner { background: #00f0a0; }

.camara-botones-accion {
    padding: 8px 16px 12px;
    background: #000;
    text-align: center;
}

.camara-btn-accion { max-width: 320px; margin: 8px auto; }

#btnIniciarCamara {
    background: linear-gradient(135deg, #00d68f 0%, #00a86b 100%);
    color: #000;
}

#btnReintentar {
    background: transparent;
    border: 2px solid #00d68f;
    color: #00d68f;
}

/* ========== Analysis section ========== */
.analisis-seccion {
    background: #0a0a0a;
    border-top: 1px solid #1a1a1a;
    padding: 12px 16px 16px;
    text-align: center;
    display: none;
    animation: slideUp 0.4s ease;
}

.analisis-seccion.visible { display: block; }

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

.analisis-loading {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}

.analisis-loading.hidden { display: none; }

.analisis-spinner {
    width: 28px;
    height: 28px;
    border: 3px solid rgba(0, 214, 143, 0.2);
    border-top-color: #00d68f;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    flex-shrink: 0;
}

.analisis-texto {
    color: #00d68f;
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
}

.analisis-barra {
    width: 100%;
    max-width: 320px;
    height: 8px;
    background: #1a1a1a;
    border-radius: 4px;
    overflow: hidden;
    margin-top: 4px;
}

.analisis-barra-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #00d68f, #00f0a0);
    border-radius: 4px;
    transition: width 0.3s ease;
    box-shadow: 0 0 10px rgba(0, 214, 143, 0.5);
}

.analisis-porcentaje {
    color: #888;
    font-size: 0.85rem;
    font-weight: 600;
    margin: 0;
    width: 100%;
}

.analisis-resultado {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.analisis-resultado.hidden { display: none; }

.analisis-check {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #00d68f;
    color: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    font-weight: 800;
    box-shadow: 0 0 20px rgba(0, 214, 143, 0.4);
    animation: popIn 0.3s ease;
}

@keyframes popIn {
    0% { transform: scale(0); }
    60% { transform: scale(1.15); }
    100% { transform: scale(1); }
}

.analisis-tipo {
    color: #fff;
    font-size: 1.3rem;
    font-weight: 700;
    margin: 4px 0 0;
}

.analisis-confianza {
    color: #00d68f;
    font-size: 0.9rem;
    font-weight: 600;
    margin: 0;
}

/* ============================================================ */
/* ========== RESULTS 2: FUTURE PROJECTION (Image 3) ========== */
/* ============================================================ */

.futuro-titulo {
    color: #fff;
    font-size: 1.2rem;
    margin-bottom: 8px;
    font-weight: 700;
}

/* Timeline */
.timeline {
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 24px 0 28px;
    padding: 0 10px;
}

.timeline-linea {
    position: absolute;
    top: 50%;
    left: 18px;
    right: 18px;
    height: 2px;
    background: linear-gradient(90deg, #00d68f 0%, #00a86b 100%);
    transform: translateY(-50%);
    z-index: 1;
    border-radius: 2px;
    box-shadow: 0 0 8px rgba(0, 214, 143, 0.3);
}

.timeline-nodo {
    background: #0a0a0a;
    border: none;
    color: #888;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    padding: 4px;
    z-index: 2;
    position: relative;
    transition: all 0.25s;
}

.timeline-punto {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #00d68f;
    border: 3px solid #0a0a0a;
    box-shadow: 0 0 10px rgba(0, 214, 143, 0.5);
    transition: all 0.25s;
}

.timeline-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #888;
    transition: color 0.25s;
}

.timeline-nodo.activo .timeline-punto {
    width: 24px;
    height: 24px;
    box-shadow: 0 0 16px rgba(0, 214, 143, 0.8);
    background: #00f0a0;
}

.timeline-nodo.activo .timeline-label { color: #00d68f; }

.timeline-nodo:hover .timeline-label { color: #ccc; }
.timeline-nodo.activo:hover .timeline-label { color: #00f0a0; }

.futuro-contenido {
    margin-top: 16px;
    animation: fadeIn 0.4s ease;
}

.futuro-imagen {
    width: 100%;
    height: 180px;
    border-radius: 20px;
    background: linear-gradient(135deg, #0d3328 0%, #1a5c3d 50%, #0d3328 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
    border: 2px solid #00d68f;
    position: relative;
    overflow: hidden;
}

.futuro-imagen-emoji {
    font-size: 6rem;
    filter: drop-shadow(0 0 20px rgba(0, 214, 143, 0.5));
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.futuro-descripcion {
    background: #0d1f15;
    border: 1px solid #1a3a2a;
    border-radius: 16px;
    padding: 16px;
    color: #ccc;
    font-size: 0.9rem;
    line-height: 1.6;
    margin-bottom: 16px;
}

.futuro-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.futuro-stat {
    background: #111;
    border: 1px solid #222;
    border-radius: 16px;
    padding: 12px;
    text-align: center;
}

.futuro-stat-label {
    display: block;
    font-size: 0.65rem;
    color: #888;
    text-transform: uppercase;
    margin-bottom: 4px;
    letter-spacing: 0.5px;
}

.futuro-stat-valor {
    display: block;
    font-size: 0.95rem;
    font-weight: 700;
    color: #fff;
}

#futuroCo2 {
    color: #00d68f;
    font-size: 1rem;
}

/* ============================================================ */
/* ========== RESULTS 3: RECYCLING TIPS (Image 4) ============= */
/* ============================================================ */

.tips-tipo {
    color: #fff;
    font-size: 1.4rem;
    font-weight: 700;
    margin: 8px 0 12px;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.tips-pasos {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 16px;
}

.tip-paso {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    background: #111;
    border: 2px solid #00d68f;
    border-radius: 16px;
    padding: 16px;
    transition: all 0.25s;
}

.tip-paso:nth-child(even) {
    flex-direction: row-reverse;
    text-align: right;
}

.tip-paso:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(0, 214, 143, 0.15);
}

.tip-num {
    font-size: 2.2rem;
    font-weight: 800;
    color: #00d68f;
    line-height: 1;
    min-width: 40px;
    flex-shrink: 0;
    text-shadow: 0 0 10px rgba(0, 214, 143, 0.4);
}

.tip-paso p {
    font-size: 0.9rem;
    color: #ccc;
    line-height: 1.5;
    margin: 0;
    flex: 1;
}

/* Sustainability items */
.tips-sostenibilidad {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 12px;
}

.sostenibilidad-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    background: #111;
    border: 1px solid #222;
    border-radius: 14px;
    padding: 14px;
    transition: border-color 0.2s;
}

.sostenibilidad-item:hover { border-color: #00d68f; }

.sostenibilidad-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.sostenibilidad-item h5 {
    color: #00d68f;
    font-size: 0.95rem;
    margin: 0 0 4px;
    font-weight: 600;
}

.sostenibilidad-item p {
    color: #ccc;
    font-size: 0.85rem;
    margin: 0;
    line-height: 1.5;
}

/* Final card */
.tips-card-final {
    text-align: center;
}

.frase-final {
    text-align: center;
    margin: 16px 0 12px;
    font-size: 1rem;
    color: #aaa;
    line-height: 1.6;
}

.frase-final span {
    color: #ef4444;
    font-weight: 700;
}

.ilustracion-reciclaje {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    margin: 16px 0 4px;
    padding: 12px;
}

.reciclaje-persona {
    font-size: 3.5rem;
    animation: bounce 2s ease-in-out infinite;
}

.reciclaje-contenedor {
    font-size: 3.5rem;
    background: #00d68f;
    width: 80px;
    height: 80px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #000;
    box-shadow: 0 0 20px rgba(0, 214, 143, 0.3);
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}

/* ========== RESPONSIVE ========== */
@media (max-width: 380px) {
    .info-grid { grid-template-columns: 1fr; }
    .aqi-numero { font-size: 3rem; }
    .impacto-stats { grid-template-columns: 1fr; }
    .manual-inputs { grid-template-columns: 1fr; }
    .co2-bloque { grid-template-columns: 1fr; }
    .futuro-stats { grid-template-columns: 1fr; }
    .timeline-label { font-size: 0.65rem; }
}

@media (min-width: 600px) {
    body {
        display: flex;
        justify-content: center;
        align-items: center;
        background: #111;
    }

    .pantalla {
        max-width: 430px;
        max-height: 932px;
        border-radius: 40px;
        border: 8px solid #222;
        box-shadow: 0 0 60px rgba(0,0,0,0.8);
    }

    .nav-bottom {
        max-width: 414px;
        left: 50%;
        transform: translateX(-50%);
        border-radius: 0 0 32px 32px;
    }
}
