/* ============================================================
   DESIGN SYSTEM — Arbre de Vie 2084
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400;700&family=Inter:wght@300;400;600&display=swap');

:root {
    --bg-deep: #020509;
    --energy: #00e5ff;
    --energy-rgb: 0, 229, 255;
    --curious: #9c88ff;
    --curious-rgb: 156, 136, 255;
    --hope: #4cd137;
    --fear: #e84118;
    --tech: #00a8ff;
    --glass: rgba(10, 20, 38, 0.75);
    --glass-border: rgba(255, 255, 255, 0.1);
    --border: rgba(0, 229, 255, 0.3);
    --border-purple: rgba(156, 136, 255, 0.4);
    --nav-h: 74px;
    --radius: 20px;
    --font-heading: 'Cinzel', serif;
    --font-body: 'Inter', system-ui, sans-serif;
    --glow-shadow: 0 0 20px rgba(0, 229, 255, 0.3);
}

/* ============================================================
   BASE
   ============================================================ */
*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    padding-top: env(safe-area-inset-top);
    padding-right: env(safe-area-inset-right);
    padding-bottom: env(safe-area-inset-bottom);
    padding-left: env(safe-area-inset-left);
    font-family: var(--font-body);
    background: var(--bg-deep);
    color: #d5dde8;
    overflow: hidden;
    height: 100vh;
    position: relative;
}

/* Background Living Effect */
body::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 50% 100%, #0d1a2e 0%, var(--bg-deep) 80%);
    z-index: -1;
}

body::after {
    content: '';
    position: absolute;
    inset: 0;
    background: url("data:image/svg+xml,%3Csvg viewBox='0 0 400 400' xmlns='http://www.w3.org/2000/svg'%3%3Cfilter id='noiseFilter'%3%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3%3C/filter%3%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3%3C/svg%3");
    opacity: 0.03;
    mix-blend-mode: overlay;
    pointer-events: none;
    z-index: -1;
    animation: grain 8s steps(10) infinite;
}

@keyframes grain {

    0%,
    100% {
        transform: translate(0, 0);
    }

    10% {
        transform: translate(-5%, -10%);
    }

    20% {
        transform: translate(-15%, 5%);
    }

    30% {
        transform: translate(7%, -25%);
    }

    40% {
        transform: translate(-5%, 25%);
    }

    50% {
        transform: translate(-15%, 10%);
    }

    60% {
        transform: translate(15%, 0%);
    }

    70% {
        transform: translate(0%, 15%);
    }

    80% {
        transform: translate(3%, 35%);
    }

    90% {
        transform: translate(-10%, 10%);
    }
}

/* ============================================================
   BARRE DE NAVIGATION FIXE (pleine largeur en haut)
   ============================================================ */
#navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--nav-h);
    z-index: 1000;

    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    gap: 12px;

    background: linear-gradient(180deg, rgba(4, 8, 16, 0.92) 0%, rgba(4, 8, 16, 0) 100%);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
}

#menu-toggle {
    display: none;
    background: transparent;
    border: none;
    color: var(--energy);
    font-size: 1.5rem;
    cursor: pointer;
    z-index: 1100;
}


/* Logo / Contributeur — à gauche */
#intro-trigger {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(142, 68, 173, 0.22);
    border: 1px solid var(--border-purple);
    color: #d9ccff;
    padding: 8px 18px;
    border-radius: 30px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.85rem;
    letter-spacing: 0.03em;
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    transition: all 0.25s;
    flex-shrink: 0;
}

#intro-trigger:hover {
    background: rgba(var(--curious-rgb), 0.45);
    border-color: #a29bfe;
    color: #fff;
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 10px 30px rgba(var(--curious-rgb), 0.5), 0 0 20px rgba(var(--curious-rgb), 0.3);
}

#intro-trigger:active {
    transform: translateY(-1px) scale(0.96);
}

/* Manifeste Button Styling */
#manifeste-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(253, 203, 110, 0.15);
    border: 1px solid rgba(253, 203, 110, 0.3);
    color: #fdcb6e;
    padding: 8px 14px;
    border-radius: 30px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.82rem;
    font-family: 'Inter', sans-serif;
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    flex-shrink: 0;
}

#manifeste-btn:hover {
    background: rgba(253, 203, 110, 0.3);
    border-color: #ffeaa7;
    color: #fff;
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 8px 25px rgba(253, 203, 110, 0.4), 0 0 15px rgba(253, 203, 110, 0.2);
}

#manifeste-btn:active {
    transform: translateY(-1px) scale(0.98);
}

/* Auth / Guardian Button Styling */
#auth-login-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(0, 229, 255, 0.15);
    border: 1px solid rgba(0, 229, 255, 0.3);
    color: #00e5ff;
    padding: 8px 14px;
    border-radius: 30px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.82rem;
    font-family: 'Inter', sans-serif;
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    flex-shrink: 0;
}

#auth-login-btn:hover {
    background: rgba(var(--energy-rgb), 0.3);
    border-color: #81ecec;
    color: #fff;
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 8px 25px rgba(var(--energy-rgb), 0.5), 0 0 15px rgba(var(--energy-rgb), 0.2);
}

#auth-login-btn:active {
    transform: translateY(-1px) scale(0.98);
}

/* Governance Button Styling */
#visions-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(156, 136, 255, 0.15);
    border: 1px solid rgba(156, 136, 255, 0.3);
    color: var(--curious);
    padding: 8px 14px;
    border-radius: 30px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.82rem;
    font-family: 'Inter', sans-serif;
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    flex-shrink: 0;
}

#visions-btn:hover {
    background: rgba(var(--curious-rgb), 0.3);
    border-color: #a29bfe;
    color: #fff;
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 8px 25px rgba(var(--curious-rgb), 0.4), 0 0 15px rgba(var(--curious-rgb), 0.2);
}

#governance-btn:hover {
    background: rgba(255, 107, 107, 0.3);
    border-color: #ff9ff3;
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 107, 107, 0.4), 0 0 10px rgba(255, 107, 107, 0.2);
}

/* Filtres de l'Arbre — à droite */
#tree-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
}

.filter-btn {
    background: rgba(255, 255, 255, 0.04);
    color: #9bb3cc;
    border: 1px solid rgba(255, 255, 255, 0.08);
    padding: 7px 14px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.78rem;
    font-family: 'Inter', sans-serif;
    letter-spacing: 0.02em;
    transition: all 0.25s;
}

.filter-btn:hover {
    background: rgba(0, 229, 255, 0.08);
    border-color: var(--energy);
    color: var(--energy);
}

.filter-btn.active {
    background: var(--energy);
    color: #030a0e;
    border-color: var(--energy);
    font-weight: 600;
    box-shadow: 0 0 12px rgba(0, 229, 255, 0.4);
}

/* ============================================================
   TITRE PRINCIPAL — sous la navbar, superposé à la 3D
   ============================================================ */
#tree-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    pointer-events: none;
}

