/* ================= DESIGN PRINCIPAL : CYBERPUNK / NÉON ================= */
@import url('https://fonts.googleapis.com/css2?family=Rajdhani:wght@400;600;700&family=VT323&display=swap');

:root {
    --bg-darkest: #0a0a14;
    --neon-pink: #ff00ff;
    --neon-blue: #00eaff;
    --neon-green: #00ff99;
    --neon-red: #ff3333;
    --neon-gold: #ffcc00;
    --text-light: #e0e0ff;
    --font-main: 'Rajdhani', sans-serif;
    --font-digital: 'VT323', monospace;
    --scanlines: repeating-linear-gradient(to bottom, transparent 0px, transparent 2px, rgba(0,0,0,0.3) 3px, rgba(0,0,0,0.3) 4px);
}

/* --- Animations --- */
@keyframes neon-glow {
    from {
        text-shadow: 0 0 5px rgba(255, 255, 255, 0.5), 0 0 10px rgba(0, 234, 255, 0.5);
    }
    to {
        text-shadow: 0 0 10px rgba(255, 255, 255, 0.8), 0 0 20px rgba(0, 234, 255, 0.8);
    }
}

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

.card-animated {
    animation: card-enter 0.5s ease-out forwards;
}


body {
    font-family: var(--font-main), sans-serif;
    color: var(--text-light);
    margin: 0;
    padding: 20px;
    display: flex;
    justify-content: center;
    min-height: 100vh;
    background-color: #0f0c29;
    background-image: var(--scanlines), linear-gradient(135deg, #300030 0%, #1a1a4a 50%, #050510 100%);
    background-attachment: fixed;
    background-size: cover;
}

.main-container {
    max-width: 1400px;
    width: 95%;
    display: flex;
    flex-direction: column;
    gap: 30px;
    z-index: 2;
}

/* --- HEADER --- */
h1 {
    font-family: var(--font-digital), monospace;
    font-size: 3.5rem;
    color: var(--neon-pink);
    text-shadow: 0 0 10px rgba(255, 0, 255, 0.7);
    text-transform: uppercase;
    text-align: center;
    margin-bottom: 5px;
}

.subtitle {
    font-family: var(--font-main), sans-serif;
    font-size: 1.2rem;
    color: var(--neon-blue);
    letter-spacing: 5px;
    display: block;
    text-shadow: 0 0 5px var(--neon-blue);
    text-align: center;
    margin-bottom: 20px;
}

#stats-bar {
    display: flex;
    justify-content: center;
    gap: 100px;
    background: rgba(10, 10, 20, 0.6);
    padding: 15px;
    border-top: 2px solid var(--neon-blue);
    border-bottom: 2px solid var(--neon-blue);
    backdrop-filter: blur(5px);
    font-family: var(--font-digital), monospace;
    font-size: 1.5rem;
    box-shadow: 0 0 20px rgba(0, 234, 255, 0.15);
}

.stat-item span { font-size: 2rem; color: #fff; transition: text-shadow 0.3s ease; }
#score-budget { color: var(--neon-pink); text-shadow: 0 0 10px var(--neon-pink); }
#score-eco { color: var(--neon-green); text-shadow: 0 0 10px var(--neon-green); }
#score-libre { color: var(--neon-blue); text-shadow: 0 0 10px var(--neon-blue); }

.stat-updated {
    animation: neon-glow 0.5s alternate 2;
}

/* --- CARTES --- */
#scenario-card, #end-game-card, #assistant-ia, #flowchart-container {
    background: linear-gradient(135deg, rgba(20, 20, 34, 0.9) 0%, rgba(31, 31, 51, 0.9) 100%);
    padding: 40px;
    border: 1px solid rgba(255, 0, 255, 0.3);
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    position: relative;
    backdrop-filter: blur(5px);
    margin-top: 30px;
}

#scenario-card::before, #end-game-card::before, #flowchart-container::before { content: ''; position: absolute; top: -2px; left: -2px; width: 30px; height: 30px; border-top: 3px solid var(--neon-pink); border-left: 3px solid var(--neon-pink); }
#scenario-card::after, #end-game-card::after, #flowchart-container::after { content: ''; position: absolute; bottom: -2px; right: -2px; width: 30px; height: 30px; border-bottom: 3px solid var(--neon-pink); border-right: 3px solid var(--neon-pink); }

h2, #scenario-title {
    font-family: var(--font-digital), monospace;
    color: var(--neon-blue);
    text-shadow: 0 0 10px rgba(0, 234, 255, 0.5);
    font-size: 2.5rem;
    margin-top: 0;
    border-bottom: 1px solid rgba(0, 234, 255, 0.3);
    padding-bottom: 15px;
    text-transform: uppercase;
}

p { font-size: 1.3rem; line-height: 1.6; }

/* --- BOUTONS --- */
#choices-container { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-top: 20px; }

