:root {
    --bg-color: #ffffff;
    --card-bg: #fdfbfb;
    --card-hover: #f3f4f6;
    --primary: #10b981;
    --primary-hover: #059669;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --progress-bg: #f1f5f9;
    --transition: all 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.6;
    overflow-x: hidden;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

header {
    padding: 1rem 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    position: sticky;
    top: 0;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    z-index: 100;
    border-bottom: 1px solid var(--border-color);
}

.back-btn {
    position: absolute;
    left: 2rem;
    background: none;
    border: none;
    color: var(--text-main);
    font-size: 1.5rem;
    cursor: pointer;
    display: none;
    /* Hidden on start */
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100px;
    width: 100px;
}

.logo img {
    height: 100%;
    width: auto;
    object-fit: contain;
}

.progress-container {
    width: 100%;
    height: 4px;
    background: var(--progress-bg);
    position: absolute;
    bottom: 0;
    left: 0;
}

.progress-bar {
    height: 100%;
    background: var(--primary);
    width: 0%;
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

main {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

#app-container {
    width: 100%;
    max-width: 600px;
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
        transform: translateY(0);
    }

    to {
        opacity: 0;
        transform: translateY(-10px);
    }
}

/* Typography */
h1 {
    font-size: 2.2rem;
    margin-bottom: 1.5rem;
    text-align: center;
    background: linear-gradient(135deg, #1e293b 0%, #64748b 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

p.description {
    color: var(--text-muted);
    text-align: center;
    margin-bottom: 2rem;
    font-size: 1.1rem;
}

.message-step {
    text-align: center;
}

.message-image {
    width: 100%;
    max-width: 500px;
    margin: 0 auto 2rem;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.message-image img {
    width: 100%;
    height: auto;
    display: block;
}

/* Choices/Cards */
.options-grid {
    display: grid;
    gap: 1rem;
    margin-bottom: 2rem;
}

.age-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.6rem;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

.card-square {
    flex-direction: column !important;
    justify-content: center;
    text-align: center;
    padding: 0.8rem !important;
    min-height: 100px;
}

.card-square .card-icon {
    margin-right: 0 !important;
    margin-bottom: 0.25rem;
    width: 150px !important;
    height: 150px !important;
    background: none;
    /* Quitamos el fondo para ganar espacio visual */
}

@media (max-width: 480px) {
    .age-grid {
        gap: 0.5rem;
    }

    .card-square {
        padding: 0.2rem !important;
        min-height: auto;
    }

    .card-square .card-icon {
        width: 120px !important;
        height: 120px !important;
    }

    .card-square .card-text {
        font-size: 0.95rem;
        font-weight: 800;
        line-height: 1;
        margin-bottom: 0.4rem;
    }
}

.card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1.25rem;
    display: flex;
    align-items: center;
    cursor: pointer;
    transition: var(--transition);
}

.card:hover {
    background: var(--card-hover);
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

.card.selected {
    border-color: var(--primary);
    background: rgba(16, 185, 129, 0.15);
    box-shadow: 0 0 0 2px var(--primary);
}

.check-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 1.2rem;
}

.card-icon {
    font-size: 2rem;
    margin-right: 1.5rem;
    width: 100px;
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(16, 185, 129, 0.1);
    border-radius: 12px;
    overflow: hidden;
    flex-shrink: 0;
}

.card-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.card-text {
    font-weight: 500;
}

/* Controls */
.controls {
    display: flex;
    justify-content: center;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
    border: none;
    padding: 1rem 3rem;
    border-radius: 100px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 4px 14px rgba(16, 185, 129, 0.4);
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: scale(1.05);
}

.btn-primary:disabled {
    background: var(--text-muted);
    cursor: not-allowed;
    box-shadow: none;
}

/* Result Styles */
.result-header {
    text-align: center;
    margin-bottom: 3rem;
}

.score-circle {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    border: 8px solid var(--primary);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
}

.score-value {
    font-size: 3rem;
    font-weight: 800;
}

.score-label {
    font-size: 0.8rem;
    text-transform: uppercase;
    color: var(--text-muted);
}

.recommendations {
    display: grid;
    gap: 2rem;
}

.rec-category {
    background: var(--card-bg);
    border-radius: 20px;
    padding: 1.5rem;
    border-left: 4px solid var(--primary);
}

.rec-title {
    font-weight: 700;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
}

.rec-title .icon {
    margin-right: 0.5rem;
}

.rec-list {
    list-style: none;
    color: var(--text-muted);
}

.rec-list li {
    margin-top: 0.5rem;
    padding-left: 1.5rem;
    position: relative;
}

.rec-list li::before {
    content: "•";
    color: var(--primary);
    position: absolute;
    left: 0;
    font-weight: bold;
}

/* Loading Screen Styles */
.loading-screen {
    text-align: center;
    max-width: 400px;
    margin: 0 auto;
}

.loading-bar-wrapper {
    width: 100%;
    height: 12px;
    background: var(--progress-bg);
    border-radius: 10px;
    margin-bottom: 1rem;
    overflow: hidden;
    position: relative;
    border: 1px solid var(--border-color);
}

.loading-bar-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--primary), #34d399);
    transition: width 0.1s linear;
}

.loading-percentage {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 2rem;
    color: var(--primary);
}

.loading-checklist {
    text-align: left;
    list-style: none;
    margin-top: 2rem;
}

.loading-item {
    display: flex;
    align-items: center;
    margin-bottom: 1rem;
    color: var(--text-muted);
    font-size: 1rem;
    transition: var(--transition);
}

.loading-item.complete {
    color: var(--text-main);
}

.check-icon {
    width: 20px;
    height: 20px;
    margin-right: 1rem;
    border: 2px solid var(--border-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    transition: var(--transition);
}

.loading-item.complete .check-icon {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.loading-item.complete .check-icon::after {
    content: "✓";
}

.download-ready-text {
    font-size: 1.6rem;
    color: #000000 !important;
    font-weight: 800 !important;
    margin-bottom: 1.5rem;
}

/* BMI Ruler Styles */
.bmi-step {
    text-align: center;
}

.weight-display {
    margin: 1.5rem 0 1rem;
}

.weight-value {
    font-size: 5rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary), #34d399);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    line-height: 1;
}

.weight-unit {
    font-size: 1.5rem;
    color: var(--text-muted);
    margin-left: 0.25rem;
    vertical-align: baseline;
}

.ruler-container {
    position: relative;
    width: 100%;
    overflow: hidden;
    margin: 1rem 0;
}

.ruler-indicator {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 3px;
    height: 45px;
    background: var(--primary);
    border-radius: 3px;
    z-index: 10;
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.6);
}

.ruler-indicator::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    border-left: 7px solid transparent;
    border-right: 7px solid transparent;
    border-top: 9px solid var(--primary);
}