#tree-canvas h1 {
    position: absolute;
    top: calc(var(--nav-h) + 12px);
    left: 50%;
    transform: translateX(-50%);
    margin: 0;
    padding: 12px 32px;
    width: auto;
    max-width: 90%;
    text-align: center;
    font-family: var(--font-heading);
    font-size: clamp(1rem, 2.5vw, 1.8rem);
    /* Slightly smaller for Fix 9.6 */
    font-weight: 700;
    letter-spacing: 0.1em;
    color: #ffffff;
    text-shadow: 0 0 15px rgba(var(--energy-rgb), 0.8), 0 0 30px rgba(var(--energy-rgb), 0.3);
    pointer-events: none;
    z-index: 10000;
    /* Way above 3D labels */
    white-space: nowrap;
    background: rgba(4, 8, 16, 0.4);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    border-radius: 40px;
    border: 1px solid rgba(var(--energy-rgb), 0.2);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), inset 0 0 15px rgba(var(--energy-rgb), 0.05);
}

/* Container WebGL plein écran */
#webgl-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 1;
    overflow: hidden;
    pointer-events: auto;
    touch-action: none;
    /* Empêche le scroll natif mobile */
}

#webgl-container canvas {
    touch-action: none !important;
}

/* ============================================================
   CANOPÉE (feuilles HTML overlay)
   ============================================================ */
#canopy {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 5;
}

#loading-insights {
    position: absolute;
    top: 55%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: rgba(200, 220, 255, 0.4);
    font-size: 0.9rem;
    letter-spacing: 0.08em;
    font-style: italic;
    display: flex;
    align-items: center;
    gap: 10px;
}

#loading-insights::before {
    content: '';
    width: 16px;
    height: 16px;
    border: 2px solid rgba(0, 229, 255, 0.3);
    border-top-color: var(--energy);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ============================================================
   CHAT BUBBLE — "Parler à l'Arbre"
   ============================================================ */
#chat-trigger {
    position: fixed;
    bottom: 28px;
    right: 28px;
    background: linear-gradient(135deg, var(--curious) 0%, #7b6de0 100%);
    color: #fff;
    padding: 14px 22px;
    border-radius: 40px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    letter-spacing: 0.03em;
    box-shadow: 0 4px 24px rgba(156, 136, 255, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.1);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: 2000;
    display: flex;
    align-items: center;
    gap: 8px;
    animation: chat-pulse 3s ease-in-out infinite;
}

@keyframes chat-pulse {

    0%,
    100% {
        box-shadow: 0 4px 24px rgba(156, 136, 255, 0.5), 0 0 0 0 rgba(156, 136, 255, 0.4);
    }

    50% {
        box-shadow: 0 4px 32px rgba(156, 136, 255, 0.7), 0 0 0 12px rgba(156, 136, 255, 0);
    }
}

#chat-trigger::before {
    content: '💬';
    font-size: 1.1em;
}

#chat-trigger:hover {
    transform: translateY(-3px) scale(1.04);
    box-shadow: 0 8px 32px rgba(156, 136, 255, 0.6);
    animation: none;
}

/* ============================================================
   FENÊTRE DE CHAT
   ============================================================ */
#chat-window {
    position: fixed;
    bottom: 100px;
    right: 28px;
    width: 400px;
    height: auto;
    min-height: 200px;
    max-height: calc(100vh - 150px);
    background: var(--glass);
    border: 1px solid var(--border-purple);
    border-radius: var(--radius);
    display: none;
    flex-direction: column;
    box-shadow: 0 40px 100px rgba(0, 0, 0, 0.9), 0 0 0 1px rgba(var(--curious-rgb), 0.1), inset 0 0 30px rgba(var(--curious-rgb), 0.05);
    /* Fix 9.6: Ensure it stays on screen on short viewports */
    z-index: 5000;
    overflow: hidden;
    -webkit-backdrop-filter: blur(30px);
    backdrop-filter: blur(30px);
    transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    transform: translateY(20px) scale(0.95);
    opacity: 0;
}

#chat-window.active {
    display: flex;
    transform: translateY(0) scale(1);
    opacity: 1;
}

@media (max-width: 600px) {
    #chat-window {
        width: calc(100vw - 32px) !important;
        right: 16px !important;
        left: 16px !important;
        bottom: 80px !important;
        max-height: calc(100vh - 100px) !important;
        border-radius: 12px;
    }
}

/* VR Button intrusif - minimisation */
#VRButton {
    bottom: 10px !important;
    opacity: 0.1 !important;
    transform: scale(0.5) !important;
    transform-origin: bottom center !important;
    transition: opacity 0.3s !important;
    z-index: 999 !important;
}

#VRButton:hover {
    opacity: 1 !important;
}

/* Futuristic Scan-line overlay */
#chat-window::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.1) 50%), linear-gradient(90deg, rgba(255, 0, 0, 0.03), rgba(0, 255, 0, 0.01), rgba(0, 0, 255, 0.03));
    background-size: 100% 3px, 3px 100%;
    pointer-events: none;
    z-index: 10;
    opacity: 0.4;
}

.chat-header {
    background: linear-gradient(90deg, rgba(156, 136, 255, 0.16) 0%, rgba(0, 165, 255, 0.12) 100%);
    padding: 10px 16px;
    color: var(--curious);
    font-weight: 600;
    font-size: 0.92rem;
    letter-spacing: 0.04em;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-purple);
    z-index: 100;
}

.chat-header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.chat-model-select {
    background: rgba(0, 0, 0, 0.3);
    color: var(--curious);
    border: 1px solid var(--border-purple);
    border-radius: 8px;
    font-size: 0.7rem;
    padding: 2px 6px;
    outline: none;
    cursor: pointer;
    max-width: 140px;
    transition: all 0.2s;
}

.chat-model-select:hover {
    border-color: var(--energy);
    background: rgba(0, 0, 0, 0.5);
}

.chat-close-icon {
    color: rgba(255, 255, 255, 0.4);
    font-size: 1.2rem;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s, transform 0.2s;
}

.chat-close-icon:hover {
    color: var(--fear);
    transform: scale(1.1);
}

.chat-messages {
    flex: 1;
    padding: 14px;
    padding-bottom: 40px;
    /* Fix 9.7: extra space for last message */
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

@supports (scrollbar-width: thin) {
    .chat-messages {
        scrollbar-width: thin;
        scrollbar-color: rgba(156, 136, 255, 0.2) transparent;
    }
}

.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
    background-color: rgba(156, 136, 255, 0.2);
    border-radius: 10px;
}

.message {
    padding: 10px 14px;
    border-radius: 10px;
    max-width: 82%;
    font-size: 0.875rem;
    line-height: 1.5;
    word-wrap: break-word;
    animation: msg-enter 0.3s ease-out;
}

