body {
    color: #00ff9d;
    font-family: 'Courier New', monospace;
    text-align: center;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
    
    /* Image de fond */
    background: url('images/background.png') no-repeat 5% 35% fixed; 
    background-size: cover;
    background-size: 125%;
    overflow: hidden;
}

/* Effet écran */
body::after {
    content: " ";
    display: block;
    position: absolute;
    top: 0; left: 0; bottom: 0; right: 0;
    background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.25) 50%), linear-gradient(90deg, rgba(255, 0, 0, 0.06), rgba(0, 255, 0, 0.02), rgba(0, 0, 255, 0.06));
    z-index: 2;
    background-size: 100% 2px, 3px 100%;
    pointer-events: none; 
}

#menuScreen {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 100vh;
    width: 100%;
    position: absolute;
    background: rgba(0, 0, 0, 0.6); 
    z-index: 100;
    backdrop-filter: blur(3px);
}

.title-neon {
    font-size: 4em;
    font-weight: bold;
    text-shadow: 0 0 10px #00ff9d, 0 0 20px #00ff9d, 0 0 40px #00ff9d;
    margin-bottom: 40px;
    letter-spacing: 8px;
    text-transform: uppercase;
    animation: flicker 2s infinite;
}

@keyframes flicker {
    0%, 19%, 21%, 23%, 25%, 54%, 56%, 100% { opacity: 1; text-shadow: 0 0 10px #00ff9d, 0 0 20px #00ff9d; }
    20%, 24%, 55% { opacity: 0.5; text-shadow: none; }
}

.menu-box {
    border: 2px solid #00ff9d;
    box-shadow: 0 0 15px rgba(0, 255, 157, 0.2), inset 0 0 20px rgba(0, 255, 157, 0.1);
    padding: 40px;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    flex-direction: column;
    gap: 20px;
    width: 350px;
    border-radius: 10px;
}

.input-code {
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid #00ff9d;
    color: white;
    padding: 15px;
    font-size: 20px;
    text-align: center;
    font-family: monospace;
    letter-spacing: 4px;
    text-transform: uppercase;
    outline: none;
}
.input-code:focus {
    box-shadow: 0 0 10px #00ff9d;
}

.btn-start {
    font-size: 20px;
    padding: 15px 30px;
    background: rgba(0, 255, 157, 0.1);
    border: 2px solid #00ff9d;
    color: #00ff9d;
    cursor: pointer;
    text-transform: uppercase;
    font-weight: bold;
    transition: 0.3s;
    letter-spacing: 2px;
}
.btn-start:hover {
    background: #00ff9d;
    color: black;
    box-shadow: 0 0 20px #00ff9d;
}

.lobby-info {
    font-size: 1.5em;
    color: white;
    margin-top: 20px;
    border: 1px dashed #00ff9d;
    padding: 20px;
    background: rgba(0, 0, 0, 0.8);
}
#gameCodeDisplay {
    font-size: 2.5em;
    color: #00ff9d;
    font-weight: bold;
    display: block;
    margin-top: 10px;
    text-shadow: 0 0 10px #00ff9d;
}

#gameInterface {
    display: none;
    padding-top: 20px;
    width: 100%;
    height: 100vh;
    box-sizing: border-box;
    background: radial-gradient(circle, rgba(0,0,0,0) 0%, rgba(0,0,0,0.8) 90%);
}