.ruler-track {
    overflow: hidden;
    width: 100%;
    height: 60px;
    cursor: grab;
    user-select: none;
    padding-top: 4px;
}

.ruler-track:active {
    cursor: grabbing;
}

.ruler-inner {
    display: flex;
    align-items: flex-start;
    position: relative;
    height: 100%;
    transition: transform 0.05s linear;
}

.ruler-tick {
    width: 2px;
    background: var(--text-muted);
    margin-right: 12px;
    border-radius: 2px;
    flex-shrink: 0;
}

.ruler-tick.major {
    background: var(--primary);
    width: 2px;
}

.ruler-tick.mid {
    background: rgba(16, 185, 129, 0.4);
}

.ruler-label {
    position: absolute;
    top: 34px;
    font-size: 0.75rem;
    color: var(--text-muted);
    transform: translateX(-50%);
    white-space: nowrap;
}

.ruler-hint {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-top: 2rem;
    letter-spacing: 0.03em;
}

.bmi-info-card {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 1.1rem 1.25rem;
    margin-top: 1.5rem;
    text-align: left;
}

.bmi-info-icon {
    font-size: 1.4rem;
    flex-shrink: 0;
    margin-top: 2px;
}

.bmi-info-title {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text-main);
    margin-bottom: 0.35rem;
}