@keyframes msg-enter {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message.bot {
    background: rgba(30, 42, 60, 0.8);
    align-self: flex-start;
    color: #c9d8eb;
    border-left: 2px solid var(--curious);
    border-radius: 2px 10px 10px 10px;
}

.message.user {
    background: linear-gradient(135deg, #7b6de0, var(--curious));
    align-self: flex-end;
    color: #fff;
    border-radius: 10px 2px 10px 10px;
}

.chat-input-area {
    padding: 12px;
    background: rgba(0, 0, 0, 0.25);
    border-top: 1px solid var(--border);
    display: flex;
    gap: 8px;
    align-items: center;
}

.chat-input-area input {
    flex: 1;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(var(--energy-rgb), 0.2);
    border-radius: 10px;
    color: #fff;
    outline: none;
    padding: 12px 16px;
    font-size: 0.95rem;
    font-family: inherit;
    transition: all 0.3s;
}

.chat-input-area input:focus {
    border-color: var(--energy);
    background: rgba(0, 0, 0, 0.4);
    box-shadow: 0 0 15px rgba(var(--energy-rgb), 0.1);
}

.chat-input-area button {
    background: #00e5ff;
    color: #060c16;
    border: none;
    padding: 10px 18px;
    border-radius: 20px;
    cursor: pointer;
    font-weight: bold;
    font-family: inherit;
    transition: all 0.2s;
}

/* Chat Suggestions Overlay */
.chat-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 15px;
    margin-bottom: 15px;
    transition: opacity 0.3s ease;
}

.suggestion-chip {
    background: rgba(0, 229, 255, 0.1);
    border: 1px solid rgba(0, 229, 255, 0.3);
    color: #00e5ff;
    padding: 8px 14px;
    border-radius: 20px;
    font-size: 0.82rem;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: all 0.25s ease;
    -webkit-backdrop-filter: blur(5px);
    backdrop-filter: blur(5px);
    text-align: left;
}

.suggestion-chip:hover {
    background: rgba(0, 229, 255, 0.25);
    border-color: rgba(0, 229, 255, 0.6);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 229, 255, 0.15);
    color: #fff;
}

.chat-input-area button:hover {
    background: #7b6de0;
    transform: translateY(-1px);
}

/* Expand Vision Button in Chat */
.chat-expand-vision {
    display: block;
    margin-top: 10px;
    background: rgba(var(--energy-rgb), 0.2);
    border: 1px solid var(--energy);
    color: var(--energy);
    padding: 6px 12px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    width: fit-content;
}

.chat-expand-vision:hover {
    background: var(--energy);
    color: var(--bg-deep);
    transform: scale(1.05);
}

/* --- Phase 9.3 : STT --- */
.chat-stt-btn {
    background: rgba(var(--curious-rgb), 0.2) !important;
    border: 1px solid var(--border-purple) !important;
    color: var(--curious) !important;
    font-size: 1.2rem !important;
    padding: 8px !important;
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.chat-stt-btn.recording {
    background: var(--fear) !important;
    color: #fff !important;
    border-color: #fff !important;
    animation: stt-pulse 1.5s infinite;
}

@keyframes stt-pulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(232, 65, 24, 0.7);
    }

    70% {
        transform: scale(1.1);
        box-shadow: 0 0 0 10px rgba(232, 65, 24, 0);
    }

    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(232, 65, 24, 0);
    }
}

/* ============================================================
   BOUTON MUTE
   ============================================================ */
#mute-btn {
    position: fixed;
    bottom: 28px;
    left: 28px;
    z-index: 1000;
    background: var(--glass);
    border: 1px solid var(--border);
    color: #ecf0f1;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    cursor: pointer;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    transition: all 0.25s;
}

#mute-btn:hover {
    border-color: var(--energy);
    box-shadow: 0 0 12px rgba(0, 229, 255, 0.3);
    transform: scale(1.08);
}

/* ============================================================
   MODALES (READER / INTRO)
   ============================================================ */
.reader-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 3000;
    align-items: center;
    justify-content: center;
}

/* Hide broken avatar icon when src is empty */
#auth-user-avatar:not([src]),
#auth-user-avatar[src=""] {
    display: none !important;
}

#auth-user-avatar {
    display: none;
}

/* Tree Label fix for overlapping index texts */
.tree-label {
    background: var(--glass);
    border: 1px solid var(--border);
    color: #fff;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 0.8rem;
    font-family: var(--font-body);
    white-space: nowrap;
    pointer-events: auto;
    /* Allow clicks */
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    transition: all 0.3s ease;
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    opacity: 0.85;
}

.tree-label:hover {
    transform: scale(1.05);
    opacity: 1;
    border-color: var(--energy);
    box-shadow: 0 0 15px rgba(var(--energy-rgb), 0.4);
}

.reader-overlay.active {
    display: flex;
    -webkit-backdrop-filter: blur(10px) grayscale(30%);
    backdrop-filter: blur(10px) grayscale(30%);
}

.reader-modal {
    width: 95%;
    max-width: 720px;
    max-height: 85vh;
    background: linear-gradient(165deg, rgba(8, 15, 26, 0.96) 0%, rgba(4, 8, 15, 0.99) 100%);
    border: 1px solid var(--border);
    padding: 40px;
    border-radius: var(--radius);
    overflow-y: auto;
    box-shadow: 0 50px 120px rgba(0, 0, 0, 1.0), 0 0 0 1px rgba(var(--energy-rgb), 0.15), inset 0 0 40px rgba(var(--energy-rgb), 0.05);
    transform: translateY(40px) scale(0.96);
    transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    color: #c0cedd;
    -webkit-backdrop-filter: blur(30px);
    backdrop-filter: blur(30px);
}

@supports (scrollbar-width: thin) {
    .reader-modal {
        scrollbar-width: thin;
        scrollbar-color: rgba(0, 229, 255, 0.2) transparent;
    }
}

.reader-modal::-webkit-scrollbar {
    width: 6px;
}

.reader-modal::-webkit-scrollbar-track {
    background: transparent;
}

.reader-modal::-webkit-scrollbar-thumb {
    background-color: rgba(0, 229, 255, 0.2);
    border-radius: 10px;
}

.reader-overlay.active .reader-modal {
    transform: translateY(0);
}

.close-btn {
    float: right;
    cursor: pointer;
    font-size: 1.4rem;
    color: rgba(255, 255, 255, 0.3);
    line-height: 1;
    transition: color 0.2s;
}

.close-btn:hover {
    color: var(--energy);
}

.reader-content h2 {
    color: #fff;
    font-family: 'Cinzel', serif;
    font-size: 1.3rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 12px;
    margin-top: 0;
}

.reader-content p {
    line-height: 1.7;
}

/* --- THEME SELECTOR POUR LA MODALE PLANTER --- */
.theme-selector {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.theme-option {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #c0cedd;
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.85rem;
    font-family: var(--font-body);
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    -webkit-backdrop-filter: blur(5px);
    backdrop-filter: blur(5px);
}

.theme-option:hover {
    background: rgba(0, 229, 255, 0.1);
    border-color: rgba(0, 229, 255, 0.4);
    color: #fff;
    transform: translateY(-2px);
}

#wisdom-fruit-container {
    display: none;
    background: rgba(156, 136, 255, 0.1);
    border-left: 3px solid var(--energy);
    padding: 12px;
    margin-bottom: 18px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-style: italic;
    -webkit-backdrop-filter: blur(5px);
    backdrop-filter: blur(5px);
}

.theme-option.active {
    background: rgba(0, 229, 255, 0.2);
    border-color: var(--energy);
    color: #fff;
    box-shadow: 0 0 15px rgba(0, 229, 255, 0.4);
}

/* Intro Modal Specific Styles */
.intro-content {
    text-align: left;
}

.intro-content h2 {
    font-size: 1.5rem;
    margin-bottom: 20px;
    color: #9c88ff;
}

.intro-content p {
    margin-bottom: 15px;
    line-height: 1.6;
}

.intro-content .mission-text {
    margin-bottom: 20px;
}

