:root {
    --bg:     #070712;
    --panel:  #0d0d1f;
    --border: #1a1a3e;
    --accent: #00ffe7;
    --accent2:#ff00aa;
    --dim:    #3a3a6a;
    --text:   #c0c0e0;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    background: var(--bg);
    font-family: 'Share Tech Mono', monospace;
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    background-image:
        linear-gradient(rgba(0,255,231,0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0,255,231,0.03) 1px, transparent 1px);
    background-size: 40px 40px;
    pointer-events: none;
    z-index: 0;
}

h1 {
    font-family: 'Orbitron', monospace;
    font-weight: 900;
    font-size: 2.2rem;
    letter-spacing: 0.4em;
    color: var(--accent);
    text-shadow: 0 0 20px var(--accent), 0 0 40px var(--accent);
    margin-bottom: 20px;
    position: relative;
    z-index: 1;
}

/* ── Zone de jeu globale ── */
#game-area {
    display: flex;
    gap: 32px;
    align-items: flex-start;
    position: relative;
    z-index: 1;
}

/* ── Section locale ── */
#local-section {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

#app {
    display: flex;
    gap: 16px;
    align-items: flex-start;
}

/* ── Section adversaire ── */
#opponent-section {
    display: none;   /* masqué jusqu'à connexion duel */
    gap: 16px;
    align-items: flex-start;
}
#opponent-section.visible {
    display: flex;
}

.opponent-info-panel {
    width: 130px;
}

/* ── Panneaux ── */
.panel {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 14px;
    width: 130px;
    box-shadow: 0 0 20px rgba(0,255,231,0.05);
}

.panel-title {
    font-family: 'Orbitron', monospace;
    font-size: 0.6rem;
    letter-spacing: 0.2em;
    color: var(--accent);
    text-transform: uppercase;
    margin-bottom: 10px;
    text-align: center;
}

canvas { display: block; border-radius: 4px; }

#canvas-main {
    border: 1px solid var(--border);
    box-shadow: 0 0 30px rgba(0,255,231,0.08), inset 0 0 30px rgba(0,0,0,0.5);
}

#canvas-next, #canvas-hold {
    border: 1px solid var(--border);
    margin: 0 auto;
}

/* ── Canvas adversaire ── */
#canvas-opponent {
    border: 1px solid var(--accent2);
    box-shadow: 0 0 30px rgba(255,0,170,0.08), inset 0 0 30px rgba(0,0,0,0.5);
}

/* ── Score ── */
.score-block {
    margin-top: 14px;
    text-align: center;
}

.score-label {
    font-size: 0.55rem;
    letter-spacing: 0.2em;
    color: var(--dim);
    text-transform: uppercase;
    margin-bottom: 4px;
}

.score-value {
    font-family: 'Orbitron', monospace;
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--accent);
    text-shadow: 0 0 10px var(--accent);
}

/* ── Boutons ── */
.btn-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 14px;
}

button {
    font-family: 'Orbitron', monospace;
    font-size: 0.55rem;
    letter-spacing: 0.15em;
    font-weight: 700;
    text-transform: uppercase;
    padding: 10px 8px;
    border: 1px solid;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    background: transparent;
    width: 100%;
}

#btn-start  { 
    color: var(--accent);  
    border-color: var(--accent); 
}

#btn-start:hover:not(:disabled)  
{
    background: var(--accent);  
    color: var(--bg); 
    box-shadow: 0 0 15px var(--accent); 
}

#btn-restart {
    color: var(--accent2);  
    border-color: var(--accent2);
}

#btn-restart:hover:not(:disabled){
    background: var(--accent2);  
    color: var(--bg); 
    box-shadow: 0 0 15px var(--accent2); 
}

#btn-pause  {
     color: var(--accent2); 
     border-color: var(--accent2); 
}
#btn-pause:hover:not(:disabled)  {
    background: var(--accent2);
    color: var(--bg); box-shadow: 0 0 15px var(--accent2);
}

#btn-stop   { color: #ef4444;        border-color: #ef4444; }
#btn-stop:hover:not(:disabled)   { background: #ef4444;        color: var(--bg); box-shadow: 0 0 15px #ef4444; }