.bmi-info-desc {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.5;
}

/* Download Section */
.download-ready-text {
    font-size: 1rem;
    color: var(--primary);
    font-weight: 600;
    margin-bottom: 1.25rem;
    letter-spacing: 0.02em;
}

.btn-download {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1rem;
    padding: 1rem 2rem;
    border-radius: 50px;
    text-decoration: none;
    background: linear-gradient(135deg, var(--primary), #34d399);
    color: white;
    font-weight: 700;
    box-shadow: 0 4px 20px rgba(16, 185, 129, 0.4);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    cursor: pointer;
    border: none;
    width: 100%;
    justify-content: center;
}

.btn-download:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 28px rgba(16, 185, 129, 0.55);
}

/* Mobile adjustments - Optimized for no scroll */
@media (max-width: 480px) {
    header {
        padding: 0.5rem 1rem;
    }

    .logo {
        height: 60px;
        width: 60px;
    }

    main {
        padding: 0.5rem 1rem;
    }

    h1 {
        font-size: 1.4rem;
        margin-bottom: 0.75rem;
    }

    p.description {
        font-size: 0.95rem;
        margin-bottom: 1rem;
        line-height: 1.3;
    }

    .message-image {
        margin-bottom: 1rem;
        max-width: 250px;
    }

    .options-grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        /* 2 columnas en móvil por defecto para ahorrar espacio */
        gap: 0.5rem;
        margin-bottom: 1rem;
    }

    /* Centrar la última opción si es impar (especialmente útil para 3 opciones) */
    .options-grid .card:last-child:nth-child(odd) {
        grid-column: 1 / span 2;
        justify-self: center;
        width: calc(50% - 0.25rem);
        /* Mismo ancho que las opciones de arriba */
    }

    /* Si solo hay 2 o 3 opciones, podemos dejarlas en 1 columna si queremos, 
       pero 2 columnas siempre ahorra más espacio vertical */

    .card {
        padding: 0.5rem;
        flex-direction: column;
        justify-content: center;
        text-align: center;
        min-height: 80px;
    }

    .card-icon {
        width: 35px;
        height: 35px;
        font-size: 1.2rem;
        margin-right: 0;
        margin-bottom: 0.25rem;
    }

    .card-text {
        font-size: 0.8rem;
        line-height: 1.1;
    }

    /* Age specific override still needed but smaller */
    .card-square .card-icon {
        width: 110px !important;
        height: 110px !important;
    }

    /* BMI Section optimization */
    .weight-value {
        font-size: 3.5rem;
    }

    .weight-display {
        margin: 0.5rem 0;
    }

    .ruler-container {
        margin: 0.5rem 0;
    }

    .ruler-hint {
        margin-top: 1rem;
    }

    .bmi-info-card {
        padding: 0.6rem;
        margin-top: 0.8rem;
        gap: 0.6rem;
    }

    .bmi-info-title {
        font-size: 0.85rem;
    }

    .bmi-info-desc {
        font-size: 0.75rem;
    }

    .btn-primary {
        padding: 0.8rem 2rem;
        font-size: 1rem;
    }

    .controls {
        margin-top: 1rem !important;
    }
}

/* Social Proof Popup */
.social-popup {
    position: fixed;
    bottom: 1.5rem;
    left: 1.5rem;
    transform: translateX(-150%);
    background: #ffffff;
    border: 1px solid rgba(16, 185, 129, 0.3);
    border-radius: 12px;
    padding: 0.8rem 1.2rem;
    display: flex;
    align-items: center;
    gap: 0.8rem;
    font-size: 0.88rem;
    color: #1e293b;
    font-weight: 500;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    opacity: 0;
    transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.4s ease;
    white-space: nowrap;
    pointer-events: none;
}

