:root {
    --primary: #1d9c73;
    --primary-dark: #22573d;
    /* Darker green for buttons like KetoGo */
    --hover: #15825f;
    --primary-light: #e5f5f0;
    /* Light active background */
    --bg-color: #faf3e8;
    /* Verified KetoGo-like background */
    --card-bg: #ffffff;
    --text-main: #023624;
    /* Very dark green for text like titles */
    --text-muted: #6b7280;
    --border-color: #e5e7eb;
    --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --radius-btn: 12px;
    --radius-card: 24px;
    --shadow-main: 0 10px 25px rgba(0, 0, 0, 0.05);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    -webkit-font-smoothing: antialiased;
}

/* NEW HEADER & NAVIGATION */
.quiz-header-top {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 12px 24px;
    background: transparent;
    max-width: 900px;
    margin: 0 auto;
}

.logo-small {
    font-size: 1.3rem;
}

.quiz-navigation {
    position: sticky;
    top: 0;
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
    background: var(--bg-color);
    z-index: 100;
}

.nav-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 24px 3px;
}

.step-counter {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-main);
}

.back-btn {
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 5px;
}

.progress-container {
    width: calc(100% - 48px);
    margin: 0 auto 10px;
    height: 8px;
    background-color: #ebd5c1;
    border-radius: 4px;
}

.progress-bar {
    height: 100%;
    background-color: var(--primary);
    width: 0%;
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 4px;
}

/* MAIN CONTAINER */
.quiz-container {
    flex: none;
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
    padding: 25px 24px 80px;
}

/* STEP ANIMATIONS */
.step {
    display: none;
    opacity: 0;
    transform: translateY(15px);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.step.active {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

/* TYPOGRAPHY */
h1 {
    font-size: 2.2rem;
    font-weight: 800;
    text-align: center;
    color: var(--text-main);
    margin: 15px auto 30px;
    line-height: 1.15;
    max-width: 700px;
    letter-spacing: -0.5px;
}

.subtitle {
    text-align: center;
    color: var(--text-muted);
    font-size: 1.05rem;
    margin-bottom: 32px;
}

/* MULTIPLE CHOICE / OPTIONS */
.options-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
}

.option-btn {
    background: #f5e6d3;
    border: 1px solid #e8d5c0;
    border-radius: 8px;
    padding: 18px 20px;
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-main);
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    min-height: auto;
    margin-bottom: 0px;
}

.option-btn .checkbox {
    width: 24px;
    height: 24px;
    border: 2px solid #fff;
    background: #fff;
    border-radius: 4px;
    margin-right: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.option-btn.selected .checkbox {
    background: var(--primary);
    border-color: var(--primary);
}

.option-btn.selected .checkbox::after {
    content: '✓';
    color: white;
    font-size: 14px;
    font-weight: 900;
}

.option-btn .text {
    flex: 1;
}

.option-side-img {
    width: 100px;
    height: 100%;
    object-fit: cover;
    margin: -12px -20px -12px 0;
    clip-path: ellipse(100% 100% at 100% 50%);
    border-radius: 0 var(--radius-btn) var(--radius-btn) 0;
}

.option-btn:hover,
.option-btn.selected {
    border-color: var(--primary);
    background-color: var(--primary-light);
}

/* GRID OPTIONS */
.options-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    max-width: 600px;
    margin: 0 auto;
}

.option-grid-btn {
    background: var(--card-bg);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-btn);
    padding: 35px 15px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    transition: all 0.2s ease;
}

.option-grid-btn .icon-emoji {
    font-size: 3.5rem;
}

.option-grid-btn .text {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-main);
}

.option-grid-btn:hover,
.option-grid-btn.selected {
    border-color: var(--primary);
    background-color: var(--primary-light);
}

/* NEW: OPTIONS IMAGE GRID (4 columns) */
.options-image-grid {
    display: grid;
    gap: 16px;
    margin: 0 auto;
}

.option-img-btn {
    background: #f4e3cf;
    /* Match other buttons */
    border: 2px solid transparent;
    border-radius: var(--radius-btn);
    padding: 8px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    transition: all 0.2s ease;
}

.option-img-btn:hover,
.option-img-btn.selected {
    border-color: var(--primary);
}

.option-grid-img {
    width: 100%;
    aspect-ratio: 3/4;
    object-fit: cover;
    border-radius: 6px;
}

.option-img-btn .text {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--text-main);
    padding-bottom: 5px;
}

/* UNIT TOGGLE SWITCH */
.unit-toggle-container {
    display: flex;
    justify-content: center;
    background: #f1e1cd;
    border-radius: 8px;
    padding: 4px;
    margin: 0 auto 20px;
    max-width: 140px;
}