button:disabled { opacity: 0.3; cursor: not-allowed; }

/* ── Contrôles ── */
.controls-list {
    margin-top: 14px;
    font-size: 0.6rem;
    line-height: 2;
    color: var(--dim);
}
.controls-list span { color: var(--text); }

/* ── Overlays ── */
#main-wrapper,
#opponent-wrapper { position: relative; }

#overlay,
#overlay-opponent {
    display: none;
    position: absolute;
    top: 0; left: 0;
    width: 300px;
    height: 600px;
    background: rgba(7,7,18,0.88);
    border-radius: 4px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    z-index: 10;
    pointer-events: none;
}
#overlay.visible,
#overlay-opponent.visible { display: flex; }

#overlay-title {
    font-family: 'Orbitron', monospace;
    font-size: 1.4rem;
    font-weight: 900;
    letter-spacing: 0.2em;
    color: var(--accent2);
    text-shadow: 0 0 20px var(--accent2);
}

#overlay-score {
    font-family: 'Orbitron', monospace;
    font-size: 0.9rem;
    color: var(--accent);
}

#overlay-opponent-title {
    font-family: 'Orbitron', monospace;
    font-size: 1.4rem;
    font-weight: 900;
    letter-spacing: 0.2em;
    color: var(--accent);
    text-shadow: 0 0 20px var(--accent);
}

#overlay-opponent-score {
    font-family: 'Orbitron', monospace;
    font-size: 0.9rem;
    color: var(--accent2);
}

/* ── Panneau duel ── */
#duel-panel {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 12px 20px;
    margin-bottom: 14px;
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 14px;
    box-shadow: 0 0 20px rgba(255,0,170,0.04);
}

.duel-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

#input-room-code {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--accent2);
    font-family: 'Orbitron', monospace;
    font-size: 0.7rem;
    letter-spacing: 0.15em;
    padding: 6px 10px;
    width: 120px;
    text-transform: uppercase;
    outline: none;
    transition: border-color 0.2s;
}
#input-room-code:focus {
    border-color: var(--accent2);
    box-shadow: 0 0 8px rgba(255,0,170,0.2);
}

#btn-join-duel  { color: var(--accent2); border-color: var(--accent2); width: auto; padding: 6px 14px; }
#btn-join-duel:hover:not(:disabled) { background: var(--accent2); color: var(--bg); box-shadow: 0 0 12px var(--accent2); }

#btn-leave-duel { color: #ef4444; border-color: #ef4444; width: auto; padding: 6px 14px; }
#btn-leave-duel:hover:not(:disabled) { background: #ef4444; color: var(--bg); box-shadow: 0 0 12px #ef4444; }

#duel-status {
    font-size: 0.6rem;
    letter-spacing: 0.1em;
    color: var(--dim);
    min-width: 120px;
}
#duel-status.waiting { color: #f97316; }
#duel-status.ready   { color: var(--accent); }

/* ── Colonne gauche (panel + settings empilés) ── */
#left-column {
    display: flex;
    flex-direction: column;
    gap: 16px;
    width: 130px;
    flex-shrink: 0;
}

/* ── Settings Panel ── */
#settings-panel {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 14px;
    box-shadow: 0 0 20px rgba(0,255,231,0.05);
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 130px;
}

.settings-title {
    font-family: 'Orbitron', monospace;
    font-size: 0.6rem;
    letter-spacing: 0.2em;
    color: var(--accent);
    text-transform: uppercase;
    text-align: center;
    margin-bottom: 4px;
}

.settings-row {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 0.55rem;
    color: var(--dim);
    letter-spacing: 0.05em;
}

#settings-panel input[type="number"] {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--accent);
    font-family: 'Orbitron', monospace;
    font-size: 0.65rem;
    padding: 4px 8px;
    width: 100%;
    text-align: right;
    outline: none;
    transition: border-color 0.2s;
}

#settings-panel input[type="number"]:focus {
    border-color: var(--accent);
    box-shadow: 0 0 8px rgba(0,255,231,0.2);
}

#settings-panel input[type="number"]:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}
