/* ==========================================================================
   MACA LA GIRAFE - STYLES & ANIMATIONS (DRILLFLOW)
   ========================================================================== */

/* Arrière-plan flouté d'immersion */
.maca-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.45s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.45s;
    pointer-events: auto;
}

.maca-backdrop.active {
    opacity: 1;
    visibility: visible;
}

/* Conteneur principal fixe plein écran */
.maca-wrapper {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    max-height: 100dvh;
    z-index: 10001;
    pointer-events: none;
    display: flex;
    box-sizing: border-box;
    overflow: hidden;
    transition: all 0.3s ease;
}

/* Zone combinée : Créature Maca + Bulle de dialogue */
.maca-stage {
    position: relative;
    display: flex;
    pointer-events: auto;
    transition: all 0.3s ease;
}

/* --------------------------------------------------------------------------
   Illustrations de Maca & Animations de Surgissement
   -------------------------------------------------------------------------- */
.maca-creature {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    user-select: none;
    pointer-events: none;
    transition: transform 0.85s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: 2;
}

.maca-mascot-img {
    display: block;
    height: 420px;
    width: auto;
    max-width: 320px;
    object-fit: contain;
    filter: drop-shadow(0 15px 35px rgba(0, 0, 0, 0.5));
    transition: transform 0.3s ease;
}

/* --------------------------------------------------------------------------
   Configurations Multi-Positions Dynamiques (Bureau / Tablettes larges)
   -------------------------------------------------------------------------- */

