/* --- VARIABLES ET RESET --- */
:root {
    --neon: #00ff88;
    --neon-dim: rgba(0, 255, 136, 0.3);
    --gold: #ffcc00; /* Nouvelle couleur pour le bouton final */
    --gold-dim: rgba(255, 204, 0, 0.3);
    --dark: #050a0f;
    --darker: #020406;
    --panel-bg: rgba(0, 10, 10, 0.9);
    --error: #ff4444;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    background: var(--dark);
    color: white;
    font-family: 'Courier New', monospace;
    overflow-x: hidden;
    line-height: 1.4;
}

/* Effet Scanline Global (Style vieux moniteur) */
body::before {
    content: " ";
    display: block;
    position: fixed;
    top: 0; left: 0; bottom: 0; right: 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));
    z-index: 9999;
    background-size: 100% 3px, 3px 100%;
    pointer-events: none;
}

/* --- ELEMENTS COMMUNS (Inputs, Boutons, Tables) --- */
input[type="text"], input[type="password"], textarea {
    background: #000;
    border: 1px solid var(--neon);
    color: #fff;
    padding: 12px;
    font-family: 'Courier New', monospace;
    outline: none;
    transition: 0.3s;
}

input:focus, textarea:focus {
    box-shadow: 0 0 10px var(--neon);
}

button {
    background: var(--neon);
    border: none;
    padding: 12px 25px;
    color: #000;
    font-weight: bold;
    font-family: 'Courier New', monospace;
    cursor: pointer;
    text-transform: uppercase;
    transition: 0.3s;
}

button:hover {
    background: #fff;
    box-shadow: 0 0 20px var(--neon);
}

table {
    width: 100%;
    border-collapse: collapse;
    background: var(--panel-bg);
    border: 1px solid var(--neon);
}

th, td {
    border: 1px solid var(--neon-dim);
    padding: 12px;
    text-align: center;
}

th {
    background: var(--neon);
    color: #000;
}

.card {
    background: var(--panel-bg);
    border: 1px solid var(--neon);
    padding: 20px;
    box-shadow: inset 0 0 15px rgba(0, 255, 136, 0.1);
}

/* --- BARRE DE NAVIGATION (TOP BAR) --- */
.top-bar {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: 65px;
    background: #000;
    border-bottom: 2px solid var(--neon);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 30px;
    z-index: 1000;
}

#chrono {
    font-size: 2.5rem;
    color: var(--neon);
    font-weight: bold;
    text-shadow: 0 0 10px var(--neon);
}

/* --- PAGE D'ACCUEIL & TERMINAL DE BRIEFING --- */
#canvas-container {
    position: fixed;
    top: 0; left: 0; z-index: -1;
}

.main-layout {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 100px 20px 50px;
    gap: 40px;
    min-height: 100vh;
}

.hero {
    text-align: center;
    max-width: 800px;
    width: 100%;
}

.briefing-box {
    background: var(--panel-bg);
    border: 1px solid var(--neon);
    border-radius: 4px;
    margin: 20px auto;
    text-align: left;
    box-shadow: 0 0 20px rgba(0, 255, 136, 0.1);
    overflow: hidden;
}

.terminal-header {
    background: rgba(0, 255, 136, 0.1);
    padding: 10px;
    display: flex;
    align-items: center;
    border-bottom: 1px solid var(--neon);
}