button {
    font-family: var(--font-digital), monospace;
    padding: 20px;
    cursor: pointer;
    background: rgba(0, 0, 0, 0.4);
    border: 2px solid var(--neon-blue);
    color: var(--neon-blue);
    font-size: 1.4rem;
    text-transform: uppercase;
    text-align: left;
    transition: all 0.2s ease;
    text-shadow: 0 0 5px rgba(0, 234, 255, 0.5);
}

button:hover {
    transform: translateY(-3px);
    background-color: rgba(0, 234, 255, 0.15);
    box-shadow: 0 0 20px rgba(0, 234, 255, 0.6);
    color: #fff;
    border-color: #fff;
}

button:active {
    transform: translateY(1px);
    box-shadow: 0 0 5px rgba(0, 234, 255, 0.4);
}


button strong { display: block; font-size: 1.6rem; margin-bottom: 5px; }
button small { font-family: var(--font-main), sans-serif; font-size: 1rem; color: #ccc; text-transform: none; }

.choice-btn-sustainable { border-color: var(--neon-green); color: var(--neon-green); }
.choice-btn-sustainable:hover { background: rgba(0, 255, 153, 0.1); box-shadow: 0 0 15px rgba(0, 255, 153, 0.4); }
.choice-btn-expensive { border-color: var(--neon-red); color: var(--neon-red); }
.choice-btn-expensive:hover { background: rgba(255, 51, 51, 0.1); box-shadow: 0 0 15px rgba(255, 51, 51, 0.4); }

/* --- IA & UTILS --- */
#assistant-ia { margin-top: 30px; border-color: var(--neon-green); box-shadow: 0 0 10px rgba(0, 255, 153, 0.2); }
#ia-title { color: var(--neon-green); border-bottom-color: rgba(0, 255, 153, 0.5); font-size: 1.5rem; display: flex; align-items: center; justify-content: space-between; }
.offline-tag { font-size: 0.8rem; background: var(--neon-green); color: #000; padding: 2px 8px; border-radius: 4px; }
.ia-subtitle { font-size: 1rem; color: #888; font-style: italic; margin-bottom: 15px; }
.ia-interface { display: flex; gap: 10px; margin: 15px 0; }
#user-question { flex-grow: 1; padding: 10px; background: rgba(0, 50, 0, 0.2); border: 1px solid var(--neon-green); color: var(--neon-green); font-family: var(--font-digital), monospace; font-size: 1.2rem; }
#btn-ask-bot { border-color: var(--neon-green); color: var(--neon-green); }

/* --- FOOTER & GROS BOUTONS --- */
footer { text-align: center; margin-top: 40px; color: #666; }

.footer-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 20px; }
@media (max-width: 600px) { .footer-actions { grid-template-columns: 1fr; } }

.big-action-btn {
    width: 100%;
    padding: 20px;
    background: rgba(255, 51, 51, 0.1);
    border: 2px solid var(--neon-red);
    color: var(--neon-red);
    font-size: 1.5rem;
    font-weight: bold;
    text-align: center;
    text-shadow: 0 0 10px var(--neon-red);
    box-shadow: 0 0 15px rgba(255, 51, 51, 0.2);
}
.big-action-btn:hover { background: var(--neon-red); color: #000; box-shadow: 0 0 30px var(--neon-red); transform: scale(1.02); }

/* Bouton RSE (Style Or/Citoyen) */
.rse-btn {
    border-color: var(--neon-gold);
    color: var(--neon-gold);
    background: rgba(255, 204, 0, 0.1);
    box-shadow: 0 0 15px rgba(255, 204, 0, 0.2);
    text-shadow: 0 0 10px var(--neon-gold);
}
.rse-btn:hover { background: var(--neon-gold); color: #000; box-shadow: 0 0 30px var(--neon-gold); }

.small-btn { background: transparent; border: 1px solid #555; color: #888; font-size: 0.9rem; padding: 5px 10px; margin: 5px; cursor: pointer;}
.small-btn:hover { border-color: #fff; color: #fff; }
.hidden { display: none !important; }

/* ================= DÉFI 509 : LASER GAME OVERLAY ================= */
#laser-game-area {
    position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
    background: rgba(0, 0, 0, 0.95); z-index: 9999;
    color: white; text-align: center; padding-top: 50px;
    backdrop-filter: blur(5px);
    cursor: crosshair;
}
@keyframes popIn { 0% { transform: scale(0); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }

/* ================= DÉFI 482 : MODE ÉCO ================= */
body.eco-mode {
    background: #000 !important;
    color: #0f0 !important;
    font-family: 'Courier New', monospace !important;
}
body.eco-mode * {
    box-shadow: none !important;
    text-shadow: none !important;
    border-radius: 0 !important;
    transition: none !important;
    animation: none !important;
    background-image: none !important;
    border-color: #0f0 !important;
}
body.eco-mode .main-container, body.eco-mode section, body.eco-mode aside {
    background: #000 !important;
    border: 1px solid #0f0 !important;
    box-shadow: none !important;
}
body.eco-mode button {
    background: #000 !important;
    color: #0f0 !important;
    border: 1px solid #0f0 !important;
}
body.eco-mode h1, body.eco-mode h2, body.eco-mode span {
    color: #0f0 !important;
    text-shadow: none !important;
}

/* ================= ARBRE DE VISUALISATION ================= */
#flowchart-container {
    border-color: var(--neon-gold);
    overflow-x: auto;
}
#flowchart-container h2 {
    color: var(--neon-gold);
    border-bottom-color: rgba(255, 204, 0, 0.4);
}

.flow-node-container {
    /* Pour que les branches s'alignent proprement */
    border-left: 1px solid rgba(80, 80, 80, 0.3);
    margin-bottom: 5px;
}

.flow-node {
    background: #222;
    border: 1px solid #555;
    padding: 10px 15px;
    display: inline-block;
    border-radius: 3px;
    font-size: 0.9rem;
    color: #999;
    min-width: 200px;
}

.flow-node.visited {
    background: var(--neon-gold);
    color: #000;
    border-color: var(--neon-gold);
    font-weight: bold;
    box-shadow: 0 0 15px rgba(255, 204, 0, 0.5);
}

.flow-branch {
    position: relative;
    margin-left: 20px;
    padding-left: 30px;
    border-left: 2px dashed #444;
}

/* Connecteurs */
.flow-node-container::before {
    content: '';
    position: absolute;
    left: 0;
    top: 18px;
    width: 30px;
    height: 2px;
    background: #444;
}

.flow-node-container:first-child::before {
    /* Pas de ligne pour le tout premier noeud */
    display: none;
}

/* ================= TIMELINE CYBERPUNK (Green IT Optimized) ================= */

/* Conteneur principal avec une ligne verticale continue */
.timeline-container {
    position: relative;
    padding: 20px 0;
    max-width: 800px;
    margin: 0 auto; /* Centré */
}

/* La ligne verticale néon */
.timeline-container::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: 20px; /* Position de la ligne */
    width: 2px;
    background: linear-gradient(to bottom, var(--neon-blue), var(--neon-pink));
    box-shadow: 0 0 10px var(--neon-blue);
    z-index: 0;
}

/* Une étape individuelle */
.timeline-step {
    position: relative;
    margin-bottom: 40px;
    padding-left: 60px; /* Espace pour la ligne et le marqueur */
    animation: slideIn 0.5s ease-out;
}

/* Le point lumineux sur la ligne */
.timeline-marker {
    position: absolute;
    left: 11px; /* Centré sur la ligne de 2px (20px left - 9px width/2) */
    top: 0;
    width: 20px;
    height: 20px;
    background: var(--bg-darkest);
    border: 2px solid var(--neon-green);
    border-radius: 50%;
    box-shadow: 0 0 10px var(--neon-green);
    z-index: 1;
}

/* Contenu de la carte */
.timeline-content {
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid var(--neon-blue);
    padding: 15px;
    border-radius: 4px;
    position: relative;
}

/* Petit triangle qui pointe vers la timeline */
.timeline-content::before {
    content: '';
    position: absolute;
    left: -8px;
    top: 10px;
    width: 0;
    height: 0;
    border-top: 8px solid transparent;
    border-bottom: 8px solid transparent;
    border-right: 8px solid var(--neon-blue);
}

.timeline-title {
    margin: 0 0 10px 0;
    color: #fff;
    font-size: 1.2rem;
    font-family: var(--font-main), sans-serif;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Liste des choix */
.timeline-choices-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.timeline-choice {
    padding: 8px;
    font-family: var(--font-digital), monospace;
    font-size: 1rem;
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Style pour le choix PRIS */
.choice-taken {
    background: rgba(0, 255, 153, 0.1);
    border: 1px solid var(--neon-green);
    color: var(--neon-green);
    text-shadow: 0 0 5px var(--neon-green);
}

/* Style pour les choix IGNORÉS (plus discret) */
.choice-ignored {
    border: 1px dashed #555;
    color: #777;
    opacity: 0.7;
    font-size: 0.9rem;
}

.choice-tag {
    margin-left: auto;
    font-size: 0.7rem;
    background: var(--neon-green);
    color: #000;
    padding: 2px 6px;
    font-weight: bold;
}

@keyframes slideIn {
    from { opacity: 0; transform: translateX(-20px); }
    to { opacity: 1; transform: translateX(0); }
}
/* Animation des stats flottantes */
.floating-stat {
    position: absolute;
    font-weight: bold;
    font-size: 1.5rem;
    pointer-events: none; /* Pour cliquer au travers */
    z-index: 9999;
    text-shadow: 0 0 5px #000;
    transform: translate(-50%, 0); /* Centrer par rapport au point d'origine */
    animation: floatUp 1s ease-out forwards;
}

@keyframes floatUp {
    0% { opacity: 1; transform: translate(-50%, 0) scale(1); }
    100% { opacity: 0; transform: translate(-50%, -50px) scale(1.2); }
}