.unit-toggle {
    flex: 1;
    background: transparent;
    border: none;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-main);
    padding: 6px 10px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.unit-toggle.active {
    background: var(--primary);
    color: #ffffff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.unit-inputs-wrapper {
    display: flex;
    justify-content: center;
    max-width: 320px;
    margin: 0 auto;
}

/* INPUT FLOATING */
.input-wrapper {
    position: relative;
    max-width: 320px;
    margin: 0 auto 30px;
}

.input-field {
    width: 100%;
    padding: 22px 50px 22px 22px;
    font-size: 1.6rem;
    font-weight: 700;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-btn);
    text-align: center;
    color: var(--text-main);
    outline: none;
    transition: all 0.2s;
    background: var(--card-bg);
    font-family: var(--font-family);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.02) inset;
}

.input-field:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(29, 156, 115, 0.15);
}

.input-unit {
    position: absolute;
    right: 25px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-weight: 600;
    font-size: 1.4rem;
}

/* CTA BUTTONS */
.cta-container {
    margin-top: 35px;
    text-align: center;
    width: 100%;
}

.cta-btn {
    background-color: var(--primary-dark);
    color: #fff;
    border: none;
    padding: 18px 40px;
    border-radius: 5px;
    font-size: 1.15rem;
    font-weight: 700;
    width: 100%;
    max-width: 320px;
    cursor: pointer;
    transition: all 0.2s;
    font-family: var(--font-family);
    display: inline-block;
}

.step-one-active .cta-btn {
    border-radius: 50px;
    max-width: 100%;
}

.cta-btn:hover {
    background-color: var(--hover);
}

.cta-btn:active {
    transform: translateY(0);
}

.cta-btn:disabled {
    background-color: #9ca3af;
    box-shadow: none;
    transform: none;
    cursor: default;
}

/* ERROR MESSAGE */
.error-msg {
    color: #ef4444;
    font-size: 0.95rem;
    font-weight: 600;
    margin-top: -20px;
    margin-bottom: 20px;
    text-align: center;
    display: none;
}

/* INFO CARDS / CHARTS */
.info-card {
    background: var(--card-bg);
    border-radius: var(--radius-card);
    padding: 30px 24px;
    text-align: center;
    box-shadow: var(--shadow-main);
    border: 1px solid var(--border-color);
    margin-bottom: 30px;
}

/* PROCESSING LOADER */
.loader-container {
    text-align: center;
    padding: 50px 0;
}

.circular-chart {
    display: block;
    margin: 0 auto;
    max-width: 140px;
    max-height: 140px;
}

.circle-bg {
    fill: none;
    stroke: #f3f4f6;
    stroke-width: 3.5;
}

.circle {
    fill: none;
    stroke: var(--primary);
    stroke-width: 3.5;
    stroke-linecap: round;
    animation: progress 2s ease-out forwards;
}

@keyframes progress {
    0% {
        stroke-dasharray: 0 100;
    }
}

@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: scale(0.3);
    }

    50% {
        opacity: 1;
        transform: scale(1.15);
    }

    70% {
        transform: scale(0.9);
    }

    100% {
        opacity: 1;
        transform: scale(1);
    }
}

.percentage {
    fill: var(--text-main);
    font-family: var(--font-family);
    font-size: 0.45em;
    text-anchor: middle;
    font-weight: 800;
}

/* IMAGE HACK REFINEMENT */
.img-crop-container {
    width: 100%;
    max-width: 500px;
    margin: 20px auto;
    overflow: hidden;
    position: relative;
    border-radius: 12px;
}

.cropped-img {
    width: 100%;
    display: block;
    object-fit: contain;
}

/* --- STEP ONE SPECIAL DESIGN --- */
.step-one-active {
    background-image: url('bg_keto.png');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    background-repeat: no-repeat;
}

.step-one-active .quiz-container {
    background: transparent;
    box-shadow: none;
    border: none;
    margin: 40px auto 0;
    max-width: 650px;
}

.step-one-active h1 {
    color: #ffffff;
    font-size: 2.2rem;
    line-height: 1.1;
    margin: 0 auto 15px;
    font-weight: 800;
}

.step-one-active .subtitle {
    color: #ffffff;
    font-weight: 700;
    margin-bottom: 30px;
}

.step-one-active .options-grid {
    max-width: 650px;
    gap: 20px;
}

.step-one-active .option-grid-btn {
    padding: 0;
    overflow: hidden;
    border: none;
    background: #fff;
    border-radius: 12px;
    max-width: 300px;
    /* Limit card size */
    margin: 0 auto;
}

.step-one-active .option-img {
    width: 100%;
    aspect-ratio: 1/1;
    object-fit: cover;
    display: block;
}