.intro-content .mission-highlight {
    color: #4cd137;
}

.intro-content h3 {
    color: #ecf0f1;
    margin-bottom: 10px;
}

.intro-content h3.oracle-cta {
    color: #e84118;
}

.intro-content ul {
    margin-bottom: 20px;
    padding-left: 20px;
    line-height: 1.6;
}

.intro-content li {
    margin-bottom: 10px;
}

.intro-content blockquote {
    font-style: italic;
    border-left: 3px solid #9c88ff;
    padding-left: 15px;
    color: #bdc3c7;
    margin: 15px 0;
    font-size: 0.95em;
}

.intro-share {
    margin-top: 30px;
    padding-top: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    text-align: center;
}

.intro-share p {
    color: #ccc;
    font-size: 0.9em;
    margin-bottom: 10px;
}

.intro-share-link {
    color: #00a8ff;
    text-decoration: none;
    font-weight: bold;
    background: rgba(0, 168, 255, 0.1);
    padding: 8px 15px;
    border-radius: 20px;
    display: inline-block;
}

.source-tag {
    display: inline-block;
    background: rgba(255, 255, 255, 0.04);
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.75rem;
    margin-top: 20px;
    color: #6b7a90;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

/* Badges de type de noeud */
.node-type-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    margin-bottom: 12px;
}

.node-type-badge.root {
    background: rgba(255, 159, 67, 0.15);
    color: #ff9f43;
    border: 1px solid rgba(255, 159, 67, 0.3);
}

.anchored-badge {
    background: rgba(255, 215, 0, 0.2);
    color: #ffd700;
    border: 1px solid rgba(255, 215, 0, 0.4);
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.2);
    margin-left: 5px;
}

.hash-display {
    margin-top: 20px;
    padding: 10px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px dashed rgba(255, 215, 0, 0.3);
    border-radius: 8px;
    font-family: monospace;
    font-size: 0.75rem;
    color: rgba(255, 215, 0, 0.7);
}

/* REGISTRE IMMUABLE STYLES */
.ledger-intro {
    font-style: italic;
    color: #94a3b8;
    margin-bottom: 25px;
    font-size: 0.9rem;
    border-left: 2px solid #ff9f43;
    padding-left: 15px;
}

.ledger-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.ledger-entry {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 15px;
    transition: all 0.3s;
}

.ledger-entry:hover {
    background: rgba(255, 159, 67, 0.05);
    border-color: rgba(255, 159, 67, 0.3);
    transform: translateX(5px);
}

.ledger-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.ledger-title {
    font-weight: 700;
    color: #fff;
    font-size: 0.95rem;
}

.ledger-date {
    font-size: 0.75rem;
    color: #64748b;
}

.ledger-hash {
    font-family: monospace;
    font-size: 0.7rem;
    color: rgba(255, 215, 0, 0.5);
    word-break: break-all;
    margin-bottom: 12px;
}

.ledger-view-btn {
    background: transparent;
    border: 1px solid var(--energy);
    color: var(--energy);
    padding: 6px 12px;
    border-radius: 15px;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
}

.ledger-view-btn:hover {
    background: var(--energy);
    color: #000;
}

.node-type-badge.trunk {
    background: rgba(10, 189, 227, 0.15);
    color: #0abde3;
    border: 1px solid rgba(10, 189, 227, 0.3);
}

.node-type-badge.branch {
    background: rgba(29, 209, 161, 0.15);
    color: #1dd1a1;
    border: 1px solid rgba(29, 209, 161, 0.3);
}

.node-type-badge.leaf {
    background: rgba(156, 136, 255, 0.15);
    color: #9c88ff;
    border: 1px solid rgba(156, 136, 255, 0.3);
}

.node-type-badge.crown {
    background: rgba(243, 104, 224, 0.15);
    color: #f368e0;
    border: 1px solid rgba(243, 104, 224, 0.3);
}

/* intro overlay spécifique */
#intro-overlay {
    display: none;
}

#intro-overlay.active {
    display: flex;
}

.intro-modal h2 {
    color: var(--curious) !important;
}

.text-white {
    color: white !important;
}

/* ============================================================
   BOUTON DE PARTAGE
   ============================================================ */
.share-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: transparent;
    border: 1px solid var(--curious);
    color: var(--curious);
    padding: 8px 18px;
    border-radius: 20px;
    cursor: pointer;
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    font-size: 0.85rem;
    transition: all 0.25s;
}

.share-btn:hover {
    background: var(--curious);
    color: #fff;
    box-shadow: 0 0 16px rgba(156, 136, 255, 0.4);
}

/* ============================================================
   ANIMATIONS
   ============================================================ */
@keyframes shake {

    0%,
    100% {
        transform: translate(0, 0) rotate(0deg);
    }

    10% {
        transform: translate(-2px, -2px) rotate(-1deg);
    }

    30% {
        transform: translate(2px, 2px) rotate(1deg);
    }

    50% {
        transform: translate(-2px, 1px) rotate(-0.5deg);
    }

    70% {
        transform: translate(2px, -1px) rotate(0.5deg);
    }

    90% {
        transform: translate(-1px, 2px) rotate(0deg);
    }
}

.shake-anim {
    animation: shake 0.5s ease;
}

/* Typing indicator pour le chat */
@keyframes typing-bounce {

    0%,
    80%,
    100% {
        opacity: 0.3;
        transform: translateY(0);
    }

    40% {
        opacity: 1;
        transform: translateY(-4px);
    }
}

.typing-dots span {
    display: inline-block;
    animation: typing-bounce 1.4s infinite;
    font-size: 1.5em;
    font-weight: bold;
    color: var(--curious);
}

.typing-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

.message.thinking {
    opacity: 0.7;
    font-style: italic;
}

@keyframes pulse-red {
    from {
        transform: scale(1);
        box-shadow: 0 0 10px #ff4757;
    }

    to {
        transform: scale(1.05);
        box-shadow: 0 0 20px #ff4757;
    }
}

/* ============================================================
   CONTROLEUR DE VOYAGE DANS LE TEMPS
   ============================================================ */
#timeline-container {
    position: fixed;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    width: 60%;
    max-width: 600px;
    background: var(--glass);
    padding: 15px 25px;
    border-radius: 30px;
    border: 1px solid var(--border);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    z-index: 1500;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 0 0 15px rgba(0, 229, 255, 0.1);
    pointer-events: auto;
}

#timeline-label {
    font-size: 0.8rem;
    color: var(--energy);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 600;
}

#time-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    background: linear-gradient(90deg, #1e3c72 0%, var(--energy) 100%);
    border-radius: 5px;
    outline: none;
    opacity: 0.8;
    transition: opacity .2s;
    box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.5);
}

#time-slider:hover {
    opacity: 1;
}

#time-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #fff;
    cursor: pointer;
    box-shadow: 0 0 15px var(--energy), 0 0 30px var(--energy);
    border: 2px solid var(--energy);
    transition: transform 0.1s;
}

#time-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #fff;
    cursor: pointer;
    box-shadow: 0 0 15px var(--energy), 0 0 30px var(--energy);
    border: 2px solid var(--energy);
    transition: transform 0.1s;
}

#time-slider::-webkit-slider-thumb:active {
    transform: scale(1.3);
}