@media (max-width: 480px) {
    .social-popup {
        bottom: auto;
        top: 1rem;
        left: 50%;
        transform: translate(-50%, -150%);
        width: 90%;
        max-width: 350px;
    }

    .social-popup.visible {
        transform: translate(-50%, 0) !important;
    }
}

.social-popup.visible {
    opacity: 1;
    transform: translateX(0);
}

.social-dot {
    width: 9px;
    height: 9px;
    background: #10b981;
    border-radius: 50%;
    flex-shrink: 0;
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.5);
    animation: pulse-dot 1.8s ease-in-out infinite;
}

@keyframes pulse-dot {
    0% {
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.5);
    }

    70% {
        box-shadow: 0 0 0 7px rgba(16, 185, 129, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
    }
}

/* Age Grid Layout */
.options-grid.age-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(2, 1fr);
    gap: 1rem;
    max-width: 450px;
    margin: 0 auto 2rem;
}

.card.card-square {
    flex-direction: column;
    justify-content: center;
    text-align: center;
    padding: 1.5rem 1rem;
    aspect-ratio: 1 / 1;
}

.card.card-square .card-icon {
    margin-right: 0;
    margin-bottom: 0.75rem;
    width: 170px;
    height: 170px;
    background: transparent;
}

.card.card-square .card-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.card.card-square .card-text {
    font-size: 1.1rem;
    font-weight: 600;
}

/* Timer Banner */
.timer-banner {
    background: #fee2e2;
    color: #991b1b;
    padding: 1.2rem;
    text-align: center;
    font-weight: 700;
    font-size: 1.1rem;
    border-radius: 12px;
    margin-bottom: 2rem;
    border: 1px solid #fecaca;
    box-shadow: 0 4px 12px rgba(153, 27, 27, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

#timer-countdown {
    font-variant-numeric: tabular-nums;
    font-family: inherit;
    font-size: 1.3rem;
    background: #991b1b;
    color: white;
    padding: 0.2rem 0.8rem;
    border-radius: 8px;
    min-width: 80px;
}

.offer-screen {
    text-align: center;
    max-width: 600px;
    margin: 0 auto;
    animation: fadeIn 0.8s ease;
    padding-bottom: 3rem;
}

.offer-title {
    font-size: 1.8rem;
    color: var(--text-main);
    margin-bottom: 2rem;
    line-height: 1.3;
}

/* FAQ Styles */
.faq-section {
    margin-top: 4rem;
    text-align: left;
    max-width: 650px;
    margin-left: auto;
    margin-right: auto;
}

.faq-title {
    font-size: 1.6rem;
    font-weight: 800;
    color: #111827;
    text-align: center;
    margin-bottom: 2rem;
}

.faq-item {
    border-bottom: 1px solid #e5e7eb;
    margin-bottom: 0.5rem;
}

.faq-question {
    width: 100%;
    background: none;
    border: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.2rem 0.5rem;
    cursor: pointer;
    font-size: 1.1rem;
    font-weight: 700;
    color: #111827;
    text-align: left;
    transition: var(--transition);
}

.faq-question:hover {
    color: var(--primary);
}

.faq-answer {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out, padding 0.3s ease;
    padding: 0 0.5rem;
    color: #4b5563;
    line-height: 1.6;
    font-size: 1rem;
}

.faq-item.active .faq-answer {
    max-height: 300px;
    padding-bottom: 1.2rem;
}

.faq-icon::after {
    content: '+';
    font-size: 1.4rem;
    font-weight: 400;
    color: var(--text-muted);
}

.faq-item.active .faq-icon::after {
    content: '−';
}