.step-one-active .option-grid-btn .text {
    padding: 15px;
    font-size: 1.1rem;
    font-weight: 700;
}

.step-one-active .quiz-header-top {
    display: none !important;
}

.step-one-active .quiz-navigation {
    display: none !important;
}

.step-one-active .footer-text {
    color: rgba(255, 255, 255, 0.7);
    background: rgba(0, 0, 0, 0.4);
    border-top-color: rgba(255, 255, 255, 0.1);
}

/* INFO IMAGE CONTAINER */

.info-img-container {
    width: 100%;
    margin: 20px auto;
    display: flex;
    justify-content: center;
}

.info-full-img {
    max-width: 450px;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.06);
}

.footer-text {
    font-size: 0.75rem;
    color: #d1d5db;
    text-align: center;
    margin-top: 30px;
}

/* ========== NEW DESKTOP FOOTER ========== */
.full-footer {
    width: 100%;
    font-family: var(--font-family);
    margin-top: 15vh;
    /* Amplio espacio entre el quiz y el pie de página */
}

.footer-disclaimer-top {
    background-color: #fdf5ea;
    /* Light orange/beige */
    padding: 40px 20px;
    color: var(--text-main);
    font-size: 0.9rem;
    line-height: 1.6;
}

.footer-disclaimer-inner {
    max-width: 1000px;
    margin: 0 auto;
}

.footer-disclaimer-inner h4 {
    font-size: 1rem;
    font-weight: 800;
    margin-bottom: 15px;
}

.footer-disclaimer-inner p {
    margin-bottom: 20px;
}

.footer-disclaimer-inner p:last-child {
    margin-bottom: 0;
}

.footer-middle {
    background-color: #ebd5c1;
    /* Darker beige */
    padding: 50px 20px 40px;
    color: var(--text-main);
}

.footer-middle-inner {
    max-width: 1000px;
    margin: 0 auto;
}

.footer-brand {
    font-size: 1.4rem;
    font-weight: 800;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.footer-brand span.emoji {
    font-size: 1.6rem;
}

.footer-certified-text {
    font-weight: 700;
    font-size: 1rem;
    margin-bottom: 30px;
}

.footer-columns {
    display: grid;
    grid-template-columns: 1fr;
    gap: 30px;
    margin-bottom: 40px;
}

@media (min-width: 768px) {
    .footer-columns {
        grid-template-columns: 1fr 1fr;
        gap: 50px;
    }
}

.footer-col h5 {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1rem;
    font-weight: 800;
    margin-bottom: 15px;
}

.footer-col p {
    font-size: 0.9rem;
    line-height: 1.6;
    color: rgba(2, 54, 36, 0.85);
    /* Slightly muted text-main */
}

.footer-links {
    display: flex;
    flex-wrap: wrap;
    gap: 20px 30px;
    margin-bottom: 30px;
    font-size: 0.9rem;
}

.footer-links a {
    color: var(--text-main);
    text-decoration: underline;
    font-weight: 600;
    transition: color 0.2s;
}

.footer-links a:hover {
    color: var(--primary);
}

.footer-fb-disclaimer {
    font-size: 0.8rem;
    line-height: 1.5;
    color: rgba(2, 54, 36, 0.7);
}

.footer-bottom {
    background-color: var(--primary-dark);
    color: #fff;
    text-align: center;
    padding: 20px;
    font-size: 0.9rem;
    font-weight: 600;
}

@media (min-width: 768px) {
    .quiz-container {
        padding: 0 48px 80px;
    }

    .step-one-active .quiz-container {
        margin-top: 20px;
        padding-top: 20px;
    }

    .options-image-grid {
        gap: 24px;
    }
}

/* --- DARK THEME SPECIAL DESIGN --- */
.dark-theme {
    background-color: var(--primary-dark);
    color: #ffffff;
}

.dark-theme .step.active {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    min-height: 80vh;
}

.dark-theme h1 {
    color: #ffffff;
    font-size: 2.2rem;
    line-height: 1.15;
    margin: 10px 0 20px;
    text-align: center;
}

.dark-theme .subtitle {
    color: #f3f4f6;
    font-size: 1.1rem;
    line-height: 1.6;
    text-align: center;
}

.dark-theme .info-img-container {
    margin: 20px auto 10px;
    background: transparent;
    padding: 0;
    max-width: 120px;
}

.dark-theme .info-full-img {
    width: 100%;
    margin: 0 auto;
    display: block;
}

.dark-theme .cta-btn {
    background: transparent;
    border: 1px solid #ffffff;
    color: #ffffff;
    margin-top: 30px;
}

.dark-theme .cta-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}