/* Timeline Dynamic Tooltip */
#timeline-tooltip {
    position: absolute;
    top: -38px;
    left: 8.3%;
    /* default for 2029 (5/60) */
    transform: translateX(-50%);
    background: rgba(0, 229, 255, 0.15);
    border: 1px solid rgba(0, 229, 255, 0.4);
    color: #fff;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 700;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease, border-color 0.1s ease, box-shadow 0.1s ease;
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    box-shadow: 0 4px 12px rgba(0, 229, 255, 0.2);
    font-family: 'Inter', sans-serif;
    letter-spacing: 0.05em;
}

#time-slider:hover~#timeline-tooltip,
#timeline-container:hover #timeline-tooltip {
    opacity: 1;
}

.timeline-ticks {
    display: flex;
    justify-content: space-between;
    width: 100%;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.5);
    font-family: 'Cinzel', serif;
}

#probability-display {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    margin-top: 4px;
}

#probability-display span {
    transition: color 0.3s ease;
    white-space: nowrap;
}

/* ============================================================
   DEBAT DU CONSEIL (Swarm AI)
   ============================================================ */
.swarm-debate {
    margin-top: 15px;
    background: rgba(15, 23, 42, 0.4);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    border-radius: 12px;
    border: 1px solid rgba(0, 229, 255, 0.15);
    overflow-y: auto;
    max-height: 450px;
    animation: slideUpFade 0.4s ease-out;
}

.debate-header {
    background: rgba(0, 229, 255, 0.1);
    padding: 8px 12px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--energy);
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: 1px solid rgba(0, 229, 255, 0.1);
}

.debate-header i {
    font-style: normal;
}

.agent-thought {
    padding: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    gap: 12px;
    opacity: 0;
    transform: translateX(-10px);
    animation: agentEnter 0.5s forwards;
}

.agent-thought:last-child {
    border-bottom: none;
}

.agent-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.05);
}

.agent-content {
    flex-grow: 1;
}

.agent-name {
    display: block;
    font-weight: 800;
    font-size: 0.7rem;
    margin-bottom: 4px;
    text-transform: uppercase;
}

.agent-text {
    font-size: 0.82rem;
    line-height: 1.4;
    color: #e2e8f0;
}

/* Agent Specifics */
.agent-juridique {
    border-right: 3px solid #3498db;
    box-shadow: 10px 0 20px -10px rgba(52, 152, 219, 0.4);
}

.agent-ethique {
    border-right: 3px solid var(--energy);
    box-shadow: 10px 0 20px -10px rgba(76, 209, 55, 0.4);
}

.agent-poete {
    border-right: 3px solid #9c88ff;
    box-shadow: 10px 0 20px -10px rgba(156, 136, 255, 0.4);
}

.agent-verite {
    border-right: 3px solid #e84118;
    box-shadow: 10px 0 20px -10px rgba(232, 65, 24, 0.4);
}

.agent-juridique .agent-avatar {
    border: 1px solid #3498db;
    box-shadow: 0 0 8px rgba(52, 152, 219, 0.3);
}

.agent-ethique .agent-name {
    color: var(--energy);
}

.agent-ethique .agent-avatar {
    border: 1px solid var(--energy);
    box-shadow: 0 0 8px rgba(0, 229, 255, 0.3);
}

.agent-poete .agent-name {
    color: #9b59b6;
}

.agent-poete .agent-avatar {
    border: 1px solid #9b59b6;
    box-shadow: 0 0 8px rgba(155, 89, 182, 0.3);
}

.agent-myco {
    border-right: 3px solid #f39c12;
    box-shadow: 10px 0 20px -10px rgba(243, 156, 18, 0.4);
}

.agent-myco .agent-name {
    color: #f39c12;
}

.agent-myco .agent-avatar {
    border: 1px solid #f39c12;
    box-shadow: 0 0 8px rgba(243, 156, 18, 0.3);
}

@keyframes agentEnter {
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideUpFade {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.node-zone.hot-topic {
    box-shadow: 0 0 15px #ff4757, inset 0 0 10px #ff4757;
    animation: pulse-red 1.5s infinite alternate;
}

/* ============================================================
   AUTHENTIFICATION — Contributeur Identity
   ============================================================ */
#auth-login-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(76, 209, 55, 0.15);
    border: 1px solid rgba(76, 209, 55, 0.3);
    color: var(--hope);
    padding: 8px 16px;
    border-radius: 30px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.82rem;
    font-family: 'Inter', sans-serif;
    letter-spacing: 0.03em;
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    transition: all 0.25s;
    flex-shrink: 0;
}

#auth-login-btn:hover {
    background: rgba(76, 209, 55, 0.3);
    border-color: var(--hope);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(76, 209, 55, 0.3);
}

/* User Pill (affiché quand connecté) */
#auth-user-pill {
    display: none !important;
    align-items: center;
    gap: 8px;
    background: rgba(76, 209, 55, 0.12);
    border: 1px solid rgba(76, 209, 55, 0.25);
    padding: 5px 14px 5px 5px;
    border-radius: 30px;
    flex-shrink: 0;
    cursor: pointer;
    animation: msg-enter 0.3s ease-out;
}

#auth-user-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    margin-right: 8px;
    object-fit: cover;
    border: 2px solid var(--curious);
}

/* Premium Subscription Section */
#premium-container {
    display: none;
    margin-top: 30px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 20px;
}

.premium-desc {
    font-size: 0.9em;
    margin-bottom: 20px;
}

/* Timeline Wrapper */
.timeline-wrapper {
    position: relative;
    width: 100%;
}

#auth-user-name {
    color: #d5dde8;
    font-size: 0.8rem;
    font-weight: 500;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#auth-logout-btn {
    color: rgba(255, 255, 255, 0.3);
    font-size: 0.85rem;
    cursor: pointer;
    transition: color 0.2s;
    margin-left: 4px;
}

#auth-logout-btn:hover {
    color: var(--fear);
}

/* Auth Error */
#auth-error {
    display: none;
    color: var(--fear);
    margin: 10px 0;
    font-size: 0.85rem;
}

/* GDPR note */
.auth-gdpr-note {
    margin-top: 20px;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.3);
}

/* ============================================================
   GOUVERNANCE — Vote Constitutionnel
   ============================================================ */
#governance-btn {
    display: none;
    align-items: center;
    gap: 6px;
    background: rgba(156, 136, 255, 0.15);
    border: 1px solid rgba(156, 136, 255, 0.3);
    color: var(--curious);
    padding: 8px 14px;
    border-radius: 30px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.82rem;
    font-family: 'Inter', sans-serif;
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    transition: all 0.25s;
    flex-shrink: 0;
}

#governance-btn:hover {
    background: rgba(156, 136, 255, 0.3);
    border-color: var(--curious);
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(156, 136, 255, 0.3);
}

#governance-btn.visible {
    display: flex;
}

#governance-count {
    background: var(--curious);
    color: #000;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 700;
}

/* Governance overlay */
#governance-overlay {
    display: none;
}

#governance-overlay.active {
    display: flex;
}

.governance-modal {
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
}

.governance-modal h2 {
    color: var(--curious) !important;
}

.governance-subtitle {
    font-size: 0.82rem;
    color: rgba(255, 255, 255, 0.5);
    margin-bottom: 20px;
    line-height: 1.5;
    border-left: 3px solid var(--curious);
    padding-left: 12px;
}