.dot { height: 8px; width: 8px; border-radius: 50%; margin-right: 6px; }
.red { background: #ff5f56; }
.yellow { background: #ffbd2e; }
.green { background: #27c93f; }
.terminal-title { font-size: 0.7rem; color: var(--neon); margin-left: 10px; opacity: 0.8; }

.terminal-body {
    padding: 20px;
    height: 280px;
    overflow-y: auto;
    position: relative;
    line-height: 1.6;
    font-size: 0.9rem;
    color: var(--neon);
    background: linear-gradient(rgba(0, 20, 20, 0.5) 0%, rgba(0, 0, 0, 0.9) 100%);
}

.terminal-body::before {
    content: "";
    position: absolute;
    top: 0; left: 0; width: 100%; height: 2px;
    background: rgba(0, 255, 136, 0.1);
    animation: scan-line 6s linear infinite;
    pointer-events: none;
}

@keyframes scan-line { 0% { top: 0; } 100% { top: 100%; } }

.cursor { font-weight: bold; animation: blinker 1s step-end infinite; color: white; }

.glitch {
    font-size: 3.5rem;
    color: var(--neon);
    text-shadow: 0 0 15px var(--neon);
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 4px;
}

/* --- PAGE DE JEU (GAME GRID) --- */
.game-grid {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 20px;
    padding: 20px;
    margin-top: 80px;
    height: calc(100vh - 100px);
}

.console-panel {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.clue-box {
    flex-grow: 1;
    border-left: 6px solid var(--neon);
}

.clue-box h3 { margin-top: 0; color: var(--neon); }

.memo-area {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.memo-area textarea {
    flex-grow: 1;
    background: #000;
    color: #ccc;
    border: 1px solid #333;
    padding: 15px;
    resize: none;
    font-size: 0.95rem;
}

/* --- BOUTON FINAL DÉCRYPTAGE (AJOUTÉ) --- */
#final-submit-container {
    margin-top: 25px;
    display: none; /* Piloté par le JS */
    animation: slideUp 0.6s cubic-bezier(0.23, 1, 0.32, 1);
}

.btn-final {
    background: var(--gold) !important;
    color: #000 !important;
    font-size: 1.1rem !important;
    width: 100%;
    padding: 15px !important;
    box-shadow: 0 0 20px var(--gold-dim);
    border: none;
    font-weight: bold;
    cursor: pointer;
    text-transform: uppercase;
    transition: 0.3s;
}

.btn-final:hover {
    background: #fff !important;
    box-shadow: 0 0 35px var(--gold);
    transform: scale(1.02);
}

/* Animation de secousse au clic */
.shake-effect {
    animation: shake 0.5s cubic-bezier(.36,.07,.19,.97) both;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes shake {
    10%, 90% { transform: translate3d(-1px, 0, 0); }
    20%, 80% { transform: translate3d(2px, 0, 0); }
    30%, 50%, 70% { transform: translate3d(-4px, 0, 0); }
    40%, 60% { transform: translate3d(4px, 0, 0); }
}

/* --- AJUSTEMENT PAGE REVEAL --- */

.reveal-container {
    margin-top: 160px;
    width: 90%;
    max-width: 900px;
    text-align: center;
    margin-left: auto;
    margin-right: auto;
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.radar {
    width: 250px;
    height: 250px;
    border: 2px solid var(--neon);
    border-radius: 50%;
    margin: 0 auto;
    position: relative;
    overflow: hidden;
    background: rgba(0, 255, 136, 0.05);
    box-shadow: 0 0 30px rgba(0, 255, 136, 0.2);
}

.target-zone h1 {
    margin-top: 20px;
    margin-bottom: 10px;
}

.sweep {
    position: absolute;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, rgba(0,255,136,0) 50%, rgba(0,255,136,0.3) 100%);
    transform-origin: center;
    animation: rotate-radar 4s linear infinite;
}

@keyframes rotate-radar {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* --- SUCCESS PAGE DESIGN --- */
.success-page {
    background: radial-gradient(circle at center, #001a11 0%, #020406 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

.victory-container {
    width: 90%;
    max-width: 700px;
    text-align: center;
    animation: fadeIn 1s ease-out;
}

.victory-header {
    position: relative;
    margin-bottom: 40px;
}

.stamp {
    position: absolute;
    top: -20px;
    right: -10px;
    border: 4px solid #ff4444;
    color: #ff4444;
    padding: 10px 20px;
    font-size: 1.5rem;
    font-weight: bold;
    text-transform: uppercase;
    transform: rotate(15deg);
    opacity: 0.8;
    box-shadow: 0 0 10px #ff4444;
    pointer-events: none;
    z-index: 10;
    border-radius: 5px;
    animation: stamp-slam 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes stamp-slam {
    0% { transform: scale(5) rotate(45deg); opacity: 0; }
    100% { transform: scale(1) rotate(15deg); opacity: 0.8; }
}

.glitch-permanent {
    font-size: 3.5rem;
    color: #fff;
    text-shadow: 0 0 20px var(--neon), 0 0 40px var(--neon);
    margin: 0;
}

.team-badge {
    background: var(--neon);
    color: #000;
    display: inline-block;
    padding: 5px 20px;
    font-weight: bold;
    margin-top: 10px;
    clip-path: polygon(10% 0%, 100% 0%, 90% 100%, 0% 100%);
}

.data-block {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin: 20px 0;
}

.data-item .label {
    display: block;
    font-size: 0.7rem;
    color: #888;
    margin-bottom: 5px;
}

.data-item .value {
    font-weight: bold;
    font-size: 1.1rem;
}

.neon-text {
    color: var(--neon);
    text-shadow: 0 0 10px var(--neon-dim);
}

.narrative-block h3 {
    color: var(--neon);
    font-size: 0.9rem;
    letter-spacing: 2px;
}

.neon-hr {
    border: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--neon), transparent);
    margin: 30px 0;
}

.joke {
    font-style: italic;
    color: #aaa;
    font-size: 0.9rem;
    margin-top: 20px;
}

.action-zone {
    margin-top: 40px;
}

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

/* --- ANIMATIONS ET SCROLLBAR --- */
.blink {
    animation: blinker 1.5s linear infinite;
    color: var(--neon);
}

@keyframes blinker {
    50% { opacity: 0; }
}

.key-slots-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    margin: 20px 0;
    font-family: 'Courier New', monospace;
}

.slot {
    border: 2px dashed var(--neon-dim);
    padding: 10px 15px;
    min-width: 80px;
    text-align: center;
    color: var(--neon-dim);
    background: rgba(0,0,0,0.3);
    transition: all 0.5s ease;
    font-weight: bold;
    letter-spacing: 2px;
}

.slot.revealed {
    border: 2px solid var(--neon);
    color: white;
    background: rgba(0, 255, 136, 0.1);
    box-shadow: 0 0 15px var(--neon-dim);
    border-style: solid;
    animation: flash 0.5s ease;
}

@keyframes flash {
    0% { background: var(--neon); color: black; }
    100% { background: rgba(0, 255, 136, 0.1); color: white; }
}

.terminal-body::-webkit-scrollbar { width: 4px; }
.terminal-body::-webkit-scrollbar-track { background: #000; }
.terminal-body::-webkit-scrollbar-thumb { background: var(--neon); }

::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: #000; }
::-webkit-scrollbar-thumb { background: var(--neon); }