/* --- Styles Généraux --- */
* { box-sizing: border-box; }
body, html { margin: 0; padding: 0; height: 100%; font-family: 'VT323', monospace; background-color: #000; color: #0dff00; overflow: hidden; background-image: url('images/bg-hacker-terminal.png'); background-size: cover; background-position: center; background-attachment: fixed; }
.container { display: flex; flex-direction: column; justify-content: center; align-items: center; height: 100vh; text-align: center; padding: 20px; background-color: rgba(0, 0, 0, 0.7); transition: opacity 0.5s ease-in-out; }

/* --- Style Page d'Accueil --- */
.intrigue { font-size: 1.5em; line-height: 1.8; max-width: 800px; text-shadow: 0 0 5px #0dff00; }
#startButton { font-family: 'VT323', monospace; font-size: 1.8em; margin-top: 40px; padding: 15px 30px; background-color: #ff0000; color: #fff; border: 2px solid #ff4d4d; box-shadow: 0 0 15px #ff0000; cursor: pointer; transition: all 0.2s ease-in-out; }
#startButton:hover { background-color: #fff; color: #ff0000; transform: scale(1.05); }
.glitch { font-size: 5em; position: relative; text-shadow: 0 0 10px #ff0000; animation: glitch 2.5s infinite; }
.glitch::before, .glitch::after { content: attr(data-text); position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: black; overflow: hidden; }
.glitch::before { left: 2px; text-shadow: -2px 0 red; animation: glitch-anim-1 2s infinite linear alternate-reverse; }
.glitch::after { left: -2px; text-shadow: -2px 0 blue; animation: glitch-anim-2 2s infinite linear alternate-reverse; }
@keyframes glitch { 0% { transform: translate(0); } 20% { transform: translate(-3px, 3px); } 40% { transform: translate(-3px, -3px); } 60% { transform: translate(3px, 3px); } 80% { transform: translate(3px, -3px); } 100% { transform: translate(0); } }
@keyframes glitch-anim-1 { 0% { clip: rect(11px, 9999px, 81px, 0); } 100% { clip: rect(10px, 9999px, 91px, 0); } }
@keyframes glitch-anim-2 { 0% { clip: rect(13px, 9999px, 73px, 0); } 100% { clip: rect(44px, 9999px, 102px, 0); } }

/* --- Style des Étapes de Jeu --- */
h2 { font-size: 3em; text-shadow: 0 0 10px #ff0000; }
.puzzle-container { background-color: rgba(0, 20, 0, 0.8); border: 2px solid #0dff00; padding: 30px; border-radius: 10px; max-width: 900px; text-align: center; box-shadow: 0 0 20px rgba(13, 255, 0, 0.5); }
.puzzle-container img { max-width: 50%; height: auto; border: 1px solid #0dff00; margin-bottom: 20px; }
.question { font-size: 1.5em; margin-bottom: 30px; line-height: 1.6; }
.options button { font-family: 'VT323', monospace; font-size: 1.5em; display: block; width: 80%; margin: 10px auto; padding: 15px; background-color: transparent; border: 2px solid #0dff00; color: #0dff00; cursor: pointer; transition: all 0.2s ease-in-out; }
.options button:hover:not(:disabled) { background-color: #0dff00; color: #000; }
.options button:disabled { cursor: not-allowed; opacity: 0.5; }
#feedback-container { margin-top: 20px; font-size: 1.4em; padding: 10px; border-radius: 5px; min-height: 48px; }
#feedback-container.success { border: 2px solid #00ff00; color: #00ff00; }
#feedback-container.error { border: 2px solid #ff0000; color: #ff0000; }
.hidden { display: none !important; }
#next-step-btn { display: inline-block; margin-top: 20px; padding: 10px 20px; background-color: #0dff00; color: #000; text-decoration: none; font-weight: bold; border-radius: 5px; transition: transform 0.2s ease; }
#next-step-btn:hover { transform: scale(1.05); }

/* --- Animation d'erreur --- */
.shake { animation: shake 0.5s; animation-iteration-count: 1; }
@keyframes shake { 0% { transform: translate(1px, 1px); } 10% { transform: translate(-1px, -2px); } 20% { transform: translate(-3px, 0px); } 30% { transform: translate(3px, 2px); } 40% { transform: translate(1px, -1px); } 50% { transform: translate(-1px, 2px); } 60% { transform: translate(-3px, 1px); } 70% { transform: translate(3px, 1px); } 80% { transform: translate(-1px, -1px); } 90% { transform: translate(1px, 2px); } 100% { transform: translate(1px, -2px); } }

/* --- Styles pour l'Étape 2 --- */
.info-box { position: relative; display: inline-flex; align-items: center; margin-bottom: 20px; padding: 8px 12px; background-color: rgba(13, 255, 0, 0.1); border: 1px solid #0dff00; border-radius: 20px; cursor: help; font-size: 1.1em; }
.info-icon { display: inline-block; width: 20px; height: 20px; border-radius: 50%; background-color: #0dff00; color: #000; font-weight: bold; text-align: center; line-height: 20px; margin-right: 10px; }
.info-box .tooltip { visibility: hidden; opacity: 0; position: absolute; bottom: 125%; left: 50%; transform: translateX(-50%); width: 350px; background-color: #000; border: 2px solid #0dff00; color: #0dff00; text-align: left; padding: 15px; border-radius: 6px; z-index: 1; transition: opacity 0.3s; font-size: 0.9em; line-height: 1.6; }
.info-box .tooltip::after { content: ""; position: absolute; top: 100%; left: 50%; margin-left: -5px; border-width: 5px; border-style: solid; border-color: #0dff00 transparent transparent transparent; }
.info-box:hover .tooltip { visibility: visible; opacity: 1; }
.firewall-table { width: 100%; margin: 30px 0; border-collapse: collapse; font-size: 1.2em; }
.firewall-table th, .firewall-table td { border: 1px solid #0dff00; padding: 12px; text-align: center; }
.firewall-table th { background-color: rgba(13, 255, 0, 0.2); }
.infected-row { color: #ff4d4d; font-weight: bold; text-shadow: 0 0 5px #ff0000; }
.status-btn { font-family: 'VT323', monospace; font-size: 1em; padding: 8px 12px; width: 120px; border: none; color: #000; cursor: pointer; transition: background-color 0.2s; font-weight: bold; }
.status-btn.allowed { background-color: #0dff00; box-shadow: 0 0 10px #0dff00; }
.status-btn.blocked { background-color: #ff0000; box-shadow: 0 0 10px #ff0000; }
#apply-rules-btn { font-family: 'VT323', monospace; font-size: 1.5em; margin-top: 10px; padding: 10px 25px; background-color: #0dff00; color: #000; border: 2px solid #fff; cursor: pointer; transition: all 0.2s; }
#apply-rules-btn:hover:not(:disabled) { background-color: #fff; color: #000; transform: scale(1.05); }
#apply-rules-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* --- Styles pour l'Étape 3 --- */
.network-diagram { display: flex; justify-content: space-between; align-items: center; width: 100%; margin: 40px 0; padding: 20px; background-color: rgba(0, 0, 0, 0.3); border: 1px solid #0dff00; }
.network-zone { display: flex; flex-direction: column; align-items: center; gap: 10px; font-size: 1.2em; }
.network-zone img { width: 80px; height: 80px; }
.device-group { display: flex; flex-direction: column; gap: 15px; }
.device-icon { padding: 10px; border: 2px solid #0dff00; border-radius: 50%; background-color: #000; cursor: pointer; transition: all 0.2s ease; }
.device-icon:hover { background-color: #0dff00; transform: scale(1.1); }
.device-icon img { width: 50px; height: 50px; display: block; }
.data-flow-container { flex-grow: 1; position: relative; height: 10px; background-image: linear-gradient(to right, #0dff00, rgba(13, 255, 0, 0)); }
.data-flow { position: absolute; width: 20px; height: 20px; background-color: red; box-shadow: 0 0 10px red, 0 0 20px red; border-radius: 50%; animation: flow 2s linear infinite; }
.data-flow.blocked::after { content: 'X'; position: absolute; top: 50%; left: 150%; transform: translateY(-50%); font-size: 40px; color: red; font-weight: bold; text-shadow: 0 0 10px #fff; }
@keyframes flow { from { left: -20px; } to { left: 100%; } }

/* --- Styles pour l'Étape 4 (Wi-Fi) --- */
.wifi-interface { display: flex; justify-content: space-around; align-items: flex-start; width: 100%; margin-top: 20px; flex-wrap: wrap; }
.wifi-list, .wifi-security { flex-basis: 45%; text-align: left; padding: 15px; border: 1px solid #0dff00; background: rgba(0,0,0,0.4); }
.wifi-list h3, .wifi-security h3 { text-align: center; margin-top: 0; }
.wifi-network { display: flex; justify-content: space-between; align-items: center; padding: 10px; border-bottom: 1px dashed rgba(13, 255, 0, 0.5); }
.wifi-network.malicious { color: #ff4d4d; }
.wifi-disable-btn { font-family: 'VT323', monospace; background: #ff4d4d; border: none; color: white; cursor: pointer; padding: 5px 10px; }
.wifi-disable-btn.disabled { background: #555; color: #999; cursor: not-allowed; }
.password-field { font-family: 'VT323', monospace; font-size: 1.2em; background: #000; color: #0dff00; border: 1px solid #0dff00; padding: 5px; width: 100%; margin-bottom: 15px; }
.password-criteria li { list-style: none; padding-left: 0; margin-bottom: 8px; transition: color 0.3s; }
.password-criteria li.valid { color: #0dff00; text-shadow: 0 0 5px #0dff00; }
.password-criteria li.valid::before { content: '✔ '; }
.password-criteria li::before { content: '✖ '; color: #ff4d4d; }
#secure-wifi-btn { font-family: 'VT323', monospace; font-size: 1.5em; width: 100%; margin-top: 10px; padding: 10px; background-color: #0dff00; color: #000; border: 2px solid #fff; cursor: pointer; }

/* --- Styles pour l'Étape 5 (Serveur) --- */
.server-console { background: #000; border: 2px solid #0dff00; padding: 20px; font-size: 1.2em; text-align: left; }
.server-console p { margin: 0 0 10px 0; }
.command-line { display: flex; align-items: center; }
.command-line span { margin-right: 10px; }
.command-input { font-family: 'VT323', monospace; background: transparent; border: none; color: #0dff00; font-size: 1.2em; flex-grow: 1; outline: none; }
.command-input:focus + .cursor { animation: none; opacity: 1; }
.cursor { font-weight: bold; animation: blink 1s step-end infinite; }
@keyframes blink { from, to { opacity: 1; } 50% { opacity: 0; } }
#run-command-btn { font-family: 'VT323', monospace; font-size: 1.5em; margin-top: 20px; }

/* --- Styles pour l'Étape 6 (Modem) --- */
.modem-panel { display: flex; justify-content: center; gap: 20px; padding: 30px; margin-top: 20px; background: rgba(0,0,0,0.5); border: 1px solid #0dff00; }
.modem-light { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.modem-light .light-indicator { width: 40px; height: 40px; border-radius: 50%; background: #333; border: 2px solid #555; cursor: pointer; transition: all 0.2s; }
.modem-light .light-indicator:hover { border-color: #fff; }
.modem-light .light-indicator.on { background: #0dff00; box-shadow: 0 0 15px #0dff00; }
.modem-light span { font-size: 1.2em; }

/* --- Styles pour l'écran de Victoire --- */
.victory-screen h1 { font-size: 6em; color: #0dff00; text-shadow: 0 0 20px #0dff00; }
.victory-screen p { font-size: 2em; }
#restart-btn { font-family: 'VT323', monospace; font-size: 1.8em; margin-top: 40px; padding: 15px 30px; background-color: #0dff00; color: #000; border: 2px solid #fff; cursor: pointer; }

/* --- Styles pour l'Étape 5 (Console immersive) --- */
.server-console { background: #000; border: 2px solid #0dff00; padding: 20px; text-align: left; }
#console-output {
    height: 150px; /* Hauteur fixe pour la zone de texte */
    overflow-y: auto; /* Ajoute une barre de défilement si nécessaire */
    margin-bottom: 10px;
    font-size: 1.1em;
}
#console-output p { margin: 0 0 5px 0; word-break: break-all; }
.command-line { display: flex; align-items: center; }
.command-line span { font-size: 1.2em; margin-right: 10px; }
.command-input { font-family: 'VT323', monospace; background: transparent; border: none; color: #fff; font-size: 1.2em; flex-grow: 1; outline: none; }
.command-input:focus + .cursor { animation: none; opacity: 1; }
.cursor { font-weight: bold; animation: blink 1s step-end infinite; }
@keyframes blink { from, to { opacity: 1; } 50% { opacity: 0; } }

/* Styles pour les différents types de messages dans la console */
.console-input { color: #fff; }
.console-info { color: #0dff00; }
.console-success { color: #0dff00; font-weight: bold; }
.console-error { color: #ff4d4d; font-weight: bold; }

#run-command-btn { font-family: 'VT323', monospace; font-size: 1.5em; margin-top: 20px; }

/* --- Styles pour le QCM Final --- */
.qcm-container { max-width: 800px; }
.qcm-progress { font-size: 2.2em; color: #aaa; }
.qcm-question { font-size: 1.8em; margin: 20px 0 30px 0; text-shadow: 0 0 10px #ff0000;}
.qcm-answers { display: flex; flex-direction: column; gap: 10px; }
.qcm-answer-btn {
    font-family: 'VT323', monospace;
    font-size: 1.5em;
    padding: 15px;
    background-color: transparent;
    border: 2px solid #0dff00;
    color: #0dff00;
    cursor: pointer;
    text-align: left;
    transition: all 0.2s ease-in-out;
}
.qcm-answer-btn:hover:not(:disabled) { background-color: #0dff00; color: #000; }
.qcm-answer-btn:disabled { cursor: not-allowed; opacity: 0.7; }

/* Styles de feedback pour les réponses */
.qcm-answer-btn.correct { background-color: #0dff00 !important; color: #000 !important; border-color: #fff !important; }
.qcm-answer-btn.incorrect { background-color: #ff0000 !important; color: #fff !important; border-color: #fff !important; }

/* --- Styles pour l'écran de score final --- */
.final-score {
    font-size: 8em;
    font-weight: bold;
    color: #0dff00;
    text-shadow: 0 0 20px #0dff00;
    margin: 20px 0;
}

 /* --- Styles pour les boutons de l'écran de score --- */
.final-buttons {
    display: flex;
    gap: 20px;
    margin-top: 30px;
}
/* On retire la marge individuelle pour un meilleur alignement */
.final-buttons #restart-btn, .final-buttons #summary-btn {
    margin-top: 0;
}
/* Style pour le nouveau bouton résumé */
#summary-btn {
    font-family: 'VT323', monospace;
    font-size: 1.8em;
    padding: 15px 30px;
    border: 2px solid #0dff00;
    color: #0dff00;
    background-color: transparent;
    cursor: pointer;
    transition: all 0.2s;
}
#summary-btn:hover {
    background-color: #0dff00;
    color: #000;
    transform: scale(1.05);
}

/* --- Styles pour la Page Résumé --- */
.summary-container {
    background-color: rgba(0, 20, 0, 0.9);
    border: 2px solid #0dff00;
    padding: 40px;
    border-radius: 10px;
    max-width: 1200px;
    width: 95%;
    max-height: 90vh; /* Empêche de dépasser de l'écran */
    overflow-y: auto; /* Ajoute une barre de défilement si le contenu est trop grand */
    text-align: center;
    box-shadow: 0 0 20px rgba(13, 255, 0, 0.5);
}
.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); /* Grille responsive */
    gap: 20px;
    text-align: left;
    margin: 30px 0;
}
.summary-item {
    background-color: rgba(0, 0, 0, 0.5);
    border-left: 4px solid #0dff00;
    padding: 15px;
    border-radius: 5px;
}
.summary-item h3 {
    margin-top: 0;
    font-size: 1.8em;
    color: #fff;
    text-shadow: 0 0 5px #0dff00;
}
.summary-item p {
    font-size: 1.2em;
    line-height: 1.6;
    color: #ccc;
}

body.zen-mode {
    background-image: url('images/bg-zen-network.png');