body {
    margin:0;
    background:#0000A8;
    font-family:"Courier New", monospace;
    font-size:18px;
    color:#FFF;
    overflow:hidden;
    user-select:none;
    box-sizing:border-box;
}

*, *::before, *::after {
    box-sizing:inherit;
}

/* Menu bar */
.menubar {
    background:#C0C0C0;
    border-bottom:2px solid #808080;
    color:#000;
    padding:4px 10px;
    display:flex;
    flex-wrap:wrap;
    gap:1.2rem;
    font-weight:bold;
}
.menubar span { cursor:pointer; }

.lang-toggle {
    margin-left:auto;
    display:flex;
    align-items:center;
    gap:6px;
}

.lang-btn {
    font-family:inherit;
    font-size:16px;
    font-weight:bold;
    color:#000;
    background:transparent;
    border:none;
    padding:0;
    cursor:pointer;
    text-decoration:none;
}

.lang-btn:hover {
    color:#111;
    text-decoration:underline;
    text-decoration-thickness:1px;
    text-underline-offset:2px;
}

.lang-btn.is-active {
    text-decoration:none;
}

.lang-sep {
    color:#000;
}

/* Fichier */
.filename {
    background:#000080;
    color:#FFF;
    text-align:right;
    padding:2px 8px;
    font-weight:bold;
}

/* Zone éditeur */
.editor {
    background:#0000A8;
    padding:8px;
    height:60vh;
    min-height:420px;
    overflow:hidden;
    white-space:pre;
    color:#FFFFFF;
    position:relative;
}
#codeArea {
    display:block;
    white-space:pre;
    overflow:auto;
}

/* Canvas du Maze */
#mazeCanvas {
    display:none;
    position:absolute;
    top:0; left:0;
    width:100%;
    height:100%;
    background:#000080;
}

/* Output */
.output {
    background:#000000;
    color:#00FF00;
    height:20vh;
    overflow:auto;
    padding:6px;
    border-top:2px solid #C0C0C0;
    font-size:16px;
    white-space:pre;
}

/* Barre statut */
.status {
    background:#C0C0C0;
    border-top:2px solid #808080;
    color:#000;
    padding:2px 6px;
    font-size:14px;
}

/* Popup About */
.popup {
    position:absolute;
    top:50%;
    left:50%;
    width:350px;
    max-width:calc(100vw - 32px);
    transform:translate(-50%, -50%);
    background:#C0C0C0;
    border:3px double #FFFFFF;
    box-shadow:6px 6px 0px #000000;
    display:none;
    text-align:center;
    color:#000;
    padding-bottom:12px;
    z-index:10;
}
.popup h3 {
    background:#000080;
    color:#FFFFFF;
    padding:4px;
    margin:0;
    font-size:18px;
}
.ok {
    background:#00FF00;
    color:#000;
    margin-top:20px;
    padding:4px 12px;
    display:inline-block;
    cursor:pointer;
    font-weight:bold;
}

.modal-overlay {
    position:fixed;
    inset:0;
    background:rgba(0,0,0,0.55);
    display:none;
    align-items:center;
    justify-content:center;
    padding:16px;
    z-index:50;
}

.modal-window {
    width:min(92vw, 560px);
    max-height:min(88vh, 760px);
    overflow:auto;
    background:#C0C0C0;
    border:3px double #FFFFFF;
    box-shadow:8px 8px 0px #000000;
    color:#000;
}

.modal-header {
    display:flex;
    justify-content:space-between;
    align-items:center;
    background:#000080;
    color:#FFFFFF;
    padding:6px 10px;
    font-weight:bold;
}

.modal-close {
    appearance:none;
    border:2px solid #000;
    background:#C0C0C0;
    color:#000;
    font:inherit;
    font-weight:bold;
    width:30px;
    height:24px;
    cursor:pointer;
}

.modal-body {
    padding:14px;
}

.modal-intro {
    margin:0 0 12px;
    font-weight:bold;
}

.contact-form {
    display:flex;
    flex-direction:column;
    gap:10px;
    width:100%;
}

.contact-form label {
    font-weight:bold;
}

.contact-form input,
.contact-form textarea,
.contact-form button {
    font-family:inherit;
    font-size:16px;
    border:2px solid #000;
    padding:8px;
    width:100%;
}

.contact-form textarea {
    min-height:140px;
    resize:vertical;
}