h1 { margin-bottom: 5px; text-shadow: 0 0 5px #00ff9d; }
#info { color: #88ffcc; margin-top: 0; font-weight: normal; letter-spacing: 1px;}

.stats-container {
    display: flex;
    justify-content: center;
    gap: 60px;
    margin-bottom: 15px;
    font-size: 1.3em;
    font-weight: bold;
    text-shadow: 1px 1px 2px black;
    background: rgba(0,0,0,0.5);
    padding: 10px;
    border-radius: 50px;
    display: inline-flex; 
    border: 1px solid #333;
}
.color-j1 { color: #00a8ff; text-shadow: 0 0 5px #00a8ff; }
.color-j2 { color: #ff4757; text-shadow: 0 0 5px #ff4757; }

.game-container {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    gap: 20px;
    position: relative;
    z-index: 10;
}

#grid {
    display: grid;
    grid-template-columns: repeat(6, 80px);
    grid-gap: 4px;
    background: rgba(20, 20, 20, 0.7); 
    padding: 10px;
    border: 2px solid #00ff9d;
    box-shadow: 0 0 20px rgba(0, 255, 157, 0.1);
    border-radius: 5px;
}

.cell {
    width: 80px;
    height: 80px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(0, 255, 157, 0.3);
    position: relative;
}

#logs {
    border: 2px solid #00ff9d;
    background-color: rgba(0, 0, 0, 0.8);
    width: 300px;
    height: 500px; 
    overflow-y: scroll;
    font-size: 13px;
    text-align: left;
    padding: 15px;
    color: #ccc;
    font-family: 'Consolas', monospace;
    border-radius: 5px;
    box-shadow: 0 0 15px rgba(0, 255, 157, 0.1);
}

#logs::-webkit-scrollbar { width: 8px; }
#logs::-webkit-scrollbar-track { background: #111; }
#logs::-webkit-scrollbar-thumb { background: #00ff9d; border-radius: 4px; }

/* Vaisseaux */
.ship-container {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    position: absolute;
    top: 0; left: 0;
    z-index: 5;
}

.ship-container img {
    width: 65px; 
    height: 65px;
    object-fit: contain; 
    transition: all 0.3s ease-in-out;
}

.p1-glow img {
    filter: drop-shadow(0 0 5px #00a8ff) drop-shadow(0 0 15px #00a8ff);
}

.p2-glow img {
    filter: drop-shadow(0 0 5px #ff4757) drop-shadow(0 0 15px #ff4757);
}

.ship-container:hover img {
    transform: scale(1.1);
}

/* Drones */
.drone-container {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    position: absolute;
    top: 0; left: 0;
    z-index: 6; 
    pointer-events: none; 
}

.drone-container img {
    width: 35px;
    height: 35px;
    object-fit: contain;
    animation: hoverDrone 1.5s infinite alternate ease-in-out;
}

/* Animation de flottement des drones */
@keyframes hoverDrone {
    from { transform: translateY(0); }
    to { transform: translateY(-5px); }
}

.d1-glow img {
    filter: drop-shadow(0 0 2px cyan) drop-shadow(0 0 8px cyan);
}

.d2-glow img {
    filter: drop-shadow(0 0 2px orange) drop-shadow(0 0 8px orange);
}

/* Manette */
#controlPanel {
    display: none;
    margin-top: 20px;
    padding: 15px;
    background: transparent;
    border-top: none;
    width: 100%;
    position: fixed;
    bottom: 20px;
    left: 0;
    z-index: 20;
    pointer-events: none; 
}

#controlPanel button, #controlPanel #seq {
    pointer-events: auto;
}

#seq {
    font-size: 1.5em;
    margin-bottom: 10px;
    color: white;
    letter-spacing: 4px;
    text-shadow: 0 0 5px white;
}

/* Boutons */
button {
    background: rgba(0, 0, 0, 0.6);
    color: #00ff9d;
    border: 1px solid #00ff9d;
    padding: 10px 15px;
    margin: 5px;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    font-family: monospace;
    transition: all 0.2s;
    border-radius: 4px;
}

button:hover {
    background: #00ff9d;
    color: black;
    box-shadow: 0 0 15px #00ff9d;
    transform: translateY(-2px);
}

.btn-validate {
    background: rgba(0, 255, 157, 0.2);
    color: white;
    font-size: 18px;
    padding: 10px 40px;
    border: 2px solid #00ff9d;
    margin-left: 20px;
}

.btn-reset {
    color: #ff4757;
    border-color: #ff4757;
}

.btn-reset:hover {
    background: #ff4757;
    color: white;
    box-shadow: 0 0 15px #ff4757;
}

#controlPanel.gamepad-container {
    display: none;
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: auto;
    min-width: 500px;
    padding: 25px;
    background: linear-gradient(135deg, #1a1a1a, #0a0a0a);
    border: 3px solid #00ff9d;
    box-shadow: 0 0 25px rgba(0, 255, 157, 0.2), inset 0 0 10px rgba(0,0,0,0.5);
    border-radius: 20px 20px 40px 40px;
    z-index: 20;
}

.sequence-display {
    background: rgba(0, 20, 10, 0.9);
    border: 2px solid #005c36;
    box-shadow: inset 0 0 10px rgba(0, 255, 157, 0.1);
    padding: 5px 15px;
    border-radius: 5px;
    margin-bottom: 20px;
    text-align: center;
    text-shadow: 0 0 5px #00ff9d;
}

#seq { font-size: 1.2em; margin-top: 5px; letter-spacing: 2px; }

.gamepad-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 30px;
}

.d-pad {
    display: grid;
    grid-template-columns: repeat(3, 45px);
    grid-template-rows: repeat(3, 45px);
    gap: 2px;
    background: #111;
    padding: 5px;
    border-radius: 50%;
    box-shadow: 0 5px 10px rgba(0,0,0,0.5);
}

