:root {
    --encre: #05192b;
    --encre-panneau: #0b2942;
    --encre-relief: #123b5c;
    --trait: rgba(150, 197, 232, .2);
    --trait-fort: rgba(150, 197, 232, .4);
    --texte: #e2eefa;
    --texte-faible: #8dacc6;
    --craie: #cfe6f8;
    --laiton: #e0a53d;
    --faible: #e4695a;
    --moyen: #e0a53d;
    --bon: #63bde0;
    --fort: #4fcf9e;
    --excellent: #7ef0c2;
    --rayon: 3px;
    --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
    --sans: "IBM Plex Sans", system-ui, -apple-system, sans-serif;
    --etroit: "IBM Plex Sans Condensed", "IBM Plex Sans", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    min-height: 100vh;
    background: linear-gradient(180deg, #06203a, var(--encre) 60%, #041423) fixed, var(--encre);
    color: var(--texte);
    font-family: var(--sans);
    font-size: 14px;
    line-height: 1.4;
    padding: 0 clamp(12px, 3vw, 28px) 32px;
}

.cache {
    position: absolute;
    width: 1px; height: 1px;
    overflow: hidden; clip-path: inset(50%);
}

/* ---------- Bandeau ---------- */

.bandeau {
    max-width: 980px;
    margin: 0 auto;
    padding: 18px 0 14px;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    justify-content: space-between;
}

.marque {
    display: flex;
    align-items: center;
    gap: 9px;
    font-family: var(--etroit);
    font-weight: 600;
    letter-spacing: .1em;
    text-transform: uppercase;
    font-size: 12px;
    color: var(--texte-faible);
}

.marque-signe {
    width: 13px; height: 13px;
    border: 1px solid var(--laiton);
    background: repeating-linear-gradient(135deg, var(--laiton) 0 1px, transparent 1px 4px);
}

/* ---------- Segments ---------- */

.segment {
    display: inline-flex;
    border: 1px solid var(--trait);
    border-radius: var(--rayon);
    overflow: hidden;
    background: rgba(3, 17, 30, .55);
}

.segment button {
    appearance: none;
    border: 0;
    border-right: 1px solid var(--trait);
    background: transparent;
    color: var(--texte-faible);
    font-family: var(--etroit);
    font-weight: 600;
    letter-spacing: .06em;
    text-transform: uppercase;
    cursor: pointer;
    padding: 7px 15px;
    font-size: 11px;
    transition: background .15s, color .15s;
}

.segment button:last-child { border-right: 0; }
.segment button:hover { color: var(--texte); }

.segment button.actif {
    background: var(--encre-relief);
    color: var(--craie);
    box-shadow: inset 0 -2px 0 var(--laiton);
}

.segment-mini button { padding: 4px 9px; font-size: 10px; }

/* ---------- Planche ---------- */

.atelier { max-width: 980px; margin: 0 auto; }

.planche {
    position: relative;
    border: 1px solid var(--trait);
    border-radius: var(--rayon);
    background:
        repeating-linear-gradient(0deg, rgba(150, 197, 232, .045) 0 1px, transparent 1px 20px),
        repeating-linear-gradient(90deg, rgba(150, 197, 232, .045) 0 1px, transparent 1px 20px),
        linear-gradient(180deg, var(--encre-panneau), #08243b);
    padding: 16px 18px 14px;
}

.planche-haut {
    display: flex;
    align-items: flex-start;
    gap: 18px;
    margin-bottom: 14px;
}

.sortie {
    flex: 1;
    display: block;
    font-family: var(--mono);
    font-size: clamp(16px, 2.4vw, 26px);
    font-weight: 500;
    line-height: 1.3;
    word-break: break-all;
    min-height: 1.3em;
    color: var(--craie);
    transition: opacity .15s;
}

.sortie.perime { opacity: .3; }
.sortie .c-chiffre { color: var(--laiton); }
.sortie .c-symbole { color: var(--bon); }
.sortie .c-sep { color: rgba(141, 172, 198, .5); }

@media (prefers-reduced-motion: no-preference) {
    .sortie span { animation: apparition .24s both; animation-delay: calc(var(--i) * 8ms); }
}

@keyframes apparition {
    from { opacity: 0; transform: translateY(-3px); }
    to { opacity: 1; transform: none; }
}

.jauge { flex: none; text-align: right; }

.jauge-bits {
    margin: 0;
    font-family: var(--mono);
    font-size: 11px;
    color: var(--texte-faible);
}

.jauge-bits b {
    font-size: 22px;
    font-weight: 600;
    color: var(--texte);
    margin-right: 3px;
}

.jauge-verdict {
    margin: 1px 0 0;
    font-family: var(--etroit);
    text-transform: uppercase;
    letter-spacing: .12em;
    font-weight: 600;
    font-size: 11px;
    color: var(--texte-faible);
}

.jauge[data-force="weak"] .jauge-verdict { color: var(--faible); }
.jauge[data-force="fair"] .jauge-verdict { color: var(--moyen); }
.jauge[data-force="good"] .jauge-verdict { color: var(--bon); }
.jauge[data-force="strong"] .jauge-verdict { color: var(--fort); }
.jauge[data-force="elite"] .jauge-verdict { color: var(--excellent); }

/* ---------- Règle graduée ---------- */

.regle {
    position: relative;
    height: 5px;
    border: 1px solid var(--trait);
    background: rgba(3, 17, 30, .6);
    margin-bottom: 20px;
}

.regle-remplissage {
    position: absolute;
    inset: 0 auto 0 0;
    width: 0;
    background: var(--laiton);
    transition: width .28s ease, background .28s ease;
}

.regle-tick {
    position: absolute;
    top: 7px;
    transform: translateX(-50%);
    font-family: var(--mono);
    font-size: 9px;
    color: rgba(141, 172, 198, .65);
}

.regle-tick i {
    position: absolute;
    left: 50%;
    top: -8px;
    width: 1px; height: 7px;
    background: var(--trait-fort);
}

/* ---------- Actions ---------- */

.actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.bouton {
    appearance: none;
    cursor: pointer;
    font-family: var(--etroit);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .08em;
    font-size: 11px;
    padding: 9px 18px;
    border-radius: var(--rayon);
    border: 1px solid var(--trait-fort);
    background: transparent;
    color: var(--texte);
    transition: background .15s, border-color .15s;
}

.bouton:hover { background: rgba(150, 197, 232, .1); }

.bouton-primaire {
    background: var(--laiton);
    border-color: var(--laiton);
    color: #16232e;
}

.bouton-primaire:hover { background: #eeb552; border-color: #eeb552; }

.detail {
    font-family: var(--mono);
    font-size: 11px;
    color: rgba(141, 172, 198, .8);
    margin-left: auto;
    text-align: right;
}

/* ---------- Lot et alerte ---------- */

.lot {
    list-style: none;
    margin: 14px 0 0;
    padding: 12px 0 0;
    border-top: 1px solid var(--trait);
    display: grid;
    gap: 1px;
}

.lot li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 5px 6px;
    font-family: var(--mono);
    font-size: 12px;
    word-break: break-all;
    border-radius: var(--rayon);
}

.lot li:hover { background: rgba(150, 197, 232, .07); }

.lot button {
    flex: none;
    appearance: none;
    border: 1px solid var(--trait);
    background: transparent;
    color: var(--texte-faible);
    font-family: var(--etroit);
    text-transform: uppercase;
    letter-spacing: .08em;
    font-size: 10px;
    padding: 3px 8px;
    border-radius: var(--rayon);
    cursor: pointer;
}

.lot button:hover { color: var(--texte); border-color: var(--trait-fort); }

.alerte {
    margin: 12px 0 0;
    padding: 8px 10px;
    border-left: 2px solid var(--faible);
    background: rgba(228, 105, 90, .1);
    font-size: 12.5px;
    color: #f5c3bb;
}

.alerte[data-type="avis"] {
    border-left-color: var(--laiton);
    background: rgba(224, 165, 61, .08);
    color: #f0d9a8;
}

/* ---------- Réglages ---------- */

.panneau {
    margin-top: 16px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    align-items: start;
}

.colonne { display: grid; gap: 14px; align-content: start; }

.bloc {
    border: 1px solid var(--trait);
    border-radius: var(--rayon);
    background: rgba(11, 41, 66, .5);
    padding: 11px 14px 12px;
}

.bloc h2 {
    margin: 0 0 4px;
    font-family: var(--etroit);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--texte-faible);
}

.ligne {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 34px;
    border-bottom: 1px solid rgba(150, 197, 232, .08);
}

.ligne:last-of-type { border-bottom: 0; }
.ligne[hidden] { display: none; }

.nom {
    flex: 1;
    font-size: 13.5px;
    cursor: pointer;
    min-width: 0;
}

.nom em {
    font-style: normal;
    font-family: var(--mono);
    font-size: 10.5px;
    color: rgba(141, 172, 198, .75);
    margin-left: 5px;
}

/* Bascules */

.bascule {
    flex: none;
    appearance: none;
    width: 34px; height: 19px;
    border-radius: 10px;
    border: 1px solid var(--trait);
    background: rgba(3, 17, 30, .7);
    position: relative;
    cursor: pointer;
    transition: background .16s, border-color .16s;
}

.bascule::after {
    content: "";
    position: absolute;
    top: 2px; left: 2px;
    width: 13px; height: 13px;
    border-radius: 50%;
    background: var(--texte-faible);
    transition: transform .16s, background .16s;
}

.bascule[aria-checked="true"] {
    background: rgba(224, 165, 61, .26);
    border-color: var(--laiton);
}

.bascule[aria-checked="true"]::after { transform: translateX(15px); background: var(--laiton); }

/* Compteurs et champs */

.compteur {
    flex: none;
    display: inline-flex;
    border: 1px solid var(--trait);
    border-radius: var(--rayon);
    overflow: hidden;
}

.compteur button {
    appearance: none;
    border: 0;
    background: transparent;
    color: var(--texte-faible);
    width: 24px;
    font-size: 14px;
    cursor: pointer;
    line-height: 1;
}

.compteur button:hover { background: rgba(150, 197, 232, .12); color: var(--texte); }

.compteur input {
    width: 40px;
    border: 0;
    border-left: 1px solid var(--trait);
    border-right: 1px solid var(--trait);
    background: rgba(3, 17, 30, .6);
    color: var(--texte);
    font-family: var(--mono);
    font-size: 12px;
    text-align: center;
    padding: 5px 2px;
}

.valeur {
    flex: none;
    width: 88px;
    border: 1px solid var(--trait);
    border-radius: var(--rayon);
    background: rgba(3, 17, 30, .6);
    color: var(--texte);
    font-family: var(--mono);
    font-size: 12px;
    padding: 6px 8px;
    text-align: right;
}

select.valeur { text-align: left; text-align-last: right; }

.champ {
    display: block;
    width: 100%;
    margin-top: 8px;
    border: 1px solid var(--trait);
    border-radius: var(--rayon);
    background: rgba(3, 17, 30, .6);
    color: var(--texte);
    font-family: var(--mono);
    font-size: 12px;
    padding: 7px 9px;
}

.champ[hidden] { display: none; }
.champ::placeholder { color: rgba(141, 172, 198, .45); }

.glissiere {
    appearance: none;
    width: 100%;
    height: 3px;
    margin: 8px 0 4px;
    background: var(--trait);
    border-radius: 2px;
    cursor: pointer;
}

.glissiere::-webkit-slider-thumb {
    appearance: none;
    width: 14px; height: 14px;
    border-radius: 50%;
    background: var(--laiton);
    border: 2px solid #0b2942;
}

.glissiere::-moz-range-thumb {
    width: 12px; height: 12px;
    border: 2px solid #0b2942;
    border-radius: 50%;
    background: var(--laiton);
}

.mention {
    margin: 0 0 2px;
    font-family: var(--mono);
    font-size: 10.5px;
    color: rgba(141, 172, 198, .8);
}

/* ---------- Pied ---------- */

.pied {
    max-width: 980px;
    margin: 22px auto 0;
    font-size: 11.5px;
    line-height: 1.6;
    color: rgba(141, 172, 198, .75);
}

.pied code { font-family: var(--mono); color: var(--craie); }

/* ---------- Divers ---------- */

:focus-visible { outline: 2px solid var(--laiton); outline-offset: 2px; }

input[type="number"] { -moz-appearance: textfield; }
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

@media (max-width: 700px) {
    .panneau { grid-template-columns: 1fr; }
    .segment-modes { width: 100%; }
    .segment-modes button { flex: 1; }
    .planche-haut { flex-direction: column; gap: 10px; }
    .jauge { text-align: left; display: flex; align-items: baseline; gap: 10px; }
    .jauge-verdict { margin: 0; }
    .detail { margin-left: 0; flex-basis: 100%; text-align: left; }
}