/* Proposal form */
.governance-propose {
    margin-bottom: 24px;
}

#governance-input {
    width: 100%;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    color: #d5dde8;
    padding: 12px;
    font-family: 'Inter', sans-serif;
    font-size: 0.88rem;
    resize: vertical;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

#governance-input:focus {
    outline: none;
    border-color: var(--curious);
}

.governance-submit {
    margin-top: 10px;
    width: 100%;
    padding: 12px;
    background: rgba(156, 136, 255, 0.2);
    border: 1px solid rgba(156, 136, 255, 0.3);
    color: var(--curious);
    border-radius: 10px;
    cursor: pointer;
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    font-size: 0.88rem;
    transition: all 0.25s;
}

.governance-submit:hover {
    background: rgba(156, 136, 255, 0.35);
    transform: translateY(-1px);
}

/* Proposal cards */
.proposal-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 12px;
    transition: border-color 0.2s;
}

.proposal-card.open {
    border-color: rgba(156, 136, 255, 0.3);
}

.proposal-card.passed {
    border-color: rgba(76, 209, 55, 0.4);
    background: rgba(76, 209, 55, 0.05);
}

.proposal-card.rejected {
    border-color: rgba(232, 65, 24, 0.3);
    opacity: 0.7;
}

.proposal-card.expired {
    opacity: 0.5;
}

.proposal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.proposal-status {
    font-size: 0.78rem;
    font-weight: 600;
}

.proposal-timer {
    font-size: 0.72rem;
    color: rgba(255, 255, 255, 0.4);
}

.proposal-text {
    font-size: 0.9rem;
    line-height: 1.5;
    color: #d5dde8;
    font-style: italic;
    margin: 10px 0;
}

/* Progress bar */
.proposal-progress {
    margin: 12px 0;
}

.progress-bar {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--curious), var(--hope));
    border-radius: 3px;
    transition: width 0.5s ease;
}

.progress-label {
    font-size: 0.72rem;
    color: rgba(255, 255, 255, 0.4);
    margin-top: 4px;
    display: block;
}

/* Vote buttons */
.proposal-actions {
    display: flex;
    gap: 10px;
    margin: 12px 0;
}

.vote-btn {
    flex: 1;
    padding: 10px;
    border-radius: 8px;
    cursor: pointer;
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    font-size: 0.85rem;
    transition: all 0.25s;
}

.vote-pour {
    background: rgba(76, 209, 55, 0.15);
    border: 1px solid rgba(76, 209, 55, 0.3);
    color: var(--hope);
}

.vote-pour:hover {
    background: rgba(76, 209, 55, 0.3);
    transform: translateY(-1px);
}

.vote-contre {
    background: rgba(232, 65, 24, 0.15);
    border: 1px solid rgba(232, 65, 24, 0.3);
    color: var(--fear);
}

.vote-contre:hover {
    background: rgba(232, 65, 24, 0.3);
    transform: translateY(-1px);
}

.proposal-meta {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.25);
    margin-top: 8px;
}

/* Empty / loading states */
.governance-empty,
.governance-loading,
.governance-error {
    text-align: center;
    padding: 30px 10px;
    color: rgba(255, 255, 255, 0.4);
}

.governance-hint {
    font-size: 0.78rem;
    color: rgba(255, 255, 255, 0.2);
    margin-top: 8px;
}

/* Auth Modal */
#auth-modal {
    display: none;
}

#auth-modal.active {
    display: flex;
}

.auth-modal-content {
    max-width: 420px;
}

.auth-modal-content h2 {
    color: var(--hope) !important;
}

.auth-providers {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 20px;
}

.auth-provider-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 14px 24px;
    border-radius: 10px;
    cursor: pointer;
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    font-size: 0.92rem;
    border: 1px solid;
    transition: all 0.25s;
}

.auth-provider-btn.google {
    background: rgba(255, 255, 255, 0.06);
    color: #e0e0e0;
    border-color: rgba(255, 255, 255, 0.15);
}

.auth-provider-btn.google:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(66, 133, 244, 0.25);
}

.auth-provider-btn.github {
    background: rgba(255, 255, 255, 0.03);
    color: #c9d1d9;
    border-color: rgba(255, 255, 255, 0.1);
}

.auth-provider-btn.github:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.25);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 255, 255, 0.1);
}

/* ============================================================
   HAMBURGER MENU BUTTON (desktop: hidden)
   ============================================================ */
#menu-toggle {
    display: none;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--energy);
    font-size: 1.3rem;
    width: 42px;
    height: 42px;
    border-radius: 8px;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.25s;
}

#menu-toggle:hover {
    background: rgba(0, 229, 255, 0.1);
    border-color: var(--energy);
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

/* -- TABLETTE & PETIT DESKTOP -- */
@media (max-width: 900px) {
    #intro-trigger {
        padding: 7px 12px;
        font-size: 0.78rem;
    }

    .filter-btn {
        padding: 6px 10px;
        font-size: 0.72rem;
    }
}