/* 1. Position : Bas-Droite (bottom-right) */
.maca-wrapper.pos-bottom-right {
    justify-content: flex-end;
    align-items: flex-end;
    padding: 0 3rem 0 0;
}
.maca-wrapper.pos-bottom-right .maca-stage {
    flex-direction: row;
    align-items: flex-end;
    gap: 0;
}
.maca-wrapper.pos-bottom-right .maca-bubble {
    margin-bottom: 3.5rem;
    margin-right: -40px;
    z-index: 3;
}
.maca-wrapper.pos-bottom-right .maca-bubble::after {
    bottom: 50px;
    right: -12px;
    border-top: 10px solid transparent;
    border-bottom: 10px solid transparent;
    border-left: 12px solid var(--surface-color, #1e293b);
    filter: drop-shadow(2px 0 0 var(--border-color, #334155));
}
.maca-wrapper.pos-bottom-right .maca-creature {
    transform: translate3d(0, 115%, 0) rotate(5deg);
}
.maca-wrapper.pos-bottom-right.visible .maca-creature,
.maca-wrapper.pos-bottom-right .maca-stage.visible .maca-creature {
    transform: translate3d(0, 0, 0) rotate(0deg);
}

/* 2. Position : Bas-Gauche (bottom-left) */
.maca-wrapper.pos-bottom-left {
    justify-content: flex-start;
    align-items: flex-end;
    padding: 0 0 0 3rem;
}
.maca-wrapper.pos-bottom-left .maca-stage {
    flex-direction: row-reverse;
    align-items: flex-end;
    gap: 0;
}
.maca-wrapper.pos-bottom-left .maca-bubble {
    margin-bottom: 3.5rem;
    margin-left: -40px;
    z-index: 3;
}
.maca-wrapper.pos-bottom-left .maca-bubble::after {
    bottom: 50px;
    left: -12px;
    border-top: 10px solid transparent;
    border-bottom: 10px solid transparent;
    border-right: 12px solid var(--surface-color, #1e293b);
    border-left: none;
    filter: drop-shadow(-2px 0 0 var(--border-color, #334155));
}
.maca-wrapper.pos-bottom-left .maca-creature {
    transform: translate3d(0, 115%, 0) rotate(-5deg) scaleX(-1);
}
.maca-wrapper.pos-bottom-left.visible .maca-creature,
.maca-wrapper.pos-bottom-left .maca-stage.visible .maca-creature {
    transform: translate3d(0, 0, 0) rotate(0deg) scaleX(-1);
}

/* 3. Position : Flanc Droit (edge-right) */
.maca-wrapper.pos-edge-right {
    justify-content: flex-end;
    align-items: center;
    padding: 0 0 0 2rem;
}
.maca-wrapper.pos-edge-right .maca-stage {
    flex-direction: row;
    align-items: center;
    gap: 0;
}
.maca-wrapper.pos-edge-right .maca-bubble {
    margin-bottom: 0;
    margin-right: -50px;
    z-index: 3;
}
.maca-wrapper.pos-edge-right .maca-bubble::after {
    top: 50%;
    transform: translateY(-50%);
    right: -12px;
    border-top: 10px solid transparent;
    border-bottom: 10px solid transparent;
    border-left: 12px solid var(--surface-color, #1e293b);
    filter: drop-shadow(2px 0 0 var(--border-color, #334155));
}
.maca-wrapper.pos-edge-right .maca-creature {
    transform: translate3d(115%, 0, 0);
}
.maca-wrapper.pos-edge-right.visible .maca-creature,
.maca-wrapper.pos-edge-right .maca-stage.visible .maca-creature {
    transform: translate3d(0, 0, 0);
}

/* 4. Position : Flanc Gauche (edge-left) */
.maca-wrapper.pos-edge-left {
    justify-content: flex-start;
    align-items: center;
    padding: 0 2rem 0 0;
}
.maca-wrapper.pos-edge-left .maca-stage {
    flex-direction: row-reverse;
    align-items: center;
    gap: 0;
}
.maca-wrapper.pos-edge-left .maca-bubble {
    margin-bottom: 0;
    margin-left: -50px;
    z-index: 3;
}
.maca-wrapper.pos-edge-left .maca-bubble::after {
    top: 50%;
    transform: translateY(-50%);
    left: -12px;
    border-top: 10px solid transparent;
    border-bottom: 10px solid transparent;
    border-right: 12px solid var(--surface-color, #1e293b);
    border-left: none;
    filter: drop-shadow(-2px 0 0 var(--border-color, #334155));
}
.maca-wrapper.pos-edge-left .maca-creature {
    transform: translate3d(-115%, 0, 0) scaleX(-1);
}
.maca-wrapper.pos-edge-left.visible .maca-creature,
.maca-wrapper.pos-edge-left .maca-stage.visible .maca-creature {
    transform: translate3d(0, 0, 0) scaleX(-1);
}

/* --------------------------------------------------------------------------
   Bulle de Dialogue Stylée & Interactive
   -------------------------------------------------------------------------- */
.maca-bubble {
    position: relative;
    background: var(--surface-color, #ffffff);
    color: var(--text-primary, #0f172a);
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 20px;
    padding: 1.6rem 1.75rem;
    max-width: 440px;
    width: 100%;
    box-shadow: 0 20px 45px -10px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.05);
    transform: scale(0.9) translateY(15px);
    opacity: 0;
    transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1) 0.1s, opacity 0.4s ease 0.1s;
    display: flex;
    flex-direction: column;
    gap: 1.15rem;
    box-sizing: border-box;
}

[data-theme="dark"] .maca-bubble {
    background: var(--surface-color, #1e293b);
    color: var(--text-primary, #f8fafc);
    border-color: var(--border-color, #334155);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.maca-stage.visible .maca-bubble {
    transform: scale(1) translateY(0);
    opacity: 1;
}

.maca-bubble::after {
    content: "";
    position: absolute;
    width: 0;
    height: 0;
}

/* En-tête de la bulle */
.maca-bubble-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.maca-name-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.78rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    background: rgba(245, 158, 11, 0.16);
    color: #f59e0b;
    border: 1px solid rgba(245, 158, 11, 0.35);
    padding: 0.25rem 0.65rem;
    border-radius: 999px;
}

.maca-badge-avatar {
    width: 22px;
    height: 22px;
    object-fit: contain;
    border-radius: 50%;
}

.maca-close-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary, #64748b);
    cursor: pointer;
    padding: 0.35rem;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.15s, background 0.15s;
}

.maca-close-btn:hover {
    color: var(--text-primary, #0f172a);
    background: rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] .maca-close-btn {
    color: var(--text-secondary, #94a3b8);
}

[data-theme="dark"] .maca-close-btn:hover {
    color: var(--text-primary, #f8fafc);
    background: rgba(255, 255, 255, 0.08);
}

.maca-bubble-body {
    font-size: 0.95rem;
    line-height: 1.55;
    color: var(--text-primary, #f8fafc);
}

.maca-bubble-body p {
    margin: 0 0 0.5rem 0;
}
.maca-bubble-body p:last-child {
    margin-bottom: 0;
}

/* --------------------------------------------------------------------------
   Étape 1 : Grille de Sélection des Langues de l'Interface
   -------------------------------------------------------------------------- */
.maca-lang-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.65rem;
    margin-top: 0.5rem;
}

.maca-lang-choice-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 0.8rem 1rem;
    border-radius: 12px;
    background: var(--bg-color, #f8fafc);
    border: 1px solid var(--border-color, #e2e8f0);
    color: var(--text-primary, #0f172a);
    cursor: pointer;
    font-size: 0.96rem;
    font-weight: 600;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

[data-theme="dark"] .maca-lang-choice-btn {
    background: rgba(255, 255, 255, 0.04);
    border-color: var(--border-color, #334155);
    color: var(--text-primary, #f8fafc);
}

.maca-lang-choice-btn:hover {
    border-color: rgba(99, 102, 241, 0.5);
    background: rgba(99, 102, 241, 0.08);
    transform: translateY(-1px);
}

.maca-lang-choice-btn.active {
    border-color: var(--primary-color, #6366f1);
    background: rgba(99, 102, 241, 0.15);
    color: var(--primary-color, #6366f1);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.3);
}

[data-theme="dark"] .maca-lang-choice-btn.active {
    background: rgba(99, 102, 241, 0.25);
    color: #ffffff;
}

/* --------------------------------------------------------------------------
   Étape 2 : Sélecteurs de Langue Stylisés (Custom Dropdowns Glassmorphism)
   -------------------------------------------------------------------------- */
.maca-custom-picker-container {
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
    margin-top: 0.75rem;
}

.maca-dropdown-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    background: var(--bg-color, #f8fafc);
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 14px;
    padding: 0.65rem 1rem;
    transition: all 0.2s ease;
    position: relative;
}

[data-theme="dark"] .maca-dropdown-wrapper {
    background: rgba(15, 23, 42, 0.55);
    border-color: var(--border-color, #334155);
}

.maca-dropdown-wrapper:hover {
    border-color: rgba(99, 102, 241, 0.5);
}

.maca-dropdown-wrapper.open {
    border-color: var(--primary-color, #6366f1);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.25);
    z-index: 50;
}

.maca-dropdown-label {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-secondary, #64748b);
    flex-shrink: 0;
}

[data-theme="dark"] .maca-dropdown-label {
    color: var(--text-secondary, #94a3b8);
}

.maca-dropdown-trigger {
    background: transparent;
    border: none;
    color: var(--text-primary, #0f172a);
    font-family: var(--font-sans);
    font-size: 0.95rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    cursor: pointer;
    padding: 0.2rem 0;
    outline: none;
}

[data-theme="dark"] .maca-dropdown-trigger {
    color: var(--text-primary, #f8fafc);
}

.maca-dropdown-chevron {
    color: var(--text-secondary, #64748b);
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

[data-theme="dark"] .maca-dropdown-chevron {
    color: var(--text-secondary, #94a3b8);
}

.maca-dropdown-wrapper.open .maca-dropdown-chevron {
    transform: rotate(180deg);
}

.maca-dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 190px;
    background: var(--surface-color, #ffffff);
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 12px;
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.12), 0 0 0 1px rgba(0, 0, 0, 0.05);
    padding: 0.4rem;
    display: none;
    flex-direction: column;
    gap: 0.25rem;
    z-index: 100;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}

[data-theme="dark"] .maca-dropdown-menu {
    background: #1e293b;
    border: 1px solid #475569;
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.maca-dropdown-wrapper.open .maca-dropdown-menu {
    display: flex;
    animation: macaMenuAppear 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes macaMenuAppear {
    from { opacity: 0; transform: translateY(-6px) scale(0.96); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.maca-dropdown-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.6rem 0.85rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary, #0f172a);
    transition: background 0.15s, color 0.15s;
}

[data-theme="dark"] .maca-dropdown-item {
    color: var(--text-primary, #f8fafc);
}

.maca-dropdown-item:hover {
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary-color, #3b82f6);
}

[data-theme="dark"] .maca-dropdown-item:hover {
    background: rgba(99, 102, 241, 0.2);
    color: #ffffff;
}

.maca-dropdown-item.active {
    background: var(--primary-color, #6366f1);
    color: #ffffff;
    font-weight: 700;
}

.maca-item-left {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

/* --------------------------------------------------------------------------
   Actions et boutons du dialogue
   -------------------------------------------------------------------------- */
.maca-bubble-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 0.25rem;
    flex-wrap: wrap;
}

.maca-btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: #0f172a;
    font-weight: 800;
    font-size: 0.95rem;
    padding: 0.7rem 1.4rem;
    border-radius: 12px;
    border: none;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.15s, box-shadow 0.2s;
    box-shadow: 0 4px 14px rgba(245, 158, 11, 0.35);
}

.maca-btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(245, 158, 11, 0.45);
}

.maca-btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: transparent;
    color: var(--text-secondary, #64748b);
    font-weight: 600;
    font-size: 0.9rem;
    padding: 0.65rem 1rem;
    border-radius: 10px;
    border: 1px solid var(--border-color, #e2e8f0);
    cursor: pointer;
    transition: color 0.2s, border-color 0.2s, background-color 0.2s;
}

.maca-btn-secondary:hover {
    color: var(--text-primary, #0f172a);
    border-color: var(--primary-color, #3b82f6);
    background: rgba(99, 102, 241, 0.08);
}

[data-theme="dark"] .maca-btn-secondary {
    color: var(--text-secondary, #94a3b8);
    border-color: var(--border-color, #334155);
}

[data-theme="dark"] .maca-btn-secondary:hover {
    color: var(--text-primary, #f8fafc);
    border-color: rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.05);
}

/* --------------------------------------------------------------------------
   Adaptation Mobile (< 768px) : Surgissement Standardisé & Confortable
   -------------------------------------------------------------------------- */
@media (max-width: 768px) {
    .maca-wrapper {
        justify-content: center !important;
        align-items: center !important;
        padding: 1rem !important;
        padding-top: max(env(safe-area-inset-top, 0.75rem), 0.75rem) !important;
        padding-bottom: max(env(safe-area-inset-bottom, 0.75rem), 0.75rem) !important;
        height: 100% !important;
        height: 100dvh !important;
    }

    .maca-stage {
        flex-direction: column !important;
        align-items: center !important;
        gap: 0 !important;
        width: 100% !important;
        max-width: 410px !important;
    }

    .maca-mascot-img {
        height: 96px !important;
        max-width: 96px !important;
        margin-bottom: -16px !important;
        z-index: 1 !important;
    }

    .maca-creature {
        transform: translate3d(0, -25px, 0) scale(0.85) !important;
        opacity: 0 !important;
        transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
    }

    .maca-stage.visible .maca-creature {
        transform: translate3d(0, 0, 0) scale(1) !important;
        opacity: 1 !important;
    }

    .maca-bubble {
        margin: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        padding: 1.15rem 1.25rem !important;
        border-radius: 18px !important;
        max-height: calc(100dvh - 125px) !important;
        display: flex !important;
        flex-direction: column !important;
        gap: 0.85rem !important;
        z-index: 2 !important;
        box-sizing: border-box !important;
        overflow: visible !important;
    }

    .maca-bubble-body {
        overflow-y: auto !important;
        overscroll-behavior: contain !important;
        flex: 1 1 auto !important;
        -webkit-overflow-scrolling: touch !important;
        max-height: calc(100dvh - 240px) !important;
    }

    .maca-bubble-actions {
        flex-shrink: 0 !important;
        margin-top: 0.35rem !important;
        padding-top: 0.25rem !important;
        width: 100% !important;
    }

    .maca-btn-primary {
        width: 100% !important;
        justify-content: center !important;
        padding: 0.75rem 1rem !important;
    }

    .maca-btn-secondary {
        width: 100% !important;
        justify-content: center !important;
        padding: 0.65rem 1rem !important;
    }

    .maca-bubble::after {
        top: -8px !important;
        bottom: auto !important;
        left: 50% !important;
        right: auto !important;
        transform: translateX(-50%) !important;
        border-left: 9px solid transparent !important;
        border-right: 9px solid transparent !important;
        border-bottom: 9px solid var(--surface-color, #1e293b) !important;
        border-top: none !important;
        filter: drop-shadow(0 -2px 0 var(--border-color, #334155)) !important;
    }

    .maca-dropdown-menu {
        left: 0 !important;
        right: 0 !important;
        min-width: unset !important;
    }
}

/* --------------------------------------------------------------------------
   Styles d'Administration / Config (Message DB & Paliers)
   -------------------------------------------------------------------------- */
.maca-config-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.85rem 1.15rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    transition: all 0.2s ease;
}

.maca-config-item:hover {
    border-color: rgba(99, 102, 241, 0.4);
    background: rgba(99, 102, 241, 0.04);
}

.maca-config-item-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    flex: 1;
    min-width: 0;
}

.maca-config-item-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.maca-config-item-desc {
    font-size: 0.82rem;
    color: var(--text-secondary);
    line-height: 1.4;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.maca-config-badge {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 0.2rem 0.5rem;
    border-radius: 9999px;
    background: rgba(99, 102, 241, 0.15);
    color: #818cf8;
    border: 1px solid rgba(99, 102, 241, 0.3);
}

.maca-config-badge.badge-metric {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
    border-color: rgba(16, 185, 129, 0.3);
}

.maca-config-actions {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-shrink: 0;
}

.maca-action-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s ease;
}

.maca-action-icon-btn:hover {
    color: var(--text-primary);
    border-color: var(--primary-color);
    background: rgba(99, 102, 241, 0.1);
}

.maca-action-icon-btn.btn-delete:hover {
    color: #ef4444;
    border-color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
}

/* Modale d'édition Maca (Overlay & Card) */
.maca-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(10, 15, 25, 0.82);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10050;
    padding: 1.25rem;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s, visibility 0.25s;
}

.maca-modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.maca-modal-card {
    background: var(--surface-color, #1e293b);
    border: 1px solid var(--border-color, #334155);
    border-radius: 16px;
    padding: 1.75rem 2rem;
    max-width: 520px;
    width: 100%;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.6);
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    transform: scale(0.95);
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.maca-modal-overlay.active .maca-modal-card {
    transform: scale(1);
}

/* --------------------------------------------------------------------------
   Mode Contraint : Premier Drill Obligatoire (5 mots A1)
   -------------------------------------------------------------------------- */
body.maca-first-drill-frozen .app-header .nav-btn:not(#nav-home),
body.maca-first-drill-frozen #options-btn,
body.maca-first-drill-frozen #auth-btn,
body.maca-first-drill-frozen .custom-lang-selector,
body.maca-first-drill-frozen #menu-toggle,
body.maca-first-drill-frozen #home-lang-indicator {
    pointer-events: none !important;
    opacity: 0.28 !important;
    filter: grayscale(0.6);
    cursor: not-allowed !important;
    transition: opacity 0.3s ease;
}

body.maca-first-drill-frozen .triptych-arrow-btn {
    display: none !important;
}

body.maca-first-drill-frozen #cefr-donut-svg {
    pointer-events: none !important;
    cursor: not-allowed !important;
}

body.maca-first-drill-frozen .cool-slider-wrapper,
body.maca-first-drill-frozen .slider-step-ticks {
    pointer-events: none !important;
    opacity: 0.35 !important;
    cursor: not-allowed !important;
}

/* Surbrillance et pulsation du bouton Drill */
#btn-start-session.maca-drill-constrained-pulse {
    position: relative;
    margin-top: 1.75rem !important;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 50%, #1d4ed8 100%) !important;
    border: 2px solid #93c5fd !important;
    box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.75), 0 6px 20px rgba(37, 99, 235, 0.45) !important;
    animation: macaDrillPulseGlow 1.8s infinite cubic-bezier(0.4, 0, 0.6, 1) !important;
    transform-origin: center;
}

@keyframes macaDrillPulseGlow {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.8), 0 4px 15px rgba(37, 99, 235, 0.4);
    }
    50% {
        transform: scale(1.025);
        box-shadow: 0 0 0 14px rgba(59, 130, 246, 0), 0 8px 28px rgba(37, 99, 235, 0.65);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(59, 130, 246, 0), 0 4px 15px rgba(37, 99, 235, 0.4);
    }
}

.maca-first-drill-guide-banner {
    display: none !important;
}

.maca-banner-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    border: 1.5px solid #60a5fa;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}

/* Girafe Maca assise sur le bouton Drill! */
.maca-btn-start-mascot {
    position: absolute;
    bottom: calc(100% - 10px);
    left: 50%;
    transform: translateX(-50%);
    width: 54px;
    pointer-events: none;
    z-index: 15;
    filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.45));
    animation: macaSittingBounce 2.2s ease-in-out infinite;
}

.maca-btn-start-mascot img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: contain;
}

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

/* ==========================================================================
   Maca Promenade sur Rebord (Ledge Walker Demo)
   ========================================================================== */
.about-card.has-maca-walker {
    position: relative;
}

.maca-walker-track {
    position: absolute;
    top: -53px;
    left: 0;
    width: 100%;
    height: 56px;
    pointer-events: none;
    overflow: visible;
    z-index: 20;
}

/* Arbre Acacia stylisé Disney/Pixar sur le rebord */
.maca-tree {
    position: absolute;
    bottom: -1px;
    left: 0;
    right: auto;
    width: 104px;
    height: 84px;
    z-index: 15;
    pointer-events: auto;
    cursor: pointer;
    user-select: none;
    transform-origin: 50% 100%;
}

/* Animation d'apparition bondissante / repousse magique de l'acacia */
.maca-tree.tree-sprout {
    animation: treeSprout 0.75s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes treeSprout {
    0% {
        transform: scale(0) translateY(14px);
        opacity: 0;
    }
    55% {
        transform: scale(1.16) translateY(-4px);
        opacity: 1;
    }
    80% {
        transform: scale(0.93) translateY(1px);
    }
    100% {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

/* Disparition douce après dégustation */
.maca-tree.is-relocating {
    opacity: 0 !important;
    transform: scale(0.1) translateY(12px) !important;
    transition: transform 0.45s cubic-bezier(0.4, 0, 0.8, 1), opacity 0.4s ease-in !important;
    pointer-events: none;
}

.maca-tree-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.22));
    transform-origin: 50% 90%;
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.maca-tree:hover .maca-tree-img {
    transform: scale(1.04) translateY(-2px);
}

.maca-tree.is-being-munched .maca-tree-img {
    animation: treeRustle 0.42s ease-in-out infinite alternate;
}

.maca-tree.tree-rustle-tap .maca-tree-img {
    animation: treeRustleTap 0.65s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes treeRustle {
    0% {
        transform: rotate(0deg) scale(1);
    }
    50% {
        transform: rotate(2deg) scaleY(0.985) scaleX(1.015);
    }
    100% {
        transform: rotate(-1.6deg) scaleY(1.015) scaleX(0.985);
    }
}

@keyframes treeRustleTap {
    0% { transform: rotate(0deg) scale(1); }
    25% { transform: rotate(-3.5deg) scale(1.05); }
    50% { transform: rotate(3deg) scale(1.03); }
    75% { transform: rotate(-1.5deg) scale(1.01); }
    100% { transform: rotate(0deg) scale(1); }
}

.maca-walker {
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 48px;
    height: 62px;
    pointer-events: auto;
    cursor: pointer;
    user-select: none;
    will-change: transform;
    z-index: 20;
    transform: translate3d(20px, 0, 0);
}

.maca-walker-body {
    width: 100%;
    height: 100%;
    transform-origin: bottom center;
    transition: transform 0.15s ease-out;
}

.maca-walker-body.facing-left {
    transform: scaleX(-1);
}

.maca-walker-body.facing-right {
    transform: scaleX(1);
}

.maca-walker-body.is-turning-to-left {
    animation: macaHopTurnToLeft 0.75s cubic-bezier(0.34, 1.3, 0.64, 1) forwards;
}

.maca-walker-body.is-turning-to-right {
    animation: macaHopTurnToRight 0.75s cubic-bezier(0.34, 1.3, 0.64, 1) forwards;
}

.maca-walker-body.maca-jump {
    animation: macaJumpTap 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
}

.maca-walker-chew {
    width: 100%;
    height: 100%;
    transform-origin: 40% 90%;
    animation: macaChewCycle 0.95s ease-in-out infinite alternate;
}

.maca-walker:hover .maca-walker-chew {
    animation: macaChewCycle 0.95s ease-in-out infinite alternate;
}

.maca-walker-sprite {
    width: 48px;
    height: 62px;
    background-image: url('../assets/icons/maca-walk-cycle.png?v=312');
    background-repeat: no-repeat;
    background-size: 192px 62px;
    background-position: 0 0;
    display: block;
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.22));
}

/* Le trot régulier et calme (0.85s) s'active UNIQUEMENT quand elle marche */
.maca-walker.is-walking .maca-walker-sprite {
    animation: macaLegsTrot 0.85s steps(4) infinite;
}

/* À l'arrêt ou en pause, les pattes restent fermement posées sur la pose 1 */
.maca-walker:not(.is-walking) .maca-walker-sprite {
    animation: none;
    background-position: 0 0;
}

@keyframes macaLegsTrot {
    from {
        background-position: 0 0;
    }
    to {
        background-position: -192px 0;
    }
}

/* Demi-tour classe : petit saut joyeux avec impulsion, bascule en l'air et amorti au sol */
@keyframes macaHopTurnToLeft {
    0% {
        transform: scaleX(1) translateY(0) scaleY(1);
    }
    18% {
        transform: scaleX(1) translateY(2.5px) scaleY(0.91) scaleX(1.06);
    }
    46% {
        transform: scaleX(0.7) translateY(-15px) rotate(-8deg) scaleY(1.08);
    }
    54% {
        transform: scaleX(-0.7) translateY(-15px) rotate(6deg) scaleY(1.08);
    }
    82% {
        transform: scaleX(-1) translateY(0) scaleY(0.91) scaleX(1.06);
    }
    100% {
        transform: scaleX(-1) translateY(0) scaleY(1) scaleX(1);
    }
}

@keyframes macaHopTurnToRight {
    0% {
        transform: scaleX(-1) translateY(0) scaleY(1);
    }
    18% {
        transform: scaleX(-1) translateY(2.5px) scaleY(0.91) scaleX(1.06);
    }
    46% {
        transform: scaleX(-0.7) translateY(-15px) rotate(8deg) scaleY(1.08);
    }
    54% {
        transform: scaleX(0.7) translateY(-15px) rotate(-6deg) scaleY(1.08);
    }
    82% {
        transform: scaleX(1) translateY(0) scaleY(0.91) scaleX(1.06);
    }
    100% {
        transform: scaleX(1) translateY(0) scaleY(1) scaleX(1);
    }
}

.maca-walker-bubble {
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%) translateY(4px) scale(0.9);
    background: var(--surface-color, #ffffff);
    color: var(--text-primary, #0f172a);
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 12px;
    padding: 0.3rem 0.65rem;
    font-size: 0.75rem;
    font-weight: 700;
    white-space: nowrap;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1), transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 25;
}

[data-theme="dark"] .maca-walker-bubble {
    background: #1e293b;
    border-color: #334155;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.45);
}

.maca-walker-bubble::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border-width: 5px;
    border-style: solid;
    border-color: var(--surface-color, #ffffff) transparent transparent transparent;
}

[data-theme="dark"] .maca-walker-bubble::after {
    border-color: #1e293b transparent transparent transparent;
}

.maca-walker:hover .maca-walker-bubble,
.maca-walker.active .maca-walker-bubble {
    opacity: 1;
    transform: translateX(-50%) translateY(0) scale(1);
}

@keyframes macaChewCycle {
    0% {
        transform: rotate(0deg) scaleY(1) scaleX(1);
    }
    50% {
        transform: rotate(1.8deg) scaleY(0.97) scaleX(1.02);
    }
    100% {
        transform: rotate(-1.2deg) scaleY(1.015) scaleX(0.985);
    }
}

/* Pause dégustation sous les branches de l'acacia (Cycle de 4 images dédiées) */
.maca-walker.is-feeding .maca-walker-sprite {
    background-image: url('../assets/icons/maca-eating-cycle.png') !important;
    animation: macaEatingSequence 4.2s steps(1) forwards !important;
}

@keyframes macaEatingSequence {
    0% {
        background-position: 0 0; /* Frame 0: Cou tendu vers la cime, bouche ouverte */
    }
    20% {
        background-position: -48px 0; /* Frame 1: Attrape la branche de feuilles */
    }
    45% {
        background-position: -96px 0; /* Frame 2: Mâche goulûment les yeux fermés */
    }
    76% {
        background-position: -144px 0; /* Frame 3: Se lèche les babines de satisfaction */
    }
}

.maca-walker.is-feeding .maca-walker-chew {
    animation: macaChewMouth 0.45s ease-in-out infinite alternate;
}

@keyframes macaChewMouth {
    0% {
        transform: translateY(0) scaleY(1);
    }
    50% {
        transform: translateY(-2px) scaleY(1.02);
    }
    100% {
        transform: translateY(0) scaleY(0.99);
    }
}

.maca-walker.maca-jump {
    animation: macaJumpTap 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
}

@keyframes macaJumpTap {
    0% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-16px) scale(1.1); }
    100% { transform: translateY(0) scale(1); }
}

@media (max-width: 768px) {
    .maca-walker-track {
        top: -48px;
        height: 52px;
    }
    .maca-tree {
        right: auto;
        width: 80px;
        height: 64px;
    }
    .maca-walker {
        width: 40px;
        height: 52px;
    }
    .maca-walker-sprite {
        width: 40px;
        height: 52px;
        background-size: 160px 52px;
    }
    .maca-walker.is-walking .maca-walker-sprite {
        animation: macaLegsTrotMobile 0.85s steps(4) infinite;
    }
    .maca-walker.is-feeding .maca-walker-sprite {
        animation: macaEatingSequenceMobile 4.2s steps(1) forwards !important;
    }
    @keyframes macaLegsTrotMobile {
        from { background-position: 0 0; }
        to { background-position: -160px 0; }
    }
    @keyframes macaEatingSequenceMobile {
        0% { background-position: 0 0; }
        20% { background-position: -40px 0; }
        45% { background-position: -80px 0; }
        76% { background-position: -120px 0; }
    }
}

@media (prefers-reduced-motion: reduce) {
    .maca-walker {
        animation: none !important;
        left: 20px !important;
    }
    .maca-walker-chew,
    .maca-walker-sprite {
        animation: none !important;
    }
}