.turnstile-slot {
    display:flex;
    justify-content:center;
    width:100%;
    min-height:65px;
}

.contact-form button {
    background:var(--vga-yellow);
    cursor:pointer;
    font-weight:bold;
}

.contact-form button:hover {
    background:var(--vga-lightcyan);
}

/* Fenêtre BGI simulée */
#mazeCanvas {
    display:none;
    position:absolute;
    top:0;
    left:0;
    width:100%;
    height:100%;
    background:#000080; /* VGA 13h bleu */
    border:4px solid #C0C0C0; /* Bordure grise BGI */
    box-shadow:4px 4px 0px #000; /* Style fenêtre rétro */
    image-rendering:pixelated;
}

/* Palette CGA / VGA 16 couleurs */
:root{
    --vga-black:#000000;
    --vga-blue:#0000AA;
    --vga-green:#00AA00;
    --vga-cyan:#00AAAA;
    --vga-red:#AA0000;
    --vga-magenta:#AA00AA;
    --vga-brown:#AA5500;
    --vga-lightgrey:#AAAAAA;
    --vga-darkgrey:#555555;
    --vga-lightblue:#5555FF;
    --vga-lightgreen:#55FF55;
    --vga-lightcyan:#55FFFF;
    --vga-lightred:#FF5555;
    --vga-lightmagenta:#FF55FF;
    --vga-yellow:#FFFF55;
    --vga-white:#FFFFFF;
}

.editor{
    background:var(--vga-blue);
    color:var(--vga-white);
}

.output{
    background:var(--vga-black);
    color:var(--vga-lightgreen);
}


/* Curseur DOS */
#codeArea::after {
    content: "█";
    animation: blink 0.8s steps(1) infinite;
    margin-left: 4px;
}
@keyframes blink {
    50% { opacity: 0; }
}

/* Liens visibles dans l'éditeur façon CRT / DOS */
.editor a {
    color: var(--vga-yellow);
    font-weight: bold;
    text-decoration: underline;
    cursor: pointer;
}

.editor a:hover {
    color: var(--vga-lightcyan);
    background: var(--vga-darkgrey);
}

.menu-highlight {
    color: var(--vga-yellow);
    font-weight: bold;
}

.editor form {
    display:flex;
    flex-direction:column;
    gap:10px;
    max-width:420px;
    margin:12px auto 0;
    width:min(100%, 420px);
    white-space:normal;
    text-align:left;
}

.editor input,
.editor textarea,
.editor button {
    font-family:inherit;
    font-size:16px;
    border:2px solid #000;
    padding:8px;
}

.editor textarea {
    min-height:120px;
    resize:vertical;
}

.editor label {
    font-weight:bold;
}

.turnstile-slot {
    display:flex;
    justify-content:center;
    width:100%;
}

.editor button {
    background:var(--vga-yellow);
    cursor:pointer;
    font-weight:bold;
}

.editor button:hover {
    background:var(--vga-lightcyan);
}

.contact {
    background: var(--vga-lightcyan);
    color:#000;
    margin-top:10px;
    padding:4px 12px;
    display:inline-block;
    cursor:pointer;
    font-weight:bold;
    border:2px solid #000;
}
.contact:hover {
    background: var(--vga-yellow);
    color:#000;
}

@media (max-width: 700px) {
    body {
        overflow:auto;
        font-size:16px;
    }

    .menubar {
        gap:0.6rem;
        padding:6px 8px;
        font-size:14px;
    }

    .lang-toggle {
        width:100%;
        justify-content:flex-end;
    }

    .lang-btn {
        font-size:14px;
    }

    .filename {
        text-align:left;
        font-size:14px;
        word-break:break-word;
    }

    .editor {
        height:auto;
        min-height:52vh;
    }

    #codeArea {
        white-space:pre-wrap;
        word-break:break-word;
    }

    .output {
        height:20vh;
        font-size:14px;
    }

    .popup {
        width:calc(100vw - 20px);
        padding-bottom:10px;
    }

    .popup h3 {
        font-size:16px;
    }

    .modal-overlay {
        padding:8px;
    }

    .modal-window {
        width:calc(100vw - 16px);
        max-height:calc(100vh - 16px);
    }

    .modal-body {
        padding:12px;
    }

    .contact-form input,
    .contact-form textarea,
    .contact-form button {
        font-size:15px;
    }
}