.d-btn {
    background: linear-gradient(to bottom, #333, #222);
    color: #888;
    border: 1px solid #444;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.1s;
    box-shadow: inset 0 2px 2px rgba(255,255,255,0.1), 0 2px 4px rgba(0,0,0,0.3);
}

.d-btn:active {
    background: #111;
    box-shadow: inset 0 2px 5px rgba(0,0,0,0.5);
    color: #00ff9d;
    transform: translateY(1px);
}

.d-up { grid-column: 2; grid-row: 1; border-radius: 5px 5px 0 0; }
.d-down { grid-column: 2; grid-row: 3; border-radius: 0 0 5px 5px; }
.d-left { grid-column: 1; grid-row: 2; border-radius: 5px 0 0 5px; }
.d-right { grid-column: 3; grid-row: 2; border-radius: 0 5px 5px 0; }
.d-center { grid-column: 2; grid-row: 2; background: #222; border-radius: 2px; }

.center-buttons {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.btn-command {
    padding: 8px 20px;
    font-size: 12px;
    font-weight: bold;
    border-radius: 20px;
    text-transform: uppercase;
    cursor: pointer;
    box-shadow: 0 3px 5px rgba(0,0,0,0.3);
    transition: all 0.1s;
    border: none;
    font-family: 'Courier New', monospace;
}

.btn-command:active { transform: translateY(2px); box-shadow: 0 1px 2px rgba(0,0,0,0.3); }

.btn-validate {
    background: linear-gradient(to bottom, #00ff9d, #00a86b);
    color: black;
}

.btn-reset {
    background: linear-gradient(to bottom, #ff4757, #c0392b);
    color: white;
}

.action-buttons {
    display: flex;
    gap: 15px;
    transform: rotate(-10deg); 
}

.btn-action {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    border: 3px solid #333;
    cursor: pointer;
    font-family: 'Courier New', monospace;
    font-size: 11px;
    font-weight: bold;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    box-shadow: 0 5px 10px rgba(0,0,0,0.4), inset 0 2px 5px rgba(255,255,255,0.1);
    transition: all 0.1s;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

.btn-action:active {
    transform: scale(0.95);
    box-shadow: inset 0 5px 10px rgba(0,0,0,0.5);
}

.btn-fire {
    background: linear-gradient(to bottom right, #e74c3c, #c0392b);
    color: white;
    border-color: #c0392b;
}

.btn-drone {
    background: linear-gradient(to bottom right, #3498db, #2980b9);
    color: white;
    border-color: #2980b9;
    margin-top: 20px; 
}

#controlPanel button:not(.d-btn):not(.btn-command):not(.btn-action) {
    display: none;
}

/* Texte du début */
.story-text {
    color: #aaddcc;
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 16px;
    line-height: 1.6;
    text-align: left;
    margin-bottom: 40px;
    max-width: 500px;
    border-left: 4px solid #00ff9d;
    padding-left: 20px;
    background: linear-gradient(90deg, rgba(0, 255, 157, 0.1) 0%, transparent 100%);
    text-shadow: 0 0 5px rgba(0, 255, 157, 0.3);
}

.blink {
    animation: blinking 1s infinite;
}

@keyframes blinking { 0% { opacity: 1; } 50% { opacity: 0; } 100% { opacity: 1; } }

/* Ecran gameover */
#gameOverScreen {
    display: none;
    position: fixed;
    top: 0; 
    left: 0;
    width: 100%; 
    height: 100vh;
    background: rgba(0, 0, 0, 0.95); 
    z-index: 200; 
    justify-content: center;
    align-items: center;
    flex-direction: column;
    backdrop-filter: blur(5px);
}

.result-box {
    border: 4px solid white;
    padding: 50px;
    text-align: center;
    background: rgba(20, 20, 20, 0.9);
    box-shadow: 0 0 50px rgba(0,0,0,0.8);
    transform: scale(0.8);
    animation: popIn 0.5s forwards; 
    border-radius: 20px;
    max-width: 500px;
}

@keyframes popIn {
    to { transform: scale(1); }
}

/* Gagnant */
.win-theme {
    border-color: #00ff9d;
    box-shadow: 0 0 30px #00ff9d, inset 0 0 20px rgba(0, 255, 157, 0.2);
}

.win-theme h1 {
    color: #00ff9d;
    text-shadow: 0 0 20px #00ff9d;
    font-size: 3em;
    margin: 0;
    text-transform: uppercase;
}

.win-theme #endMessage {
    color: white;
    font-size: 1.5em;
    margin: 20px 0;
}

/* Perdant */
.lose-theme {
    border-color: #ff4757;
    box-shadow: 0 0 30px #ff4757, inset 0 0 20px rgba(255, 71, 87, 0.2);
}

.lose-theme h1 {
    color: #ff4757;
    text-shadow: 0 0 20px #ff4757;
    font-size: 3em;
    margin: 0;
    text-transform: uppercase;
}

.lose-theme #endMessage {
    color: #aaa;
    font-size: 1.5em;
    margin: 20px 0;
}

.btn-validate {
    display: inline-block;
    background: rgba(0, 255, 157, 0.2);
    color: white;
    border: 2px solid #00ff9d;
    padding: 15px 40px;
    font-size: 20px;
    font-weight: bold;
    cursor: pointer;
    margin-top: 30px;
    font-family: 'Courier New', monospace;
    text-transform: uppercase;
    transition: 0.3s;
    text-shadow: none;
}

.btn-validate:hover {
    background: #00ff9d;
    color: black;
    box-shadow: 0 0 20px #00ff9d;
}

.btn-reset {
    display: inline-block;
    background: rgba(255, 71, 87, 0.2);
    color: white;
    border: 2px solid #ff4757;
    padding: 15px 40px;
    font-size: 20px;
    font-weight: bold;
    cursor: pointer;
    margin-top: 30px;
    font-family: 'Courier New', monospace;
    text-transform: uppercase;
    transition: 0.3s;
    text-shadow: none;
}

.btn-reset:hover {
    background: #ff4757;
    color: white;
    box-shadow: 0 0 20px #ff4757;
}