/* -- MOBILE -- */
@media (max-width: 768px) {
    :root {
        --nav-h: 64px;
    }

    #navbar {
        padding: 0 16px;
        gap: 8px;
        flex-wrap: nowrap;
        justify-content: space-between;
    }

    #menu-toggle {
        display: flex !important;
        order: 10;
    }

    /* Elements to hide when menu is closed */
    #navbar:not(.menu-open)>button:not(#menu-toggle):not(#intro-trigger),
    #navbar:not(.menu-open)>#auth-user-pill,
    #navbar:not(.menu-open)>.global-impact,
    #navbar:not(.menu-open)>.version-tag {
        display: none !important;
    }

    /* Mobile Menu Open State */
    #navbar.menu-open {
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        flex-direction: column;
        justify-content: flex-start;
        align-items: center;
        padding: 100px 20px 40px;
        background: rgba(4, 8, 16, 0.98);
        -webkit-backdrop-filter: blur(25px);
        backdrop-filter: blur(25px);
        z-index: 10000;
        overflow-y: auto;
        gap: 20px;
    }

    #navbar.menu-open>button,
    #navbar.menu-open>div,
    #navbar.menu-open>span {
        display: flex !important;
        width: 100%;
        max-width: 300px;
        justify-content: center;
        padding: 14px;
        font-size: 1.1rem;
    }

    #navbar.menu-open #menu-toggle {
        position: absolute;
        top: 20px;
        right: 20px;
    }

    #intro-trigger {
        order: 1;
    }

    /* Titre plus petit — ajusté pour ne pas chevaucher la nav */
    #tree-canvas h1 {
        font-size: 0.9rem;
        letter-spacing: 0.03em;
        top: calc(var(--nav-h) + 10px);
        padding: 6px 16px;
        white-space: nowrap;
        line-height: 1.3;
        max-width: 80%;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    /* Chat pleine largeur */
    #chat-window {
        width: calc(100vw - 16px);
        right: 8px;
        bottom: 76px;
        height: 55vh;
        z-index: 5000;
    }

    #chat-trigger {
        bottom: 16px;
        right: 16px;
        padding: 12px 18px;
        font-size: 0.82rem;
        z-index: 5000;
    }

    /* Mute button */
    #mute-btn {
        bottom: 16px;
        left: 16px;
        width: 40px;
        height: 40px;
    }

    /* Reader modal plein écran */
    .reader-modal {
        width: 95%;
        padding: 20px;
        max-height: 85vh;
        border-radius: 12px;
    }

    /* Touch hint: empêcher le body bounce sur iOS */
    body {
        overscroll-behavior: none;
    }

    /* ============================================================
   NEW UTILITY CLASSES (Replaced Inline Styles)
   ============================================================ */
    .wisdom-tokens {
        margin-right: 10px;
        font-weight: bold;
        color: #ffd32a;
        display: none;
    }

    .global-impact {
        font-weight: 800;
        color: var(--hope);
        background: rgba(76, 209, 55, 0.1);
        padding: 4px 10px;
        border-radius: 20px;
        border: 1px solid rgba(76, 209, 55, 0.2);
        font-size: 0.85rem;
        display: flex;
        align-items: center;
        gap: 6px;
        text-shadow: 0 0 10px rgba(76, 209, 55, 0.3);
    }

    #nav-mode-btn {
        background: rgba(52, 152, 219, 0.15);
        border: 1px solid rgba(52, 152, 219, 0.3);
        color: #3498db;
        padding: 6px 12px;
        border-radius: 20px;
        font-size: 0.8rem;
        font-weight: 700;
        cursor: pointer;
        transition: all 0.3s ease;
        -webkit-backdrop-filter: blur(5px);
        backdrop-filter: blur(5px);
    }

    #nav-mode-btn:hover {
        background: rgba(52, 152, 219, 0.25);
        border-color: #3498db;
        transform: translateY(-2px);
    }

    #nav-mode-btn.pilot-active {
        background: rgba(231, 76, 60, 0.2);
        border-color: #e74c3c;
        color: #e74c3c;
    }

    /* PILOT HUD OVERLAY */
    #pilot-hud {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        pointer-events: none;
        z-index: 5;
        display: none !important;
        /* Ensure hidden by default */
        background: radial-gradient(circle, transparent 40%, rgba(52, 152, 219, 0.05) 100%);
        box-shadow: inset 0 0 150px rgba(52, 152, 219, 0.1);
    }

    .hud-crosshair {
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        width: 40px;
        height: 40px;
        border: 1px solid rgba(0, 229, 255, 0.3);
        border-radius: 50%;
    }

    .hud-crosshair::before,
    .hud-crosshair::after {
        content: '';
        position: absolute;
        background: rgba(0, 229, 255, 0.4);
    }

    .hud-crosshair::before {
        top: 50%;
        left: -5px;
        width: 100%;
        width: 10px;
        height: 1px;
    }

    .hud-crosshair::after {
        left: 50%;
        top: -5px;
        width: 1px;
        height: 10px;
    }

    .hud-info {
        position: absolute;
        bottom: 120px;
        left: 50%;
        transform: translateX(-50%);
        color: #00e5ff;
        font-family: monospace;
        font-size: 0.7rem;
        text-transform: uppercase;
        letter-spacing: 2px;
        text-shadow: 0 0 10px rgba(0, 229, 255, 0.5);
    }

    .governance-select {
        width: 100%;
        padding: 10px;
        margin-bottom: 15px;
        border-radius: 5px;
        background: rgba(255, 255, 255, 0.1);
        color: #fff;
        border: 1px solid rgba(255, 255, 255, 0.2);
    }

    .governance-option {
        color: #000;
    }
}



/* ============================================================
   PLANT SEED UI (Integrated in Chat)
   ============================================================ */
.chat-plant-btn {
    background: rgba(76, 209, 55, 0.15) !important;
    border: 1px solid rgba(76, 209, 55, 0.4) !important;
    color: #4cd137 !important;
    padding: 8px 12px !important;
    border-radius: 12px !important;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem !important;
}

.chat-plant-btn:hover {
    background: rgba(76, 209, 55, 0.3) !important;
    border-color: #4cd137 !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 4px 15px rgba(76, 209, 55, 0.3);
}

.plant-form textarea {
    width: 100%;
    padding: 14px;
    margin-bottom: 20px;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.3);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.2);
    font-family: inherit;
    resize: vertical;
    font-size: 0.95rem;
}

.plant-form textarea:focus {
    outline: none;
    border-color: var(--hope);
    box-shadow: 0 0 15px rgba(76, 209, 55, 0.3);
}

.cost-token {
    color: #ffd32a;
    font-weight: bold;
}

/* ============================================================
   HUD & DASHBOARDS ( Futuristic / Sci-fi )
   ============================================================ */
.hud-dashboard {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    width: 90%;
    max-width: 480px;
    background: rgba(4, 8, 16, 0.9);
    border: 1px solid var(--energy);
    border-radius: var(--radius);
    z-index: 4000;
    display: none;
    flex-direction: column;
    box-shadow: 0 0 50px rgba(0, 229, 255, 0.2), inset 0 0 20px rgba(0, 229, 255, 0.1);
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    opacity: 0;
}

.hud-dashboard.active {
    display: flex;
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.hud-header {
    padding: 16px 20px;
    border-bottom: 1px solid rgba(0, 229, 255, 0.3);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-family: monospace;
    color: var(--energy);
    font-size: 0.82rem;
    letter-spacing: 0.1em;
    background: rgba(0, 229, 255, 0.05);
}

.hud-content {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    font-family: monospace;
}

.metric-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 8px;
}

.metric-label {
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.75rem;
}

.metric-value {
    color: var(--energy);
    font-weight: bold;
    text-shadow: 0 0 10px rgba(var(--energy-rgb), 0.5);
}

.hud-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.2);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.65rem;
    color: rgba(255, 255, 255, 0.3);
    font-family: monospace;
}

.hud-action-btn {
    background: var(--energy);
    color: #000;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    font-weight: bold;
    cursor: pointer;
    font-size: 0.7rem;
    transition: all 0.2s;
}

.hud-action-btn:hover {
    box-shadow: 0 0 15px var(--energy);
    transform: translateY(-1px);
}

/* Pilot HUD Crosshair */
#pilot-hud {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 1500;
    display: none;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

#pilot-hud.active {
    display: flex;
}

.hud-crosshair {
    width: 40px;
    height: 40px;
    border: 2px solid rgba(var(--energy-rgb), 0.5);
    border-radius: 50%;
    position: relative;
    box-shadow: 0 0 15px rgba(var(--energy-rgb), 0.3);
}

.hud-crosshair::before,
.hud-crosshair::after {
    content: '';
    position: absolute;
    background: var(--energy);
}

.hud-crosshair::before {
    width: 2px;
    height: 10px;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
}

.hud-crosshair::after {
    width: 10px;
    height: 2px;
    left: -12px;
    top: 50%;
    transform: translateY(-50%);
}

.hud-info {
    margin-top: 20px;
    color: var(--energy);
    font-family: monospace;
    font-size: 0.7rem;
    letter-spacing: 0.2em;
    background: rgba(0, 0, 0, 0.4);
    padding: 4px 12px;
    border: 1px solid rgba(var(--energy-rgb), 0.3);
    -webkit-backdrop-filter: blur(5px);
    backdrop-filter: blur(5px);
    text-shadow: 0 0 10px var(--energy);
}

