:root {
    color-scheme: dark;
    --fond: #101923;
    --panneau: #17232e;
    --trait: #2c3e4b;
    --texte: #e7f1ec;
    --muted: #9eb2bc;
    --accent: #b6f178;
    font:
        15px/1.45 system-ui,
        sans-serif;
}
* {
    box-sizing: border-box;
}
body {
    margin: 0;
    background: var(--fond);
    color: var(--texte);
    height: 100dvh;
    overflow: hidden;
}
button,
input,
select {
    font: inherit;
}
button {
    cursor: pointer;
    border: 1px solid var(--trait);
    color: var(--texte);
    background: #202f3b;
    border-radius: 8px;
    padding: 9px 13px;
}
button:hover {
    background: #304453;
}
button:focus-visible,
input:focus-visible,
select:focus-visible,
.fin:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
}
button:disabled {
    opacity: 0.45;
    cursor: default;
}
.principal,
button[aria-pressed='true'] {
    background: var(--accent);
    color: #17291c;
    border-color: var(--accent);
}
header {
    height: 85px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 25px;
    border-bottom: 1px solid var(--trait);
}
.signature {
    font-size: 10px;
    letter-spacing: 0.18em;
    color: var(--accent);
}
h1 {
    font-size: 25px;
    letter-spacing: -0.04em;
    margin: 0;
    font-weight: 650;
}
h1 span {
    font-size: 13px;
    font-weight: 400;
    letter-spacing: 0;
    color: var(--muted);
    margin-left: 18px;
}
main {
    height: calc(100dvh - 85px);
    display: grid;
    grid-template-columns: minmax(0, 1fr) 310px;
}
.atelier {
    min-width: 0;
    min-height: 0;
    padding: 16px 24px 9px;
    display: flex;
    flex-direction: column;
    gap: 9px;
}
.commandes {
    display: flex;
    gap: 7px;
    align-items: center;
    flex-wrap: wrap;
}
.commandes #etat {
    font-size: 12px;
    color: var(--muted);
    margin-left: auto;
}
.scene {
    min-height: 80px;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: #0a1119;
    border: 1px solid var(--trait);
    border-radius: 10px;
}
canvas {
    display: block;
    touch-action: none;
    cursor: crosshair;
    image-rendering: pixelated;
}
.lecture {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: wrap;
}
.vues {
    display: flex;
    align-items: center;
    gap: 6px;
}
.vues button {
    padding: 6px 12px;
}
.vues label {
    font-size: 12px;
    display: flex;
    gap: 5px;
    align-items: center;
}
#legende {
    font-size: 11px;
    color: var(--muted);
}
.mesures {
    display: flex;
    gap: 32px;
    padding-top: 5px;
}
.mesures small {
    display: block;
    font-size: 9px;
    letter-spacing: 0.12em;
    color: var(--muted);
}
.mesures strong {
    font-size: 19px;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
}
#message {
    font-size: 12px;
    color: var(--muted);
    margin: 0;
    min-height: 34px;
}
aside {
    background: var(--panneau);
    overflow-y: auto;
    border-left: 1px solid var(--trait);
    padding: 3px 20px 24px;
    overscroll-behavior: contain;
}
aside section {
    padding: 15px 0;
    border-bottom: 1px solid var(--trait);
}
h2 {
    font-size: 11px;
    font-weight: 400;
    letter-spacing: 0.08em;
    color: var(--accent);
    margin: 0 0 12px;
}
h2 span {
    color: var(--texte);
    font-size: 16px;
    letter-spacing: 0;
    margin-left: 12px;
    font-weight: 550;
}
aside label {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    margin: 9px 0 5px;
    font-size: 12px;
}
aside label span {
    color: var(--muted);
    font-size: 10px;
}
input[type='number'] {
    width: 100%;
    border: 1px solid var(--trait);
    padding: 7px 9px;
    background: #101923;
    border-radius: 6px;
    color: var(--texte);
    font-variant-numeric: tabular-nums;
}
select {
    width: 100%;
    background: #101923;
    border: 1px solid var(--trait);
    color: var(--texte);
    padding: 8px;
    border-radius: 6px;
}
.aide {
    font-size: 11px;
    line-height: 1.5;
    color: var(--muted);
    margin: 9px 0;
}
.deux {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}
.deux button {
    font-size: 12px;
}
.pastille {
    font-size: 12px;
    color: var(--accent);
    background: #101923;
    padding: 8px;
    border-radius: 6px;
}
.fin {
    height: 27px;
    position: relative;
    cursor: ew-resize;
    touch-action: none;
    --position: 0%;
}
.fin:before {
    content: '';
    height: 3px;
    position: absolute;
    left: 0;
    right: 0;
    top: 12px;
    background: linear-gradient(
        to right,
        var(--accent) var(--position),
        var(--trait) var(--position)
    );
    border-radius: 5px;
}
.fin:after {
    content: '';
    width: 10px;
    height: 10px;
    background: var(--accent);
    position: absolute;
    top: 8px;
    left: clamp(0px, var(--position), calc(100% - 10px));
    border-radius: 50%;
}
aside section > button {
    margin: 5px 0;
    width: 100%;
    font-size: 12px;
}
a {
    color: var(--accent);
    display: block;
    font-size: 12px;
    margin-top: 12px;
    text-decoration: none;
}
footer {
    font-size: 10px;
    color: var(--muted);
    margin-top: 18px;
}
body.sans-panneau main {
    grid-template-columns: 1fr;
}
body.sans-panneau aside {
    display: none;
}
[hidden] {
    display: none !important;
}
@media (max-width: 700px) {
    header {
        height: 66px;
        padding: 9px 13px;
    }
    h1 {
        font-size: 22px;
    }
    h1 span {
        display: none;
    }
    main {
        height: calc(100dvh - 66px);
        grid-template-columns: 1fr;
        grid-template-rows: minmax(0, 1fr) min(37dvh, 330px);
    }
    aside {
        border-left: 0;
        border-top: 1px solid var(--trait);
        padding: 5px 17px 20px;
    }
    .atelier {
        padding: 8px 10px 5px;
        gap: 5px;
    }
    .commandes {
        gap: 4px;
    }
    .commandes button {
        font-size: 12px;
        padding: 7px 9px;
    }
    .commandes #etat {
        font-size: 10px;
    }
    .mesures {
        gap: 17px;
    }
    .mesures strong {
        font-size: 15px;
    }
    .mesures small {
        font-size: 8px;
    }
    #message {
        font-size: 10px;
        min-height: 28px;
    }
    .vues button {
        font-size: 11px;
        padding: 5px 8px;
    }
    #legende {
        font-size: 9px;
    }
    body.sans-panneau main {
        grid-template-rows: 1fr;
    }
    .lecture {
        gap: 3px;
    }
    .scene {
        min-height: 50px;
    }
}

/* Sur un téléphone tenu en paysage, les réglages restent à côté de la scène. */
@media (max-height: 550px) and (min-width: 540px) {
    header { height: 52px; padding: 5px 14px; }
    h1 { font-size: 20px; }
    main { height: calc(100dvh - 52px); grid-template-columns: minmax(0, 1fr) 250px; grid-template-rows: 1fr; }
    aside { border-top: 0; border-left: 1px solid var(--trait); }
    .atelier { padding: 5px 10px; gap: 3px; }
    .commandes button { padding: 5px 8px; font-size: 11px; }
    .mesures strong { font-size: 14px; }
    .mesures { gap: 15px; padding-top: 0; }
    #message { font-size: 10px; min-height: 0; }
    .vues button { padding: 4px 7px; font-size: 11px; }
}