/* -- TRÈS PETIT MOBILE -- */
@media (max-width: 380px) {
    #intro-trigger {
        font-size: 0.7rem;
        padding: 5px 8px;
    }

    #tree-canvas h1 {
        font-size: 0.85rem;
    }

    #chat-trigger {
        padding: 10px 14px;
        font-size: 0.78rem;
    }
}

/* ============================================================
   PREDICTION METADATA & PROBABILITY BARS (Phase 9)
   ============================================================ */
.prediction-meta {
    background: rgba(0, 229, 255, 0.05);
    border-left: 3px solid var(--energy);
    padding: 10px 15px;
    margin-bottom: 20px;
    border-radius: 4px;
    font-family: var(--font-heading);
    font-size: 0.9rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.studio-prediction {
    background: rgba(0, 0, 0, 0.2);
    padding: 12px;
    border-radius: 8px;
    margin-top: 5px;
}

.probability-bar-container {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    margin: 8px 0;
    overflow: hidden;
}

.probability-bar {
    height: 100%;
    transition: width 1s cubic-bezier(0.16, 1, 0.3, 1);
}

.prediction-year {
    font-weight: 600;
    color: #fff;
}

.prediction-prob {
    font-size: 0.8rem;
    opacity: 0.8;
}

.anchored-badge {
    background: linear-gradient(135deg, #f1c40f, #f39c12);
    color: #000;
    font-size: 0.65rem;
    font-weight: 800;
    padding: 2px 8px;
    border-radius: 4px;
    margin-left: 8px;
    vertical-align: middle;
}

/* Phase 9.4 : Symbiose Sensorielle */
.image-upload-label {
    font-size: 1.2rem;
    cursor: pointer;
    margin-right: 10px;
    opacity: 0.7;
    transition: opacity 0.2s, transform 0.2s;
}

.image-upload-label:hover {
    opacity: 1;
    transform: scale(1.1);
}

.chat-messages img.message-image {
    max-width: 150px;
    border-radius: 8px;
    margin-top: 8px;
    display: block;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.sensory-urgency {
    animation: pulse-urgency 0.5s infinite alternate;
}

@keyframes pulse-urgency {
    from {
        box-shadow: 0 0 10px rgba(255, 71, 87, 0.3);
    }

    to {
        box-shadow: 0 0 30px rgba(255, 71, 87, 0.8);
    }
}

.sensory-peace {
    animation: glow-peace 2s infinite alternate;
}

@keyframes glow-peace {
    from {
        filter: drop-shadow(0 0 5px rgba(46, 213, 115, 0.2));
    }

    to {
        filter: drop-shadow(0 0 15px rgba(46, 213, 115, 0.6));
    }
}

/* --- Maintenance & Optimization Classes --- */
.version-tag {
    font-size: 10px;
    opacity: 1;
    color: #00e5ff;
    margin-left: 10px;
    vertical-align: middle;
}

.image-preview-container {
    display: none;
    padding: 10px;
    background: rgba(0, 0, 0, 0.3);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
}

.image-preview-img {
    max-height: 80px;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.remove-image-btn {
    position: absolute;
    top: 5px;
    left: 85px;
    cursor: pointer;
    background: #ff4757;
    color: white;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
}

.image-upload-input {
    display: none;
}

.auth-error-text {
    display: none;
    color: var(--fear);
    background: rgba(var(--fear-rgb, 232, 65, 24), 0.1);
    border: 1px solid var(--fear);
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 0.85rem;
    text-align: center;
}

/* --- GUARDIAN PROFILE STYLES --- */
.profile-header {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--glass-border);
}

.profile-avatar-img {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: 3px solid var(--energy);
    box-shadow: 0 0 20px rgba(var(--energy-rgb), 0.3);
}

.profile-avatar-placeholder {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--energy), var(--curious));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    font-weight: bold;
    color: var(--bg-deep);
    border: 3px solid var(--energy);
    box-shadow: 0 0 20px rgba(var(--energy-rgb), 0.3);
}

.profile-info {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.profile-name {
    font-family: var(--font-heading);
    font-size: 1.8rem;
    color: #fff;
    margin: 0;
}

.profile-badge {
    display: inline-block;
    padding: 4px 12px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    font-size: 0.75rem;
    color: #fff;
    width: fit-content;
}

.profile-badge.premium {
    background: rgba(255, 215, 0, 0.15);
    border-color: #ffd700;
    color: #ffd700;
}

.profile-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 30px;
}

.stat-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    padding: 15px;
    border-radius: 12px;
    text-align: center;
    transition: transform 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--energy);
}

.stat-value {
    display: block;
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--energy);
    margin-bottom: 5px;
}

.stat-label {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.5);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.profile-section-title {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    color: var(--curious);
    margin: 20px 0 15px 0;
    letter-spacing: 0.1em;
}

.profile-seeds {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.profile-seed-item {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--glass-border);
    padding: 12px 15px;
    border-radius: 10px;
    position: relative;
    transition: all 0.2s ease;
}

.profile-seed-item:hover {
    background: rgba(156, 136, 255, 0.05);
    border-color: rgba(156, 136, 255, 0.3);
}

.seed-branch {
    font-size: 0.7rem;
    color: var(--curious);
    text-transform: uppercase;
    font-weight: bold;
    margin-bottom: 5px;
    display: block;
}

.seed-text {
    font-size: 0.9rem;
    line-height: 1.4;
    color: #d5dde8;
    margin: 5px 0;
}

.seed-date {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.3);
    text-align: right;
    display: block;
}

.no-seeds {
    text-align: center;
    padding: 30px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px dashed rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    font-style: italic;
    color: rgba(255, 255, 255, 0.4);
}

/* ============================================================
   VISIONS LIST (MODAL)
   ============================================================ */
.vision-list-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 20px;
}

.vision-list-item {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 15px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.vision-list-item:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--energy);
    transform: translateX(10px);
    box-shadow: -5px 0 15px rgba(var(--energy-rgb), 0.2);
}

.vision-meta {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    min-width: 60px;
}

.vision-badge {
    font-size: 0.65rem;
    text-transform: uppercase;
    font-weight: 800;
    padding: 2px 6px;
    border-radius: 4px;
    background: #333;
    opacity: 0.8;
}

.vision-badge.tech {
    background: var(--tech);
    color: #fff;
}

.vision-badge.ethics {
    background: var(--curious);
    color: #fff;
}

.vision-badge.law {
    background: #ff4757;
    color: #fff;
}

.vision-badge.poetry {
    background: #ffa502;
    color: #fff;
}

.vision-badge.future {
    background: #2f3542;
    color: #fff;
}

.vision-year {
    font-family: var(--font-heading);
    font-weight: 700;
    color: #fff;
    font-size: 0.9rem;
}

.vision-info {
    flex: 1;
}

.vision-title {
    margin: 0 0 6px 0;
    font-size: 0.95rem;
    color: #ecf0f1;
}

.vision-prob-bar {
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    overflow: hidden;
    width: 100px;
}

.vision-prob-bar div {
    height: 100%;
}

.vision-arrow {
    color: var(--energy);
    font-size: 1.2rem;
    font-weight: bold;
    opacity: 0.5;
    transition: opacity 0.2s;
}

.vision-list-item:hover .vision-arrow {
    opacity: 1;
}