/* =========================================================================
   Vote AIMS - feuille de style unique (aucune dependance, aucun build)

   Charte AIMS Senegal : rouge brique officiel, noir du logo, or reserve a
   l'annonce de l'elu(e). Pour adapter aux couleurs d'un autre centre,
   modifiez les variables ci-dessous : tout le site suit.

   Tous les noms de classes de la version precedente sont conserves : cette
   feuille remplace public/css/aims.css sans toucher aux gabarits Blade.
   Les composants ajoutes sont signales par la mention [nouveau].
   ========================================================================= */

/* ------------------------------------------------------------- Polices
   Source Sans 3 pour l'interface (proche parente du Myriad du logo AIMS),
   Source Serif 4 pour les grands titres. Fichiers auto-heberges dans
   /fonts : le site reste identique sans connexion a Internet. */

@font-face {
    font-family: "Source Sans 3";
    font-style: normal;
    font-weight: 200 900;
    font-display: swap;
    src: url("../fonts/source-sans-3-latin-wght-normal.woff2") format("woff2");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
    font-family: "Source Sans 3";
    font-style: normal;
    font-weight: 200 900;
    font-display: swap;
    src: url("../fonts/source-sans-3-latin-ext-wght-normal.woff2") format("woff2");
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
    font-family: "Source Sans 3";
    font-style: italic;
    font-weight: 200 900;
    font-display: swap;
    src: url("../fonts/source-sans-3-latin-wght-italic.woff2") format("woff2");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
    font-family: "Source Serif 4";
    font-style: normal;
    font-weight: 200 900;
    font-display: swap;
    src: url("../fonts/source-serif-4-latin-wght-normal.woff2") format("woff2");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
    font-family: "Source Serif 4";
    font-style: normal;
    font-weight: 200 900;
    font-display: swap;
    src: url("../fonts/source-serif-4-latin-ext-wght-normal.woff2") format("woff2");
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* ------------------------------------------------------------ Variables */

:root {
    /* Rouge brique officiel AIMS : valeur du template Beamer de l'institut
       (\definecolor{aimscolour}{rgb}{0.54,0.11,0.01} = #8A1C03), confirmee
       par echantillonnage du logo (#8A1E04). */
    --brand-900: #2b0a01;
    --brand-800: #511002;
    --brand-700: #6d1603;
    --brand: #8a1c03;
    --brand-400: #b8441f;
    --brand-200: #e8c6ba;
    --brand-100: #f9ebe6;
    --brand-50: #fdf6f3;

    /* Or : reserve a l'elu(e) et, sur le videoprojecteur, au candidat de tete. */
    --accent: #c98a14;
    --accent-soft: #efcb7e;
    --accent-ink: #7a5200;
    --accent-wash: #fdf5e1;

    /* Etats : couleurs universelles, independantes de la marque. */
    --ok: #17794a;
    --ok-wash: #e7f4ec;
    --danger: #b3261e;
    --danger-wash: #fdecea;

    /* Noir du logo AIMS et neutres. */
    --ink: #231f20;
    --ink-2: #453e3f;
    --muted: #6c6462;
    --faint: #958c89;
    --line: #e6e2df;
    --line-strong: #cfc8c4;
    --bg: #f6f5f4;
    --sunken: #f1efed;
    --card: #ffffff;

    /* Fond de la vue videoprojecteur. */
    --night: #1c1314;

    --radius: 14px;
    --radius-sm: 10px;
    --radius-xs: 6px;
    --shadow: 0 1px 2px rgba(35, 31, 32, .05);
    --shadow-lg: 0 1px 2px rgba(35, 31, 32, .05), 0 18px 40px -18px rgba(35, 31, 32, .28);
    --focus: 0 0 0 3px rgba(138, 28, 3, .22);

    --font: "Source Sans 3", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto,
    "Helvetica Neue", Arial, "Noto Sans", sans-serif;
    --font-display: "Source Serif 4", "Iowan Old Style", "Palatino Linotype", Palatino,
    Georgia, serif;
    --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;

    /* Mouvement : appui bref, retours rapides. */
    --press: 100ms;
    --feedback: 180ms;
    --reveal: 360ms;
    --ease: cubic-bezier(.22, .68, .3, 1);
    --bounce: var(--ease);
}

/* ----------------------------------------------------------------- Base */

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

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    font-family: var(--font);
    font-size: 1.0625rem;
    line-height: 1.55;
    color: var(--ink);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

a {
    color: var(--brand);
    text-decoration: none;
    text-underline-offset: .18em;
}

a:hover {
    text-decoration: underline;
}

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

h1, h2, h3, h4 {
    margin: 0 0 .4em;
    line-height: 1.2;
    font-weight: 600;
    text-wrap: balance;
}

/* Les grands titres portent le serif ; les titres de carte restent en sans
   pour ne pas concurrencer les chiffres. */
h1 {
    font-family: var(--font-display);
    font-size: clamp(1.75rem, 1.3rem + 1.9vw, 2.5rem);
    line-height: 1.12;
    letter-spacing: -.015em;
}

h2 {
    font-size: 1.22rem;
    letter-spacing: -.005em;
}

h3 {
    font-size: 1.06rem;
}

p {
    margin: 0 0 1em;
}

img {
    max-width: 100%;
    display: block;
}

/* ---------------------------------------------------------------- Entete */

/* Le logo AIMS est brique et noir sur blanc : l'entete reste claire, sous
   un filet brique plein, comme un papier a en-tete. */
.topbar {
    background: var(--card);
    color: var(--ink);
    position: relative;
    border-top: 3px solid var(--brand);
    border-bottom: 1px solid var(--line);
}

.topbar-inner {
    max-width: 1120px;
    margin: 0 auto;
    padding: .8rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.brand {
    display: flex;
    align-items: center;
    gap: .85rem;
    color: var(--ink);
    min-width: 0;
}

.brand:hover {
    text-decoration: none;
}

/* Logo officiel : lockup horizontal. */
.brand-logo {
    height: 40px;
    width: auto;
    flex: none;
}

/* Repli quand aucun logo n'est configure : pastille aux initiales. */
.brand-mark {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    background: var(--brand);
    color: #fff;
    display: grid;
    place-items: center;
    font-weight: 700;
    font-size: .85rem;
    letter-spacing: .02em;
    flex: none;
    overflow: hidden;
}

.brand-text {
    min-width: 0;
}

.brand-name {
    font-weight: 700;
    font-size: 1rem;
    color: var(--ink);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.brand-sub {
    font-size: .86rem;
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Quand le logo porte deja le nom de l'institut, on n'affiche que la baseline. */
.brand-logo + .brand-text .brand-name {
    display: none;
}

.brand-logo + .brand-text .brand-sub {
    display: block;
    padding-left: .85rem;
    border-left: 1px solid var(--line-strong);
    line-height: 1.25;
    max-width: 15rem;
    white-space: normal;
}

.nav {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: .25rem;
    flex-wrap: wrap;
}

.nav a,
.nav button {
    color: var(--ink-2);
    font: inherit;
    font-size: .95rem;
    font-weight: 600;
    padding: .45rem .8rem;
    border-radius: 8px;
    border: 0;
    background: none;
    cursor: pointer;
    transition: background var(--feedback) ease-out, color var(--feedback) ease-out;
}

.nav a:hover,
.nav button:hover {
    background: var(--sunken);
    color: var(--ink);
    text-decoration: none;
}

.nav a.is-active {
    background: var(--brand-100);
    color: var(--brand-800);
}

/* --------------------------------------------------------------- Gabarit */

.container {
    max-width: 1120px;
    margin: 0 auto;
    padding: 2rem 1.25rem 4rem;
}

.container-narrow {
    max-width: 660px;
}

.page-head {
    margin-bottom: 1.6rem;
}

.page-head h1 {
    margin-bottom: .35rem;
}

.page-head .lead {
    color: var(--muted);
    font-size: 1.1rem;
    margin: 0;
    max-width: 62ch;
}

/* Surtitre : casse normale, pas de capitales espacees. */
.eyebrow {
    font-size: .92rem;
    font-weight: 600;
    color: var(--brand);
    margin: 0 0 .3rem;
}

.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.5rem;
}

.card + .card {
    margin-top: 1.1rem;
}

/* Dans une grille, l'espacement est gere par gap : sans cette regle, la
   deuxieme carte d'une rangee serait decalee vers le bas. */
.grid > .card + .card,
.grid .card + .card,
.split > .card + .card {
    margin-top: 0;
}

.card-flush {
    padding: 0;
    overflow: hidden;
}

.card-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: .4rem 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.1rem;
}

.card-head h2,
.card-head h3 {
    margin: 0;
}

/* [nouveau] sous-titre d'une carte : dit ce que mesure le graphique. */
.card-sub {
    margin: .15rem 0 0;
    font-size: .92rem;
    color: var(--muted);
}

.grid {
    display: grid;
    gap: 1.1rem;
}

.grid-2 {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.grid-3 {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

/* [nouveau] deux colonnes inegales pour le tableau de bord des resultats. */
.split {
    display: grid;
    gap: 1.1rem;
    grid-template-columns: minmax(0, 5fr) minmax(0, 8fr);
    align-items: stretch;
    margin-top: 1.1rem;
}

.split-rev {
    grid-template-columns: minmax(0, 8fr) minmax(0, 5fr);
}

.split + .card,
.card + .split {
    margin-top: 1.1rem;
}

.row {
    display: flex;
    gap: .6rem;
    flex-wrap: wrap;
    align-items: center;
}

.row-end {
    justify-content: flex-end;
}

.spacer {
    margin-left: auto;
}

.muted {
    color: var(--muted);
}

.small {
    font-size: .92rem;
}

.mono {
    font-family: var(--font-mono);
    font-size: .92em;
}

.center {
    text-align: center;
}

hr.sep {
    border: 0;
    border-top: 1px solid var(--line);
    margin: 1.4rem 0;
}

/* --------------------------------------------------------------- Boutons */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    font-family: var(--font);
    font-weight: 600;
    font-size: 1rem;
    line-height: 1.2;
    padding: .7rem 1.2rem;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    background: var(--brand);
    color: #fff;
    cursor: pointer;
    transition: transform var(--press) ease, box-shadow var(--feedback) ease-out,
    background var(--feedback) ease-out, border-color var(--feedback) ease-out;
    text-align: center;
}

.btn:hover {
    background: var(--brand-700);
    text-decoration: none;
}

.btn:active {
    transform: translateY(1px);
}

.btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px var(--card), 0 0 0 4px var(--brand);
}

.btn:disabled,
.btn[aria-disabled="true"] {
    opacity: .45;
    cursor: not-allowed;
    transform: none;
}

.btn-accent {
    background: var(--accent);
    color: #2e2000;
}

.btn-accent:hover {
    background: #b77c0e;
}

.btn-ghost {
    background: var(--card);
    color: var(--ink);
    border-color: var(--line-strong);
}

.btn-ghost:hover {
    background: var(--sunken);
    border-color: var(--faint);
}

.btn-danger {
    background: var(--card);
    color: var(--danger);
    border-color: rgba(179, 38, 30, .35);
}

.btn-danger:hover {
    background: var(--danger-wash);
}

.btn-sm {
    padding: .45rem .8rem;
    font-size: .92rem;
    border-radius: 8px;
}

.btn-lg {
    padding: .9rem 1.6rem;
    font-size: 1.08rem;
}

.btn-block {
    width: 100%;
}

/* ------------------------------------------------------------ Formulaires */

.field {
    margin-bottom: 1.1rem;
}

.label {
    display: block;
    font-weight: 600;
    font-size: .95rem;
    margin-bottom: .35rem;
}

.input,
.select,
.textarea {
    width: 100%;
    font: inherit;
    color: var(--ink);
    padding: .7rem .85rem;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    background: var(--card);
    transition: border-color var(--feedback) ease-out, box-shadow var(--feedback) ease-out;
}

.input::placeholder,
.textarea::placeholder {
    color: var(--faint);
}

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

.input:focus,
.select:focus,
.textarea:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: var(--focus);
}

.input[readonly] {
    background: var(--sunken);
}

.input.has-error,
.select.has-error {
    background: var(--card);
    border-color: var(--danger);
    box-shadow: 0 0 0 3px rgba(179, 38, 30, .12);
}

.input[type="file"] {
    padding: .5rem;
    font-size: .95rem;
    color: var(--muted);
}

.input[type="file"]::file-selector-button {
    font: inherit;
    font-weight: 600;
    margin-right: .8rem;
    padding: .4rem .8rem;
    border-radius: 7px;
    border: 1px solid var(--line-strong);
    background: var(--card);
    color: var(--ink);
    cursor: pointer;
}

.help {
    font-size: .9rem;
    color: var(--muted);
    margin-top: .35rem;
}

.error {
    font-size: .92rem;
    color: var(--danger);
    margin-top: .35rem;
    font-weight: 600;
}

.check {
    display: flex;
    align-items: flex-start;
    gap: .6rem;
    font-size: .98rem;
    cursor: pointer;
}

.check input {
    width: 18px;
    height: 18px;
    margin-top: 3px;
    accent-color: var(--brand);
    flex: none;
}

/* Code du scrutin : six caracteres a recopier, donc larges et espaces. */
.code-input {
    text-align: center;
    font-size: 1.7rem;
    line-height: 1.2;
    letter-spacing: .32em;
    text-indent: .32em;
    text-transform: uppercase;
    font-weight: 700;
    padding: .7rem .6rem;
    font-variant-numeric: tabular-nums lining-nums;
}

.code-input[readonly] {
    background: var(--card);
}

/* --------------------------------------------------------------- Alertes */

.alert {
    border-radius: var(--radius-sm);
    padding: .8rem 1rem;
    margin-bottom: 1.1rem;
    border: 1px solid;
    border-left-width: 4px;
    font-size: .98rem;
}

/* Les etats gardent leurs couleurs universelles : la brique est la couleur
   de marque, pas un signal de reussite ou d'erreur. */
.alert-success {
    background: var(--ok-wash);
    border-color: #b9dcc8;
    border-left-color: var(--ok);
    color: #0f4f31;
}

.alert-error {
    background: var(--danger-wash);
    border-color: #f1c4c0;
    border-left-color: var(--danger);
    color: #7f1a15;
}

.alert-info {
    background: var(--accent-wash);
    border-color: #ecd9a8;
    border-left-color: var(--accent);
    color: #5c4000;
}

.alert ul {
    margin: .4rem 0 0;
    padding-left: 1.1rem;
}

/* --------------------------------------------------------------- Badges */

.badge {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    font-size: .84rem;
    font-weight: 600;
    line-height: 1.3;
    padding: .2rem .6rem;
    border-radius: var(--radius-xs);
    background: var(--sunken);
    color: var(--ink-2);
    white-space: nowrap;
}

/* Les badges d'etat portent une pastille : l'etat ne repose pas sur la
   seule couleur. */
.badge-open,
.badge-draft,
.badge-closed {
    background: var(--card);
    box-shadow: inset 0 0 0 1px var(--line-strong);
    color: var(--ink);
}

.badge-open::before,
.badge-draft::before,
.badge-closed::before {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex: none;
}

.badge-open::before {
    background: #1e9e5c;
}

.badge-draft::before {
    background: transparent;
    box-shadow: inset 0 0 0 2px var(--faint);
}

.badge-closed::before {
    background: var(--ink);
    border-radius: 2px;
}

.badge-accent {
    background: var(--accent-wash);
    color: var(--accent-ink);
}

.code-pill {
    display: inline-flex;
    align-items: baseline;
    gap: .6rem;
    background: var(--ink);
    color: #fff;
    border-radius: var(--radius-sm);
    padding: .55rem 1rem .55rem .9rem;
    font-weight: 700;
    font-size: 1.5rem;
    line-height: 1.2;
    letter-spacing: .2em;
    font-family: var(--font);
    font-variant-numeric: tabular-nums lining-nums;
}

.code-pill small {
    font-size: .82rem;
    letter-spacing: 0;
    opacity: .7;
    font-weight: 600;
}

/* --------------------------------------------------------- Point "direct" */

.live-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #1e9e5c;
    display: inline-block;
    box-shadow: 0 0 0 0 rgba(30, 158, 92, .6);
    animation: pulse 1.8s infinite;
    flex: none;
}

.live-dot.is-off {
    background: var(--faint);
    animation: none;
    box-shadow: none;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(30, 158, 92, .55);
    }
    70% {
        box-shadow: 0 0 0 9px rgba(30, 158, 92, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(30, 158, 92, 0);
    }
}

@media (prefers-reduced-motion: reduce) {
    .live-dot {
        animation: none;
    }
}

/* ------------------------------------------------------------ Statistiques */

.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: .8rem;
}

/* Le libelle passe au-dessus du chiffre (ordre visuel), sans changer le
   balisage existant : valeur puis libelle. */
.stat {
    display: flex;
    flex-direction: column;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow);
    padding: .95rem 1.1rem 1rem;
}

.stat-label {
    order: 1;
    font-size: .92rem;
    color: var(--muted);
    font-weight: 600;
}

.stat-value {
    order: 2;
    font-size: 2.1rem;
    font-weight: 650;
    line-height: 1.15;
    letter-spacing: -.015em;
    font-variant-numeric: lining-nums;
    margin-top: .1rem;
}

/* [nouveau] precision sous le chiffre : « sur 40 inscrits ». */
.stat-foot {
    order: 3;
    font-size: .88rem;
    color: var(--muted);
    margin-top: .15rem;
}

.stat-accent .stat-value {
    color: var(--accent-ink);
}

.stat-brand .stat-value {
    color: var(--brand);
}

/* ------------------------------------------------------------- Candidats */

.choices {
    display: grid;
    gap: .75rem;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr));
}

.choice {
    position: relative;
    display: flex;
    gap: .95rem;
    align-items: flex-start;
    padding: 1rem 3rem 1rem 1rem;
    border: 1.5px solid var(--line-strong);
    border-radius: 12px;
    background: var(--card);
    cursor: pointer;
    transition: border-color var(--feedback) ease-out, box-shadow var(--feedback) ease-out,
    background var(--feedback) ease-out;
}

.choice:hover {
    border-color: var(--faint);
}

.choice input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.choice:focus-within {
    box-shadow: var(--focus);
    border-color: var(--brand);
}

.choice.is-selected {
    border-color: var(--brand);
    background: var(--brand-50);
    box-shadow: inset 0 0 0 1px var(--brand);
}

/* Maximum de choix atteint : les cartes restantes s'effacent. */
.choice:has(input:disabled) {
    opacity: .5;
    cursor: not-allowed;
}

/* La case est visible meme vide : on comprend qu'on peut cocher. */
.choice-check {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 24px;
    height: 24px;
    border-radius: 7px;
    border: 1.5px solid var(--line-strong);
    background: var(--card);
    color: transparent;
    display: grid;
    place-items: center;
    font-size: .85rem;
    font-weight: 800;
    line-height: 1;
    transition: background var(--feedback) ease-out, border-color var(--feedback) ease-out,
    color var(--feedback) ease-out, transform var(--reveal) var(--ease);
}

.choice input[type="radio"] ~ .choice-check {
    border-radius: 50%;
}

.choice.is-selected .choice-check {
    background: var(--brand);
    border-color: var(--brand);
    color: #fff;
    transform: scale(1.06);
}

.avatar {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    object-fit: cover;
    background: var(--sunken);
    flex: none;
    border: 1px solid var(--line);
}

.avatar-initials {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    flex: none;
    display: grid;
    place-items: center;
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--brand-800);
    background: var(--brand-100);
    letter-spacing: .02em;
}

.avatar-sm,
.avatar-initials.avatar-sm {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    font-size: .9rem;
}

.choice-body {
    display: block;
    min-width: 0;
}

.choice-name {
    display: block;
    font-weight: 700;
    font-size: 1.08rem;
    line-height: 1.25;
}

.choice-slogan {
    display: block;
    font-size: .96rem;
    color: var(--ink-2);
    margin-top: .15rem;
}

.choice-prog {
    display: block;
    font-size: .92rem;
    color: var(--muted);
    margin-top: .5rem;
    padding-top: .5rem;
    border-top: 1px solid var(--line);
}

.choice-abstain {
    border-style: dashed;
    align-items: center;
}

.choice-abstain .avatar-initials {
    background: var(--sunken);
    color: var(--muted);
}

/* ---------------------------------------------------------- Resultats live */

/* Les lignes du classement sont separees par un filet, sans boite autour
   de chacune : la carte porte deja le cadre. */
.results {
    display: flex;
    flex-direction: column;
}

.result {
    display: flex;
    align-items: center;
    gap: .9rem;
    padding: .85rem 0;
    border-top: 1px solid var(--line);
    background: transparent;
}

.results > .result:first-child,
.result[style*="order: 0"] {
    border-top-color: transparent;
}

.result-rank {
    width: 1.4rem;
    font-weight: 700;
    font-size: 1rem;
    color: var(--faint);
    text-align: center;
    flex: none;
    font-variant-numeric: tabular-nums;
}

.result.is-leader .result-rank {
    color: var(--brand);
}

.result-body {
    flex: 1;
    min-width: 0;
}

.result-top {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: .7rem;
    margin-bottom: .4rem;
}

.result-name {
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.result.is-leader .result-name {
    font-weight: 700;
}

/* Mention « En tête » puis « Élu(e) » a la cloture, sans changer le balisage. */
.result.is-leader .result-name::after {
    content: "En tête";
    display: inline-block;
    margin-left: .55rem;
    padding: .05rem .45rem;
    border-radius: var(--radius-xs);
    background: var(--brand-100);
    color: var(--brand-800);
    font-size: .8rem;
    font-weight: 600;
    vertical-align: .08em;
}

.results.is-closed .result.is-leader .result-name::after {
    content: "Élu(e)";
    background: var(--accent-wash);
    color: var(--accent-ink);
}

/* [nouveau] pastille de la couleur du candidat : fait le lien avec la
   courbe et la bande de repartition. */
.result-key {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 3px;
    margin-right: .5rem;
    vertical-align: .02em;
    flex: none;
}

.result-numbers {
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    font-size: .95rem;
    color: var(--muted);
    flex: none;
}

/* [nouveau] pourcentage en colonne : les lignes s'alignent entre elles. */
.result-pct {
    display: inline-block;
    min-width: 4.1em;
    text-align: right;
}

.result-votes {
    font-weight: 700;
    font-size: 1.12rem;
    color: var(--ink);
    display: inline-block;
    transition: transform .25s ease, color .25s ease;
}

.result-votes.is-bumped {
    transform: scale(1.25);
    color: var(--brand);
}

/* Barre : mince, extremite arrondie cote donnee, base droite. Le candidat
   de tete est en brique, les autres en gris : on lit qui mene d'un regard. */
.track {
    height: 10px;
    border-radius: 3px;
    background: var(--sunken);
    overflow: hidden;
}

.track-fill {
    /* Le remplissage est un <span> : sans display:block, la hauteur et la
       largeur seraient ignorees et la barre resterait invisible. */
    display: block;
    height: 100%;
    width: 0;
    border-radius: 0 4px 4px 0;
    background: #b4aca8;
    transition: width .6s var(--ease), background var(--feedback) ease-out;
}

.result.is-leader .track-fill {
    background: var(--brand);
}

/* Resultats sous scelles : un bandeau sobre, hachure discrete. */
.masked {
    background: repeating-linear-gradient(135deg, var(--sunken) 0 10px, #f7f5f4 10px 20px);
    border: 1px dashed var(--line-strong);
    color: var(--ink);
    border-radius: var(--radius-sm);
    padding: 1.6rem 1.4rem;
    text-align: center;
}

.masked h3 {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    margin-bottom: .2rem;
}

.masked h3::before {
    content: "";
    width: 18px;
    height: 18px;
    flex: none;
    background: no-repeat center / contain url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23231f20' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='4' y='10.5' width='16' height='10.5' rx='2'/%3E%3Cpath d='M8 10.5V7a4 4 0 0 1 8 0v3.5'/%3E%3C/svg%3E");
}

.masked p {
    color: var(--muted);
    margin: 0;
}

/* ------------------------------------------------------------- Tableaux */

.table-wrap {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: .98rem;
}

.table th,
.table td {
    text-align: left;
    padding: .7rem .8rem;
    border-bottom: 1px solid var(--line);
    vertical-align: middle;
}

.table th {
    font-size: .88rem;
    font-weight: 600;
    color: var(--muted);
    border-bottom-color: var(--line-strong);
    white-space: nowrap;
}

.table th:first-child,
.table td:first-child {
    padding-left: 0;
}

.table th:last-child,
.table td:last-child {
    padding-right: 0;
}

.table tr:last-child td {
    border-bottom: 0;
}

/* [nouveau] colonnes chiffrees : etroites, alignees a droite, chiffres
   tabulaires. La colonne de texte prend la largeur restante. */
.table .num {
    width: 1%;
    padding-left: 1.8rem;
    text-align: right;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.table .num:first-child {
    padding-left: 0;
    padding-right: .4rem;
}

.table-actions,
.table .table-actions {
    white-space: nowrap;
    text-align: right;
}

.table td.num + .table-actions {
    padding-left: 1.6rem;
}

/* ------------------------------------------------------- Liste / details */

.item {
    display: flex;
    align-items: center;
    gap: .9rem;
    padding: .85rem 0;
    border-bottom: 1px solid var(--line);
}

.item:last-child {
    border-bottom: 0;
}

.item-body {
    flex: 1;
    min-width: 0;
}

details.inline-edit {
    margin-top: .6rem;
}

details.inline-edit > summary {
    cursor: pointer;
    font-size: .95rem;
    color: var(--brand);
    font-weight: 600;
    list-style: none;
}

details.inline-edit > summary::-webkit-details-marker {
    display: none;
}

details.inline-edit > summary::before {
    content: "+ ";
}

details.inline-edit[open] > summary::before {
    content: "\2212  ";
}

details.inline-edit > div {
    margin-top: .8rem;
    padding: 1rem;
    background: var(--sunken);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
}

/* ----------------------------------------------------------- Confirmation */

.seal {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    margin: 0 auto 1rem;
    display: grid;
    place-items: center;
    background: var(--ok-wash);
    color: var(--ok);
    font-size: 1.7rem;
    font-weight: 800;
    line-height: 1;
}

/* Recu anonyme : un talon detachable, bord en pointilles. */
.receipt {
    display: inline-block;
    font-family: var(--font-mono);
    font-size: 1.45rem;
    font-weight: 700;
    letter-spacing: .14em;
    line-height: 1.2;
    background: var(--sunken);
    color: var(--ink);
    padding: .7rem 1.2rem;
    border-radius: var(--radius-sm);
    border: 1.5px dashed var(--line-strong);
    user-select: all;
}

/* ------------------------------------------------------------- Pied de page */

.footer {
    border-top: 1px solid var(--line);
    padding: 1.5rem 1.25rem 2.5rem;
    text-align: center;
    color: var(--muted);
    font-size: .92rem;
    background: var(--card);
}

/* ---------------------------------------------- Vue videoprojecteur (ecran) */

/* La classe .screen redefinit les variables : tous les composants places
   dedans (classement, graphiques, badges) passent en version sombre. */
.screen {
    --ink: #ffffff;
    --ink-2: rgba(255, 255, 255, .86);
    --muted: rgba(255, 255, 255, .68);
    --faint: rgba(255, 255, 255, .45);
    --line: rgba(255, 255, 255, .14);
    --line-strong: rgba(255, 255, 255, .26);
    --card: rgba(255, 255, 255, .05);
    --sunken: rgba(255, 255, 255, .1);
    --shadow: none;
    --shadow-lg: none;

    background: var(--night);
    color: #fff;
}

body.screen {
    min-height: 100vh;
}

.screen-wrap {
    max-width: 1500px;
    margin: 0 auto;
    padding: 3vh 3vw;
}

.screen-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1.5rem 3rem;
    flex-wrap: wrap;
    padding-bottom: 2.4vh;
    margin-bottom: 2.4vh;
    border-bottom: 1px solid var(--line);
}

.screen-head h1 {
    font-size: clamp(2rem, 1.1rem + 2.8vw, 3.4rem);
    margin: 0;
}

.screen-head .eyebrow {
    color: var(--accent-soft);
    font-size: clamp(.95rem, .8rem + .5vw, 1.25rem);
}

.screen-stats {
    display: flex;
    gap: 2.6rem;
    flex-wrap: wrap;
}

.screen-stat-value {
    font-size: clamp(2rem, 1.1rem + 2.6vw, 3.3rem);
    font-weight: 650;
    line-height: 1;
    letter-spacing: -.015em;
}

.screen-stat-label {
    font-size: clamp(.9rem, .8rem + .35vw, 1.1rem);
    color: var(--muted);
    font-weight: 600;
    margin-top: .35rem;
}

/* [nouveau] classement a gauche, participation et courbe a droite. */
.screen-grid {
    display: grid;
    gap: 2.4vh 3vw;
    grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
    align-items: start;
}

.screen-side {
    display: grid;
    gap: 2.4vh;
}

.screen-panel-title {
    font-family: var(--font);
    font-size: clamp(1rem, .85rem + .5vw, 1.3rem);
    font-weight: 600;
    color: var(--muted);
    margin: 0 0 1.2vh;
}

.screen .result {
    padding: 1.5vh 0;
    gap: 1.2rem;
}

.screen .result-name {
    font-size: clamp(1.15rem, .8rem + 1vw, 1.8rem);
}

.screen .result-votes {
    font-size: clamp(1.4rem, .9rem + 1.3vw, 2.3rem);
}

.screen .result-numbers {
    font-size: clamp(.95rem, .8rem + .5vw, 1.25rem);
}

.screen .result-rank {
    font-size: clamp(1.1rem, .8rem + .8vw, 1.6rem);
    width: 2rem;
}

.screen .result.is-leader .result-rank {
    color: var(--accent-soft);
}

.screen .result.is-leader .result-name::after,
.screen .results.is-closed .result.is-leader .result-name::after {
    background: rgba(239, 203, 126, .18);
    color: var(--accent-soft);
    font-size: .55em;
    vertical-align: .25em;
}

.screen .result-votes.is-bumped {
    color: var(--accent-soft);
}

.screen .track {
    height: 14px;
    border-radius: 4px;
}

.screen .track-fill {
    background: rgba(255, 255, 255, .42);
}

/* Sur fond sombre, le candidat de tete passe a l'or. */
.screen .result.is-leader .track-fill {
    background: var(--accent-soft);
}

.screen .avatar,
.screen .avatar-initials {
    width: 54px;
    height: 54px;
    background: rgba(255, 255, 255, .12);
    color: #fff;
    border-color: transparent;
}

.screen .badge-open,
.screen .badge-closed,
.screen .badge-draft {
    background: transparent;
    color: #fff;
}

.screen .badge-closed::before {
    background: #fff;
}

.screen-footer {
    margin-top: 2.6vh;
    padding-top: 2vh;
    border-top: 1px solid var(--line);
    display: flex;
    align-items: center;
    gap: .7rem 1rem;
    flex-wrap: wrap;
    font-size: clamp(.95rem, .85rem + .4vw, 1.2rem);
    color: var(--muted);
}

.screen-footer strong {
    color: #fff;
    font-size: 1.35em;
    letter-spacing: .16em;
    font-family: var(--font);
    font-weight: 700;
    margin-left: .2em;
}

/* ====================================================== Page d'accueil === */

/* Le hero est un panneau blanc ; dans son angle, un anneau de rayons
   reprend le motif du logo AIMS. */
.hero {
    position: relative;
    overflow: hidden;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 18px;
    box-shadow: var(--shadow);
    padding: clamp(1.6rem, 1rem + 3vw, 3.5rem);
}

.hero::after {
    content: "";
    position: absolute;
    width: 620px;
    aspect-ratio: 1;
    right: -150px;
    top: 50%;
    translate: 0 -50%;
    border-radius: 50%;
    background: repeating-conic-gradient(from -1.25deg, var(--brand-100) 0 2.5deg, transparent 2.5deg 6deg);
    -webkit-mask: radial-gradient(circle closest-side, transparent 62%, #000 62.4% 99%, transparent 99.6%);
    mask: radial-gradient(circle closest-side, transparent 62%, #000 62.4% 99%, transparent 99.6%);
    pointer-events: none;
}

.hero-grid {
    position: relative;
    z-index: 1;
    display: grid;
    gap: 2.5rem 3rem;
    grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr);
    align-items: center;
}

.hero-title {
    font-family: var(--font-display);
    font-size: clamp(2.3rem, 1.3rem + 4.2vw, 3.9rem);
    line-height: 1.03;
    letter-spacing: -.022em;
    margin: 0 0 1rem;
    font-weight: 600;
    max-width: 13ch;
}

/* Pas de mot isole en couleur ou en italique dans le titre. */
.hero-title em {
    font-style: normal;
    color: inherit;
}

.hero-lead {
    font-size: 1.18rem;
    line-height: 1.5;
    color: var(--ink-2);
    max-width: 44ch;
    margin: 0;
}

.hero-form {
    display: flex;
    gap: .6rem;
    flex-wrap: wrap;
    align-items: stretch;
    margin-top: 1.8rem;
    max-width: 30rem;
}

.hero-form .label {
    flex-basis: 100%;
    margin-bottom: -.15rem !important;
}

.hero-form .input {
    flex: 1 1 200px;
    min-width: 0;
}

.hero-form .btn {
    flex: none;
    padding-inline: 2rem;
}

.hero-error {
    flex-basis: 100%;
}

.hero-bullets {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem 1.4rem;
    margin: 1.4rem 0 0;
    padding: 0;
    list-style: none;
}

.hero-bullets li {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    font-size: .98rem;
    font-weight: 600;
    color: var(--ink-2);
}

.hero-bullets li::before {
    content: "";
    width: 16px;
    height: 16px;
    flex: none;
    background: no-repeat center / contain url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%238a1c03' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 8.5l3.2 3.2L13 4.8'/%3E%3C/svg%3E");
}

/* Carte d'apercu du direct : posee a plat, sans inclinaison. */
.float-card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 1.3rem 1.4rem;
}

.float-head {
    display: flex;
    align-items: center;
    gap: .5rem;
    margin-bottom: 1rem;
    font-size: .95rem;
    font-weight: 600;
    color: var(--ink);
}

.float-row {
    display: flex;
    align-items: center;
    gap: .7rem;
    margin-bottom: .7rem;
}

.float-row:last-of-type {
    margin-bottom: 0;
}

.float-row .track {
    flex: 1;
    height: 8px;
}

.float-row:first-of-type .track-fill,
.float-row.is-leader .track-fill {
    background: var(--brand) !important;
}

.float-name {
    font-weight: 600;
    font-size: .98rem;
    width: 5.6rem;
    flex: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.float-value {
    font-weight: 700;
    font-size: .98rem;
    width: 2rem;
    text-align: right;
    flex: none;
    font-variant-numeric: tabular-nums;
}

.float-foot {
    margin: 1rem 0 0;
    padding-top: .85rem;
    border-top: 1px solid var(--line);
    font-size: .9rem;
    color: var(--muted);
}

/* --------------------------------------------------- Rythme des sections */

.section {
    margin-top: 4rem;
    scroll-margin-top: 5rem;
}

.section-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}

.section-head h2 {
    font-family: var(--font-display);
    font-size: clamp(1.5rem, 1.2rem + 1.3vw, 2.1rem);
    letter-spacing: -.015em;
    line-height: 1.15;
    margin: 0;
}

.section-head h2 em {
    font-family: inherit !important;
    font-style: normal !important;
    color: inherit !important;
}

.section-head p {
    margin: .4rem 0 0;
    color: var(--muted);
    font-size: 1.05rem;
    max-width: 58ch;
}

/* ------------------------------------------------------ Etapes numerotees */

/* Une vraie sequence : les numeros sont relies par un filet. */
.steps {
    display: grid;
    gap: 1.6rem 1.5rem;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    counter-reset: step;
}

.step {
    position: relative;
    padding: 0;
    background: none;
    border: 0;
}

.step::before {
    content: "";
    position: absolute;
    top: 19px;
    left: 52px;
    right: -1.5rem;
    height: 1px;
    background: var(--line-strong);
}

.step:last-child::before {
    display: none;
}

.step-num {
    position: relative;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    margin-bottom: .9rem;
    background: var(--card);
    border: 1.5px solid var(--brand);
    color: var(--brand);
    font-weight: 700;
    font-size: 1.05rem;
}

.step h3 {
    font-size: 1.1rem;
    margin-bottom: .3rem;
}

.step p {
    margin: 0;
    font-size: .98rem;
    color: var(--muted);
    max-width: 30ch;
}

/* ------------------------------------------------------- Points cles */

.points {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 1.15rem;
}

.points li {
    display: flex;
    gap: .85rem;
    align-items: flex-start;
}

.points b {
    display: block;
    font-weight: 700;
    font-size: 1.04rem;
    color: var(--ink);
}

.points span {
    font-size: .98rem;
    color: var(--muted);
}

.point-check {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    flex: none;
    display: grid;
    place-items: center;
    margin-top: .1rem;
    background: var(--brand-100);
    color: var(--brand) !important;
    font-weight: 800;
    font-size: .8rem !important;
    line-height: 1;
}

/* --------------------------------------------- Annonce du vainqueur */

.winner-slot:empty {
    display: none;
}

.winner {
    display: flex;
    align-items: center;
    gap: 1.2rem;
    padding: 1.3rem 1.5rem;
    margin: 1.1rem 0;
    border-radius: var(--radius);
    border: 1px solid #e6cf97;
    border-left: 5px solid var(--accent);
    background: var(--accent-wash);
    opacity: 0;
    transform: translateY(10px);
    transition: opacity var(--reveal) ease-out, transform var(--reveal) var(--ease);
}

.winner.is-revealed {
    opacity: 1;
    transform: none;
}

.winner-photo,
.avatar-initials.winner-photo {
    width: 76px;
    height: 76px;
    border-radius: 16px;
    font-size: 1.45rem;
    background: #fff;
    color: var(--accent-ink);
    box-shadow: inset 0 0 0 1px #e6cf97;
}

.winner-body {
    min-width: 0;
}

.winner-label {
    font-size: .95rem;
    font-weight: 600;
    color: var(--accent-ink);
}

.winner-name {
    font-family: var(--font-display);
    font-size: clamp(1.5rem, 1.1rem + 1.9vw, 2.4rem);
    font-weight: 600;
    line-height: 1.12;
    letter-spacing: -.018em;
    margin: .1rem 0 .2rem;
}

.winner-score {
    color: var(--ink-2);
    font-size: 1rem;
    font-variant-numeric: tabular-nums;
}

.winner-note {
    margin: .5rem 0 0;
    font-size: .92rem;
    color: var(--muted);
}

.screen .winner {
    background: rgba(239, 203, 126, .12);
    border-color: rgba(239, 203, 126, .45);
    border-left-color: var(--accent-soft);
    color: #fff;
    margin-top: 0;
    margin-bottom: 2.4vh;
}

.screen .avatar-initials.winner-photo {
    background: rgba(239, 203, 126, .2);
    color: var(--accent-soft);
    box-shadow: none;
}

.screen .winner-label {
    color: var(--accent-soft);
}

.screen .winner-name {
    font-size: clamp(1.8rem, 1.1rem + 2.6vw, 3.2rem);
}

.screen .winner-score,
.screen .winner-note {
    color: rgba(255, 255, 255, .78);
}

@media (prefers-reduced-motion: reduce) {
    .winner {
        transition: none;
        opacity: 1;
        transform: none;
    }
}

/* =========================================================== Graphiques === */

.chart {
    position: relative;

    /* Palette categorielle : huit teintes dont l'ordre a ete verifie par
       calcul (bande de clarte, plancher de chroma, separation pour les
       daltoniens, contraste) sur fond blanc et sur le fond sombre du
       videoprojecteur. Une teinte par candidat, attribuee par sa position
       dans le scrutin, jamais par son rang. Le jaune est place en sixieme
       position pour ne pas se confondre avec l'or du candidat de tete. */
    --s1: #2a78d6;
    --s2: #1baf7a;
    --s3: #eb6834;
    --s4: #6250d6;
    --s5: #e87ba4;
    --s6: #eda100;
    --s7: #008300;
    --s8: #e34948;
    --s-other: #8d8580;

    --chart-ink: var(--ink);
    --chart-muted: var(--muted);
    --chart-grid: #ebe7e4;
    --chart-axis: #cfc8c4;
    --chart-surface: #ffffff;
    --chart-accent: var(--brand);
    --chart-track: var(--brand-100);
    --chart-font: 12.5;
    --chart-stroke: 2;
}

/* Memes teintes, pas calees pour le fond sombre du videoprojecteur. */
.screen .chart {
    --s1: #3987e5;
    --s2: #199e70;
    --s3: #d95926;
    --s4: #9085e9;
    --s5: #d55181;
    --s6: #c98500;
    --s7: #008300;
    --s8: #e66767;
    --s-other: #a79d99;

    --chart-ink: #ffffff;
    --chart-muted: rgba(255, 255, 255, .7);
    --chart-grid: rgba(255, 255, 255, .12);
    --chart-axis: rgba(255, 255, 255, .3);
    --chart-surface: #1c1314;
    --chart-accent: var(--accent-soft);
    --chart-track: rgba(255, 255, 255, .13);
    --chart-font: 15;
    --chart-stroke: 3;
}

.chart svg {
    display: block;
    width: 100%;
    height: auto;
    overflow: visible;
    font-family: var(--font);
}

.chart svg:focus-visible {
    outline: 2px solid var(--chart-accent);
    outline-offset: 4px;
    border-radius: 6px;
}

/* Trace de la courbe a la premiere apparition, une seule fois. */
.chart svg.is-intro .chart-line {
    stroke-dasharray: 1;
    stroke-dashoffset: 1;
    animation: chart-draw 1.1s var(--ease) forwards;
}

.chart svg.is-intro .chart-end {
    opacity: 0;
    animation: chart-fade .4s ease-out .8s forwards;
}

@keyframes chart-draw {
    to {
        stroke-dashoffset: 0;
    }
}

@keyframes chart-fade {
    to {
        opacity: 1;
    }
}

.chart-legend {
    display: flex;
    flex-wrap: wrap;
    gap: .35rem 1.2rem;
    margin-top: .9rem;
    font-size: .92rem;
    color: var(--chart-ink);
}

.screen .chart-legend {
    font-size: clamp(.95rem, .8rem + .4vw, 1.15rem);
}

.chart-legend-item {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
}

/* Cle de legende : un trait pour une courbe, un carre pour une surface. */
.chart-swatch {
    width: 10px;
    height: 10px;
    border-radius: 3px;
    flex: none;
    display: inline-block;
}

.chart-key {
    width: 14px;
    height: 3px;
    border-radius: 2px;
    flex: none;
    display: inline-block;
}

.chart-empty {
    color: var(--chart-muted);
    font-size: .98rem;
    text-align: center;
    margin: 2rem 0;
}

.chart-note {
    font-size: .9rem;
    color: var(--chart-muted);
    margin: .6rem 0 0;
}

.chart-tooltip {
    position: absolute;
    top: 0;
    left: 0;
    pointer-events: none;
    z-index: 3;
    min-width: 168px;
    max-width: 260px;
    padding: .6rem .75rem;
    border-radius: 10px;
    border: 1px solid var(--line-strong);
    background: #fff;
    color: #231f20;
    font-size: .92rem;
    line-height: 1.35;
    box-shadow: 0 8px 24px -10px rgba(35, 31, 32, .35);
}

.chart-tooltip[hidden] {
    display: none;
}

.chart-tooltip strong,
.chart-tooltip-title {
    display: block;
    margin-bottom: .35rem;
    font-weight: 600;
    font-size: .88rem;
    color: #6c6462;
    font-variant-numeric: tabular-nums;
}

.chart-tooltip-row {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .08rem 0;
}

.chart-tooltip-row span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chart-tooltip-row b {
    margin-left: auto;
    padding-left: .8rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

/* ------------------------------ [nouveau] Anneau de participation
   Un rayon par inscrit, comme la couronne du logo AIMS : les rayons
   s'allument a mesure que les bulletins arrivent. */

.chart-ring {
    width: 100%;
    max-width: 290px;
    margin-inline: auto;
    aspect-ratio: 1;
    container-type: inline-size;
}

.chart-ring svg {
    width: 100%;
    height: 100%;
}

.ring-ray {
    fill: var(--chart-track);
    transition: fill .5s ease-out;
}

.ring-ray.is-on {
    fill: var(--chart-accent);
}

.ring-center {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 22%;
    line-height: 1.2;
}

.ring-value {
    font-size: 2.9rem;
    font-size: 17cqw;
    font-weight: 650;
    letter-spacing: -.02em;
    line-height: 1;
    color: var(--chart-ink);
    white-space: nowrap;
}

.ring-label {
    font-size: .95rem;
    font-size: max(.8rem, 5.6cqw);
    font-weight: 600;
    color: var(--chart-ink);
    margin-top: .25em;
}

.ring-sub {
    font-size: .85rem;
    font-size: max(.74rem, 4.8cqw);
    color: var(--chart-muted);
}

/* ------------------------------ [nouveau] Bande de repartition des voix
   Un tout decoupe en parts ; le repere marque la majorite absolue. */

.chart-share {
    padding-top: 1.5rem;
}

.share-bar {
    position: relative;
    display: flex;
    gap: 2px;
    height: 8px;
}

.share-seg {
    flex: 0 0 auto;
    min-width: 0;
    height: 100%;
    border-radius: 2px;
    transition: flex-grow .6s var(--ease), filter var(--feedback) ease-out;
    display: flex;
    align-items: center;
    overflow: visible;
    outline-offset: 3px;
}

.share-seg:first-child {
    border-radius: 4px 2px 2px 4px;
}

.share-seg:last-child {
    border-radius: 2px 4px 4px 2px;
}

.share-seg:only-child {
    border-radius: 4px;
}

.share-seg:hover,
.share-seg:focus-visible {
    filter: brightness(1.12);
}

.share-empty {
    flex: 1;
    border-radius: 4px;
    background: var(--chart-track);
}

.share-label {
    padding: 0 .55rem;
    font-size: .92rem;
    font-weight: 700;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.share-mark {
    position: absolute;
    left: 50%;
    top: -7px;
    bottom: -7px;
    width: 2px;
    margin-left: -1px;
    background: var(--chart-ink);
    border-radius: 1px;
    box-shadow: 0 0 0 2px var(--chart-surface);
    pointer-events: none;
}

.share-mark span {
    position: absolute;
    bottom: 100%;
    left: 50%;
    translate: -50% -3px;
    font-size: .84rem;
    font-weight: 600;
    color: var(--chart-muted);
    white-space: nowrap;
}

.chart-share[data-variant="tall"] {
    padding-top: 1.9rem;
}

.chart-share[data-variant="tall"] .share-bar {
    height: 28px;
}

.chart-share[data-variant="tall"] .share-seg,
.chart-share[data-variant="tall"] .share-seg:first-child,
.chart-share[data-variant="tall"] .share-seg:last-child {
    border-radius: 4px;
}

.screen .share-mark span {
    font-size: clamp(.9rem, .8rem + .3vw, 1.05rem);
}

/* ------------------------------ [nouveau] Jauge fine (cartes de scrutin) */

.meter {
    height: 6px;
    border-radius: 3px;
    background: var(--brand-100);
    overflow: hidden;
}

.meter > span {
    display: block;
    height: 100%;
    border-radius: 3px;
    background: var(--brand);
}

/* ------------------------------ [nouveau] Tableau des donnees repliable */

.data-details > summary {
    cursor: pointer;
    font-weight: 600;
    font-size: .98rem;
    color: var(--ink);
    list-style: none;
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    padding: .2rem 0;
    border-radius: 6px;
}

.data-details > summary::-webkit-details-marker {
    display: none;
}

.data-details > summary::before {
    content: "";
    width: 8px;
    height: 8px;
    border-right: 2px solid var(--muted);
    border-bottom: 2px solid var(--muted);
    rotate: -45deg;
    transition: rotate var(--feedback) ease-out;
    margin-right: .15rem;
}

.data-details[open] > summary::before {
    rotate: 45deg;
}

.data-details > .table-wrap {
    margin-top: .9rem;
}

/* ------------------------------ [nouveau] Fil d'etapes du parcours de vote */

.stepper {
    display: flex;
    gap: .5rem;
    list-style: none;
    margin: 0 0 1.8rem;
    padding: 0;
    counter-reset: stepper;
}

.stepper li {
    flex: 1;
    counter-increment: stepper;
    padding-top: .65rem;
    border-top: 3px solid var(--line-strong);
    font-size: .92rem;
    font-weight: 600;
    color: var(--faint);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.stepper li::before {
    content: counter(stepper) ". ";
}

.stepper li.is-done {
    border-top-color: var(--brand-200);
    color: var(--muted);
}

.stepper li.is-current {
    border-top-color: var(--brand);
    color: var(--ink);
}

/* ------------------------------ [nouveau] Commande segmentee (etat du scrutin) */

.segmented {
    display: inline-flex;
    padding: 3px;
    gap: 2px;
    border-radius: var(--radius-sm);
    background: var(--sunken);
    border: 1px solid var(--line);
}

.segmented button {
    font: inherit;
    font-size: .95rem;
    font-weight: 600;
    padding: .45rem .95rem;
    border-radius: 7px;
    border: 0;
    background: none;
    color: var(--muted);
    cursor: pointer;
    transition: background var(--feedback) ease-out, color var(--feedback) ease-out;
}

.segmented button:hover {
    color: var(--ink);
}

.segmented button[aria-pressed="true"],
.segmented button[aria-selected="true"] {
    background: var(--card);
    color: var(--ink);
    box-shadow: 0 1px 2px rgba(35, 31, 32, .14);
}

/* ------------------------------ [nouveau] Liste de faits (cartes de scrutin) */

.facts {
    display: flex;
    flex-wrap: wrap;
    gap: .2rem 0;
    margin: 0 0 1rem;
    padding: 0;
    list-style: none;
    font-size: .98rem;
    color: var(--muted);
}

.facts li + li {
    margin-left: .8rem;
    padding-left: .8rem;
    border-left: 1px solid var(--line-strong);
}

.facts b {
    color: var(--ink);
    font-weight: 700;
}

/* ============================================= [nouveau] Effets du direct
   Chaque effet repond a un bulletin qui arrive, puis s'efface. Ils sont
   tous neutralises par prefers-reduced-motion (voir en fin de fichier). */

/* Onde qui part du dernier point de la courbe quand un candidat gagne une voix. */
.chart-ping {
    transform-box: fill-box;
    transform-origin: center;
    animation: chart-ping .95s ease-out forwards;
    pointer-events: none;
}

@keyframes chart-ping {
    from {
        transform: scale(1);
        opacity: .85;
    }
    to {
        transform: scale(3.6);
        opacity: 0;
    }
}

/* Le rayon du bulletin qui vient d'arriver s'allume avec un leger rebond. */
.ring-ray.is-new {
    transform-box: fill-box;
    transform-origin: center;
    animation: ring-pop .75s var(--ease);
}

@keyframes ring-pop {
    0% {
        transform: scale(1);
    }
    30% {
        transform: scale(1.3);
        fill: var(--chart-flash, var(--brand-400));
    }
    100% {
        transform: scale(1);
    }
}

.screen .chart {
    --chart-flash: #ffffff;
}

/* Pastille « +1 » : posee par VoteLive.plus() au-dessus du compteur de voix. */
.vote-chip {
    position: absolute;
    z-index: 30;
    translate: -50% -100%;
    padding: .05rem .45rem;
    border-radius: 999px;
    background: var(--brand);
    color: #fff;
    font-size: .82rem;
    font-weight: 700;
    line-height: 1.4;
    white-space: nowrap;
    pointer-events: none;
    animation: vote-chip 1.1s var(--ease) forwards;
}

.vote-chip-screen {
    background: var(--accent-soft);
    color: #2e2000;
    font-size: 1.05rem;
}

@keyframes vote-chip {
    0% {
        transform: translateY(6px) scale(.7);
        opacity: 0;
    }
    18% {
        transform: translateY(-4px) scale(1);
        opacity: 1;
    }
    70% {
        opacity: 1;
    }
    100% {
        transform: translateY(-26px) scale(1);
        opacity: 0;
    }
}

/* Changement de rang : la ligne qui monte passe au-dessus, et une fleche
   apparait a cote du rang (forme + couleur, jamais la couleur seule). */
.result {
    position: relative;
}

.result.is-rising {
    z-index: 2;
    background: var(--row-surface, #fff);
    box-shadow: 0 6px 18px -10px rgba(35, 31, 32, .45);
}

.screen {
    --row-surface: #261b1c;
}

.result-rank {
    position: relative;
}

.result.is-up .result-rank::after,
.result.is-down .result-rank::after {
    position: absolute;
    left: 50%;
    translate: -50% 0;
    font-size: .58em;
    line-height: 1;
    animation: rank-arrow 2.6s ease-out forwards;
}

.result.is-up .result-rank::after {
    content: "\25B2";
    bottom: 100%;
    color: #1e9e5c;
}

.result.is-down .result-rank::after {
    content: "\25BC";
    top: 100%;
    color: var(--faint);
}

@keyframes rank-arrow {
    0% {
        opacity: 0;
        transform: translateY(4px);
    }
    12%, 75% {
        opacity: 1;
        transform: none;
    }
    100% {
        opacity: 0;
    }
}

.result.is-down .result-rank::after {
    animation-name: rank-arrow-down;
}

@keyframes rank-arrow-down {
    0% {
        opacity: 0;
        transform: translateY(-4px);
    }
    12%, 75% {
        opacity: 1;
        transform: none;
    }
    100% {
        opacity: 0;
    }
}

/* Annonce de l'elu(e) : les trois lignes arrivent l'une apres l'autre,
   puis un reflet traverse le bandeau, une seule fois. */
.winner {
    position: relative;
    overflow: hidden;
}

.winner::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(105deg, transparent 38%, rgba(255, 255, 255, .8) 50%, transparent 62%);
    transform: translateX(-100%);
    pointer-events: none;
}

.screen .winner::after {
    background: linear-gradient(105deg, transparent 38%, rgba(239, 203, 126, .28) 50%, transparent 62%);
}

.winner.is-revealed::after {
    animation: winner-sheen 1.4s ease-out .55s 1 both;
}

.winner.is-revealed .winner-photo {
    animation: winner-photo .6s var(--ease) .05s both;
}

.winner.is-revealed .winner-label {
    animation: winner-rise .5s var(--ease) .15s both;
}

.winner.is-revealed .winner-name {
    animation: winner-rise .6s var(--ease) .28s both;
}

.winner.is-revealed .winner-score,
.winner.is-revealed .winner-note {
    animation: winner-rise .5s var(--ease) .45s both;
}

@keyframes winner-sheen {
    to {
        transform: translateX(100%);
    }
}

@keyframes winner-rise {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

@keyframes winner-photo {
    from {
        opacity: 0;
        transform: scale(.7);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

/* ------------------------------ [nouveau] Phrase de synthese du classement */

.card-lead {
    margin: 0 0 1rem;
    font-size: 1.12rem;
    font-weight: 600;
    line-height: 1.35;
    color: var(--ink);
    min-height: 1.35em;
}

.screen .card-lead {
    font-size: clamp(1.15rem, .9rem + .9vw, 1.7rem);
    margin-bottom: 1.6vh;
}

/* ------------------------------ [nouveau] Invitation a voter (videoprojecteur)
   QR code, adresse et code du scrutin, lisibles du fond de la salle. */

.screen-join {
    display: flex;
    align-items: center;
    gap: 1.1rem;
    margin-left: auto;
    text-align: right;
    line-height: 1.3;
}

.screen-join a {
    color: inherit;
    text-decoration: none;
    overflow-wrap: anywhere;
}

.screen-join-code {
    display: block;
    color: #fff;
    font-size: clamp(1.5rem, 1rem + 1.6vw, 2.4rem);
    font-weight: 700;
    letter-spacing: .16em;
    margin-right: -.16em;
}

.screen-qr {
    width: clamp(84px, 7vw, 124px);
    height: auto;
    flex: none;
    border-radius: 8px;
    background: #fff;
}

/* ------------------------------------------------------------ Responsive */

@media (max-width: 940px) {
    .split,
    .split-rev {
        grid-template-columns: 1fr;
    }

    .screen-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 860px) {
    .hero-grid {
        grid-template-columns: 1fr;
    }

    /* En une colonne, le motif passerait derriere le titre. */
    .hero::after {
        display: none;
    }

    .hero-title {
        max-width: none;
    }
}

@media (max-width: 700px) {
    /* Les ancres de la page d'accueil encombrent la barre sur petit ecran. */
    .nav-anchor {
        display: none;
    }

    .step::before {
        display: none;
    }
}

@media (max-width: 560px) {
    body {
        font-size: 1rem;
    }

    .container {
        padding: 1.3rem 1rem 3rem;
    }

    .card {
        padding: 1.15rem;
    }

    .stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .stat-value {
        font-size: 1.75rem;
    }

    .choices {
        grid-template-columns: 1fr;
    }

    .brand-sub {
        display: none !important;
    }

    .topbar-inner {
        padding: .65rem 1rem;
        gap: .5rem;
        flex-wrap: nowrap;
    }

    .brand-logo {
        height: 26px;
    }

    .nav {
        flex-wrap: nowrap;
        gap: 0;
    }

    .nav a,
    .nav button {
        font-size: .9rem;
        padding: .4rem .5rem;
    }

    .code-pill {
        font-size: 1.25rem;
    }

    .winner {
        flex-direction: column;
        align-items: flex-start;
        gap: .8rem;
        padding: 1.1rem;
    }

    .winner-photo,
    .avatar-initials.winner-photo {
        width: 58px;
        height: 58px;
        border-radius: 14px;
        font-size: 1.15rem;
    }

    .hero-form .input {
        flex-basis: 100%;
    }

    .hero-form .btn {
        width: 100%;
    }

    .section {
        margin-top: 2.8rem;
    }

    .result .avatar-initials,
    .result .avatar {
        display: none;
    }

    .result {
        gap: .7rem;
    }

    .result-name {
        flex: 1;
        min-width: 0;
    }

    .result-pct {
        min-width: 3.7em;
    }

    /* Sur telephone, le rang et la barre brique disent deja qui mene ;
       la mention ne revient qu'a la cloture. */
    .result.is-leader .result-name::after {
        display: none;
    }

    .results.is-closed .result.is-leader .result-name::after {
        display: inline-block;
    }

    .stepper li {
        font-size: .84rem;
    }

    .screen-join {
        margin-left: 0;
        width: 100%;
        justify-content: space-between;
        text-align: left;
    }

    .facts li + li {
        margin-left: .6rem;
        padding-left: .6rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .chart svg.is-intro .chart-line,
    .chart svg.is-intro .chart-end {
        animation: none;
        stroke-dasharray: none;
        opacity: 1;
    }

    .track-fill,
    .share-seg,
    .ring-ray {
        transition: none;
    }

    .chart-ping,
    .vote-chip {
        display: none;
    }

    .ring-ray.is-new,
    .winner.is-revealed::after,
    .winner.is-revealed .winner-photo,
    .winner.is-revealed .winner-label,
    .winner.is-revealed .winner-name,
    .winner.is-revealed .winner-score,
    .winner.is-revealed .winner-note,
    .result.is-up .result-rank::after,
    .result.is-down .result-rank::after {
        animation: none;
    }
}

@media print {
    .topbar,
    .nav,
    .footer,
    .btn {
        display: none !important;
    }

    body {
        background: #fff;
    }

    .card,
    .stat {
        box-shadow: none;
    }
}

/* ------------------------------ [nouveau] Scrutins multiples (js/scrutins.js) */

/* Les onglets de scrutin passent a la ligne sur petit ecran. */
.segmented[role="tablist"] {
    flex-wrap: wrap;
}

.segmented button .muted {
    font-weight: 500;
}

/* Ligne du candidat en cours de modification dans l'administration. */
.table tr.is-editing td {
    background: var(--accent-wash);
}

/* Photo d'un candidat dans un tableau ou une liste compacte. */
img.avatar.avatar-sm {
    width: 40px;
    height: 40px;
    border-radius: 10px;
}

/* ------------------------------ [nouveau] Écran d'ouverture (crédits)
   Affiché à l'ouverture de la plateforme, une fois par onglet. */

.splash {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: grid;
    place-items: center;
    padding: 1.5rem;
    background:
        radial-gradient(120% 80% at 50% 0%, var(--brand-700) 0%, var(--brand-900) 60%, var(--night) 100%);
    color: #fff;
    text-align: center;
    transition: opacity var(--reveal) var(--ease), visibility var(--reveal);
}

.splash.is-leaving {
    opacity: 0;
    visibility: hidden;
}

.splash-card {
    max-width: 560px;
    animation: splash-in 700ms var(--ease) both;
}

.splash-logo {
    display: block;
    width: min(260px, 70vw);
    height: auto;
    border-radius: var(--radius-sm);
    background: #fff;
    padding: .6rem .9rem;
    margin: 0 auto 1.4rem;
    box-shadow: 0 0 0 6px rgba(255, 255, 255, .08);
}

.splash-eyebrow {
    font-size: .82rem;
    font-weight: 600;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--accent-soft);
    margin: 0 0 .6rem;
}

.splash-title {
    font-family: var(--font-display);
    font-size: clamp(1.7rem, 1.2rem + 2vw, 2.5rem);
    line-height: 1.15;
    margin: 0 0 1.6rem;
    color: #fff;
}

.splash-credit {
    margin: 0 0 .5rem;
    color: rgba(255, 255, 255, .72);
    font-size: 1rem;
}

.splash-names {
    list-style: none;
    margin: 0 0 2rem;
    padding: 0;
    display: grid;
    gap: .35rem;
}

.splash-names li {
    font-size: clamp(1.1rem, .95rem + .8vw, 1.45rem);
    font-weight: 700;
    letter-spacing: .03em;
}

.splash-names .splash-and {
    font-size: .95rem;
    font-weight: 400;
    color: var(--accent-soft);
}

.splash .btn {
    background: var(--accent);
    color: var(--brand-900);
}

.splash .btn:hover {
    background: var(--accent-soft);
}

.splash-hint {
    margin: 1rem 0 0;
    font-size: .85rem;
    color: rgba(255, 255, 255, .5);
}

@keyframes splash-in {
    from { opacity: 0; transform: translateY(14px) scale(.98); }
    to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
    .splash,
    .splash-card {
        animation: none;
        transition: none;
    }
}

/* =====================================================================
   THÈME INSTITUTIONNEL
   Couche finale : style sobre de commission électorale. Fond blanc, gris
   neutres froids, rouge AIMS réservé à la marque et aux actions, une seule
   famille (Source Sans 3), chiffres tabulaires, angles discrets, aucune
   ombre ni dégradé décoratif. Les règles ci-dessous priment sur le reste.
   ===================================================================== */

:root {
    --accent: var(--brand);
    --accent-soft: var(--brand-200);
    --accent-ink: var(--brand-800);
    --accent-wash: var(--brand-50);

    --ink: #16191e;
    --ink-2: #333a44;
    --muted: #525c69;
    --faint: #7d8693;
    --line: #d3d8df;
    --line-strong: #b4bcc7;
    --bg: #f2f4f7;
    --sunken: #f6f7f9;
    --card: #ffffff;

    --radius: 4px;
    --radius-sm: 3px;
    --radius-xs: 2px;
    --shadow: none;
    --shadow-lg: none;

    --font-display: var(--font);
}

body {
    font-variant-numeric: tabular-nums;
}

h1,
.hero-title,
.section-head h2,
.winner-name {
    font-family: var(--font);
    font-weight: 700;
    letter-spacing: -.01em;
}

h1 {
    font-size: clamp(1.6rem, 1.25rem + 1.4vw, 2.2rem);
}

.eyebrow {
    color: var(--muted);
}

.card,
.hero,
.float-card,
.step,
.stat {
    border-radius: var(--radius);
    box-shadow: none;
}

/* Pas de motif décoratif dans le bandeau d'accueil. */
.hero::after {
    display: none;
}

.hero-title {
    font-size: clamp(1.9rem, 1.3rem + 2.4vw, 2.9rem);
    line-height: 1.12;
    max-width: 18ch;
}

.section-head h2 {
    font-size: clamp(1.35rem, 1.15rem + .8vw, 1.75rem);
}

/* Chiffres clés : un trait de couleur en tête, pas de carte flottante. */
.stat {
    border-top: 3px solid var(--line-strong);
}

.stat-brand {
    border-top-color: var(--brand);
}

.stat-value {
    font-weight: 700;
    letter-spacing: -.01em;
}

/* Pastilles du classement : neutres, sans or. */
.result.is-leader .result-name::after {
    background: var(--sunken);
    color: var(--ink-2);
    border: 1px solid var(--line);
}

.results.is-closed .result.is-leader .result-name::after {
    background: var(--brand);
    color: #fff;
    border-color: var(--brand);
}

/* Teintes des candidats : palette sourde, lisible au vidéoprojecteur. */
.chart,
.screen .chart {
    --s1: #1f4e79;
    --s2: #2c7a6e;
    --s3: #a6531e;
    --s4: #5b4a8b;
    --s5: #9c3d5f;
    --s6: #a07a14;
    --s7: #4d6b2a;
    --s8: #6b7480;
    --s-other: #9aa2ad;
    --chart-grid: #e6e9ee;
    --chart-axis: #b4bcc7;
    --chart-track: #e6e9ee;
}

/* ------------------------------------------- Participation (remplace l'anneau) */

.turnout {
    width: 100%;
}

.turnout-value {
    font-size: clamp(2.2rem, 1.6rem + 2vw, 3.2rem);
    font-weight: 700;
    line-height: 1;
    letter-spacing: -.015em;
    color: var(--ink);
}

.turnout-label {
    margin-top: .3rem;
    font-weight: 600;
    color: var(--ink-2);
}

.turnout-bar {
    position: relative;
    height: 12px;
    margin: 1rem 0 .55rem;
    background: #e6e9ee;
    border-radius: 2px;
    overflow: hidden;
}

.turnout-bar span {
    position: absolute;
    inset: 0 auto 0 0;
    background: var(--brand);
    transition: width var(--reveal) var(--ease);
}

.turnout-foot {
    font-size: .92rem;
    color: var(--muted);
}

/* ------------------------------------------------- Annonce de l'élu(e) */

.winner {
    background: #fff;
    border: 1px solid var(--line);
    border-left: 4px solid var(--brand);
    border-radius: var(--radius);
    transform: none;
    transition: opacity var(--reveal) ease-out;
}

.winner-photo,
.avatar-initials.winner-photo {
    border-radius: var(--radius);
    background: var(--sunken);
    color: var(--ink-2);
    box-shadow: inset 0 0 0 1px var(--line);
}

.winner-label {
    color: var(--brand);
}

.winner-name {
    font-size: clamp(1.4rem, 1.1rem + 1.4vw, 2.1rem);
}

/* ------------------------------------------------ Vue vidéoprojecteur */

.screen {
    --ink: #16191e;
    --ink-2: #333a44;
    --muted: #525c69;
    --faint: #7d8693;
    --line: #d3d8df;
    --line-strong: #b4bcc7;
    --card: #ffffff;
    --sunken: #f2f4f7;

    background: #fff;
    color: var(--ink);
    border: 1px solid var(--line);
    border-top: 6px solid var(--brand);
    border-radius: var(--radius);
}

.screen .chart {
    --chart-ink: var(--ink);
    --chart-muted: var(--muted);
    --chart-grid: #e6e9ee;
    --chart-axis: #b4bcc7;
    --chart-surface: #ffffff;
}

.screen-head {
    border-bottom: 2px solid var(--ink);
}

.screen-head .eyebrow {
    color: var(--brand);
    font-weight: 700;
}

.screen-head h1 {
    font-weight: 700;
}

.screen-stats {
    gap: 0;
}

.screen-stats > div {
    padding: 0 1.6rem;
    border-left: 1px solid var(--line);
}

.screen-stats > div:first-child {
    border-left: 0;
}

.screen-stat-value {
    font-weight: 700;
    color: var(--ink);
}

.screen-panel-title {
    color: var(--ink);
    font-weight: 700;
    padding-bottom: .5rem;
    border-bottom: 1px solid var(--line);
}

.screen .result {
    border-bottom: 1px solid var(--line);
}

.screen .result.is-leader .result-rank,
.screen .result-votes.is-bumped {
    color: var(--brand);
}

.screen .result.is-leader .result-name::after {
    background: var(--sunken);
    color: var(--ink-2);
}

.screen .results.is-closed .result.is-leader .result-name::after {
    background: var(--brand);
    color: #fff;
}

.screen .track {
    background: #e6e9ee;
    border-radius: 2px;
}

.screen .track-fill {
    background: #8a939f;
}

.screen .result.is-leader .track-fill {
    background: var(--brand);
}

.screen .avatar,
.screen .avatar-initials {
    background: var(--sunken);
    color: var(--ink-2);
    border: 1px solid var(--line);
    border-radius: var(--radius);
}

.screen .badge-open,
.screen .badge-closed,
.screen .badge-draft {
    color: var(--ink-2);
    border-color: var(--line);
}

.screen .badge-closed::before {
    background: var(--ink-2);
}

.screen .winner {
    background: #fff;
    border-color: var(--line);
    border-left-color: var(--brand);
    color: var(--ink);
}

.screen .avatar-initials.winner-photo {
    background: var(--sunken);
    color: var(--ink-2);
    box-shadow: inset 0 0 0 1px var(--line);
}

.screen-footer {
    border-top: 2px solid var(--ink);
    color: var(--muted);
}

.screen-join-code {
    color: var(--ink);
}

.screen-join a {
    color: var(--ink);
    font-weight: 600;
}

.screen-qr {
    border: 1px solid var(--line);
    border-radius: 2px;
}

/* --------------------------------------------------- Écran d'ouverture */

.splash {
    background: var(--bg);
    color: var(--ink);
}

.splash-card {
    width: min(560px, 100%);
    background: #fff;
    border: 1px solid var(--line);
    border-top: 6px solid var(--brand);
    border-radius: var(--radius);
    padding: clamp(1.6rem, 1rem + 3vw, 2.8rem);
    animation: none;
}

.splash-logo {
    box-shadow: none;
    padding: 0;
    width: min(240px, 70%);
}

.splash-eyebrow {
    color: var(--muted);
    letter-spacing: 0;
    text-transform: none;
    font-size: .95rem;
}

.splash-title {
    font-family: var(--font);
    font-weight: 700;
    color: var(--ink);
    font-size: clamp(1.45rem, 1.15rem + 1.3vw, 1.95rem);
    letter-spacing: -.01em;
    padding-bottom: 1.4rem;
    border-bottom: 1px solid var(--line);
}

.splash-credit {
    color: var(--muted);
}

.splash-names li {
    color: var(--ink);
    letter-spacing: .01em;
}

.splash-names .splash-and {
    color: var(--muted);
}

.splash .btn {
    background: var(--brand);
    color: #fff;
}

.splash .btn:hover {
    background: var(--brand-700);
}

.splash-hint {
    color: var(--faint);
}

/* Proclamation sobre : pas de reflet ni d'entrée animée par élément. */
.winner::after,
.screen .winner::after {
    display: none;
}

.winner.is-revealed .winner-photo,
.winner.is-revealed .winner-label,
.winner.is-revealed .winner-name,
.winner.is-revealed .winner-score,
.winner.is-revealed .winner-note {
    animation: none;
}

.screen .winner-label {
    color: var(--brand);
}

.screen .winner-name {
    color: var(--ink);
}

.screen .winner-score,
.screen .winner-note {
    color: var(--ink-2);
}

/* ------------------------------------------ Parcours de vote par étapes */

.preview-tabs [role="tab"].is-locked {
    color: var(--faint);
}

.preview-tabs [role="tab"].is-locked::after {
    content: "";
    display: inline-block;
    width: .7em;
    height: .8em;
    margin-left: .4em;
    vertical-align: -.05em;
    background: currentColor;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 16'%3E%3Cpath d='M3 7V5a4 4 0 0 1 8 0v2h1a1 1 0 0 1 1 1v7a1 1 0 0 1-1 1H2a1 1 0 0 1-1-1V8a1 1 0 0 1 1-1h1zm2 0h4V5a2 2 0 0 0-4 0v2z'/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 16'%3E%3Cpath d='M3 7V5a4 4 0 0 1 8 0v2h1a1 1 0 0 1 1 1v7a1 1 0 0 1-1 1H2a1 1 0 0 1-1-1V8a1 1 0 0 1 1-1h1zm2 0h4V5a2 2 0 0 0-4 0v2z'/%3E%3C/svg%3E") center / contain no-repeat;
}

.flow-notice {
    max-width: 660px;
    margin: 1.2rem auto 1.4rem;
    padding: .85rem 1rem;
    background: #fff;
    border: 1px solid var(--line);
    border-left: 4px solid var(--brand);
    border-radius: var(--radius);
    color: var(--ink-2);
    font-weight: 600;
}

.flow-notice[hidden] {
    display: none;
}

/* ------------------------------------------------------- Responsive (final) */

/* Ligne qui change de rang : surface claire, pas de reste du thème sombre. */
.screen {
    --row-surface: #ffffff;
}

.result.is-rising {
    box-shadow: 0 0 0 1px var(--line);
}

img,
svg,
canvas,
video {
    max-width: 100%;
}

.input,
.select,
.textarea {
    max-width: 100%;
}

@media (max-width: 860px) {
    .screen-grid {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (max-width: 700px) {
    /* Barre des étapes : grille de 3 colonnes, tout reste visible. */
    .preview-bar-inner {
        flex-wrap: wrap;
        gap: .5rem;
        padding: .5rem .75rem;
    }

    .preview-tabs {
        width: 100%;
        overflow: visible;
    }

    .preview-tabs .segmented {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        width: 100%;
        white-space: normal;
    }

    .preview-tabs .segmented button {
        padding: .5rem .3rem;
        font-size: .85rem;
        line-height: 1.2;
        text-align: center;
    }

    .preview-bar [data-demo-replay] {
        display: none;
    }

    /* Vidéoprojecteur : trois chiffres alignés sur une ligne. */
    .screen-stats {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        width: 100%;
    }

    .screen-stats > div {
        padding: 0 .75rem;
    }

    .screen-stats > div:first-child {
        padding-left: 0;
    }

    .screen-footer {
        flex-direction: column;
        align-items: flex-start;
    }

    .screen-join {
        margin-left: 0;
        text-align: left;
        width: 100%;
        justify-content: space-between;
    }

    .screen .avatar,
    .screen .avatar-initials {
        width: 40px;
        height: 40px;
    }

    /* Tableaux de l'administration : une fiche par ligne. */
    [data-scrutins-admin] .table,
    [data-scrutins-admin] .table tbody,
    [data-scrutins-admin] .table tr,
    [data-scrutins-admin] .table td {
        display: block;
        width: 100%;
    }

    [data-scrutins-admin] .table thead {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
    }

    [data-scrutins-admin] .table tr {
        padding: .8rem 0;
        border-bottom: 1px solid var(--line);
    }

    [data-scrutins-admin] .table td {
        padding: .2rem 0;
        border: 0;
        text-align: left;
    }

    [data-scrutins-admin] .table td.num::before {
        content: "Voix : ";
        color: var(--muted);
        font-weight: 400;
    }

    [data-scrutins-admin] .table td.table-actions {
        padding-top: .5rem;
        width: auto;
    }

    [data-scrutins-admin] .table td.table-actions .row {
        flex-wrap: wrap !important;
    }

    .row > .btn,
    .row > a.btn {
        max-width: 100%;
    }
}

@media (max-width: 420px) {
    .hero-title {
        font-size: 1.7rem;
    }

    .screen-stat-value {
        font-size: 1.7rem;
    }

    .screen-stat-label {
        font-size: .82rem;
    }

    .result-numbers {
        font-size: .9rem;
    }
}

/* Aucun débordement horizontal (pseudo-éléments décoratifs compris). */
html,
body {
    overflow-x: clip;
}

/* ------------------------------------- Choix du scrutin (résultats, écran) */

.results-picker {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: .5rem 1rem;
    margin: 0 0 1.1rem;
}

.results-picker .label {
    margin: 0;
}

@media (max-width: 560px) {
    .results-picker .segmented {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        width: 100%;
    }
}

.page-head .lead + .results-picker {
    margin-top: 1.1rem;
}

/* ---------------------------------------------- Page de direct (écran) */

.check-inline {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    font-weight: 600;
    color: var(--ink-2);
    cursor: pointer;
}

.check-inline input {
    width: 1.05rem;
    height: 1.05rem;
    accent-color: var(--brand);
}

.screen-top {
    position: relative;
    display: flex;
    align-items: center;
    gap: .6rem 1.4rem;
    flex-wrap: wrap;
    padding-bottom: 1.6vh;
    margin-bottom: 2vh;
    border-bottom: 1px solid var(--line);
    font-size: clamp(.9rem, .8rem + .35vw, 1.15rem);
    color: var(--muted);
}

.screen-logo {
    height: clamp(26px, 1.6rem + 1vw, 44px);
    width: auto;
}

.screen-live {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    padding: .25rem .7rem;
    border: 1px solid #b9dcc8;
    border-radius: var(--radius);
    background: #eef7f1;
    color: #17633d;
    font-weight: 700;
}

.screen-live.is-off {
    border-color: var(--line);
    background: var(--sunken);
    color: var(--ink-2);
}

.screen-last {
    font-weight: 600;
}

.screen-clock {
    margin-left: auto;
    font-size: clamp(1.1rem, .9rem + .9vw, 1.8rem);
    font-weight: 700;
    color: var(--ink);
    letter-spacing: .02em;
}

/* Barre de progression du défilement automatique. */
.screen-rotate-bar {
    position: absolute;
    left: 0;
    right: 0;
    bottom: -1px;
    height: 3px;
    display: none;
}

.is-rotating .screen-rotate-bar {
    display: block;
}

.screen-rotate-bar span {
    display: block;
    height: 100%;
    width: 0;
    background: var(--brand);
    transition: width 250ms linear;
}

.screen-head h1 {
    font-size: clamp(2.1rem, 1.2rem + 3vw, 4rem);
    line-height: 1.05;
}

.screen-head .eyebrow {
    color: var(--muted);
    font-weight: 600;
}

.screen-stat-value {
    font-size: clamp(2.4rem, 1.4rem + 3vw, 4.4rem);
}

.screen .card-lead {
    font-size: clamp(1.1rem, .9rem + .8vw, 1.7rem);
    font-weight: 700;
    color: var(--ink);
}

.screen .results .muted {
    font-size: clamp(1.1rem, .9rem + .8vw, 1.6rem);
    padding: 3vh 0;
}

.screen .turnout-value {
    font-size: clamp(2.6rem, 1.6rem + 3vw, 4.6rem);
}

.screen .turnout-bar {
    height: 16px;
}

.screen-index {
    font-weight: 600;
    color: var(--ink-2);
}

.screen-footer {
    margin-top: auto;
}

@media (max-width: 700px) {
    .screen-clock {
        margin-left: 0;
    }
}

/* ------------------------------------------------ Cartes des scrutins */

[data-scrutins-home] {
    gap: 1.1rem;
}

.sc-card {
    position: relative;
    display: flex;
    flex-direction: column;
    background: #fff;
    border: 1px solid var(--line);
    border-top: 4px solid var(--brand);
    border-radius: var(--radius);
    padding: 1.4rem 1.5rem 1.3rem;
    /* Double filet intérieur, comme un encadré officiel. */
    box-shadow: inset 0 0 0 5px #fff, inset 0 0 0 6px var(--sunken);
    transition: border-color var(--feedback) var(--ease);
}

.sc-card:hover {
    border-color: var(--line-strong);
    border-top-color: var(--brand);
}

.sc-card.sc-closed {
    border-top-color: var(--ink-2);
}

.sc-card.sc-draft {
    border-top-color: var(--line-strong);
}

.sc-head {
    display: flex;
    align-items: center;
    gap: .9rem;
}

.sc-icon {
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    flex: none;
    border-radius: var(--radius);
    background: var(--brand-50);
    border: 1px solid var(--brand-100);
    color: var(--brand);
}

.sc-icon svg {
    width: 26px;
    height: 26px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.6;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.sc-closed .sc-icon,
.sc-draft .sc-icon {
    background: var(--sunken);
    border-color: var(--line);
    color: var(--ink-2);
}

.sc-title {
    min-width: 0;
    flex: 1;
}

.sc-kicker {
    display: block;
    font-size: .85rem;
    font-weight: 600;
    color: var(--muted);
    line-height: 1.2;
}

.sc-title h3 {
    margin: 0;
    font-size: 1.45rem;
    font-weight: 700;
    letter-spacing: -.01em;
    line-height: 1.15;
}

.sc-head .badge {
    align-self: flex-start;
}

.sc-desc {
    margin: 1rem 0 1.1rem;
    color: var(--ink-2);
    font-size: .98rem;
    line-height: 1.5;
}

.sc-facts {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin: 0 0 1.2rem;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
}

.sc-facts > div {
    padding: .75rem .9rem;
}

.sc-facts > div + div {
    border-left: 1px solid var(--line);
}

.sc-facts > div:first-child {
    padding-left: 0;
}

.sc-facts dt {
    font-size: .82rem;
    font-weight: 600;
    color: var(--muted);
}

.sc-facts dd {
    margin: .15rem 0 0;
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.1;
    color: var(--ink);
}

.sc-facts .sc-code {
    font-size: 1.1rem;
    letter-spacing: .12em;
    padding-top: .25rem;
}

.sc-foot {
    margin-top: auto;
}

.sc-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .6rem;
}

.sc-actions .btn {
    flex: 1 1 140px;
}

.btn.sc-off,
.btn.sc-off:disabled {
    background: var(--sunken);
    color: var(--faint);
    border-color: var(--line);
    opacity: 1;
    cursor: not-allowed;
}

.sc-done {
    flex: 1 1 140px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .45rem;
    padding: .7rem 1rem;
    border: 1px solid #b9dcc8;
    border-radius: var(--radius-sm);
    background: #eef7f1;
    color: #17633d;
    font-weight: 700;
}

.sc-done::before {
    content: "";
    width: .9em;
    height: .9em;
    background: currentColor;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M6.2 11.6 2.6 8l1.4-1.4 2.2 2.2 5.8-5.8L13.4 4.4z'/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M6.2 11.6 2.6 8l1.4-1.4 2.2 2.2 5.8-5.8L13.4 4.4z'/%3E%3C/svg%3E") center / contain no-repeat;
}

.sc-note {
    margin: .75rem 0 0;
    font-size: .88rem;
    color: var(--muted);
}

.sc-note b {
    color: var(--ink);
    letter-spacing: .06em;
}

@media (max-width: 420px) {
    .sc-card {
        padding: 1.2rem 1.1rem 1.1rem;
    }

    .sc-facts > div {
        padding: .65rem .55rem;
    }

    .sc-facts dd {
        font-size: 1.3rem;
    }
}

[data-scrutins-home] {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.sc-actions .btn,
.sc-done {
    white-space: nowrap;
}

@media (max-width: 760px) {
    [data-scrutins-home] {
        grid-template-columns: minmax(0, 1fr);
    }
}

/* Chiffres et boutons alignés d'une carte à l'autre. */
.sc-desc {
    flex: 1 0 auto;
}

/* ----------------------------------------------------- Bouton de langue */

.lang-toggle {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    margin-left: .4rem;
    padding: .4rem .75rem;
    font: inherit;
    font-size: .9rem;
    font-weight: 600;
    color: var(--ink-2);
    background: #fff;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    cursor: pointer;
}

.lang-toggle::before {
    content: "";
    width: 1em;
    height: 1em;
    background: currentColor;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M3 12h18M12 3a14 14 0 0 1 0 18M12 3a14 14 0 0 0 0 18'/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M3 12h18M12 3a14 14 0 0 1 0 18M12 3a14 14 0 0 0 0 18'/%3E%3C/svg%3E") center / contain no-repeat;
}

.lang-toggle:hover {
    border-color: var(--ink-2);
}

.lang-toggle:focus-visible {
    outline: none;
    box-shadow: var(--focus);
}

.splash-card {
    position: relative;
}

.splash-lang {
    position: absolute;
    top: 1rem;
    right: 1rem;
    margin: 0;
}

.lang-short {
    display: none;
}

@media (max-width: 560px) {
    .nav .lang-toggle {
        padding: .35rem .5rem;
    }

    .nav .lang-long {
        display: none;
    }

    .nav .lang-short {
        display: inline;
    }
}

/* ------------------------- Score live : les quatre scrutins en cadres */

.live-all[hidden],
[data-screen-single][hidden] {
    display: none;
}

.live-all-head {
    padding-bottom: 1.6vh;
    margin-bottom: 2.2vh;
    border-bottom: 2px solid var(--ink);
}

.live-all-head .eyebrow {
    color: var(--muted);
    font-weight: 600;
}

.live-all-head h1 {
    margin: 0;
    font-size: clamp(1.8rem, 1.1rem + 2.2vw, 3.2rem);
    font-weight: 700;
    line-height: 1.08;
}

.live-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 2vh 1.6vw;
}

.live-frame {
    display: flex;
    flex-direction: column;
    background: #fff;
    border: 1px solid var(--line);
    border-top: 5px solid var(--brand);
    border-radius: var(--radius);
    padding: clamp(.9rem, .6rem + 1vw, 1.5rem);
    box-shadow: inset 0 0 0 5px #fff, inset 0 0 0 6px var(--sunken);
}

.live-frame.live-closed {
    border-top-color: var(--ink-2);
}

.live-frame.live-draft {
    border-top-color: var(--line-strong);
}

.live-frame-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.live-frame-kicker {
    display: block;
    font-size: clamp(.8rem, .7rem + .3vw, 1rem);
    font-weight: 600;
    color: var(--muted);
}

.live-frame-head h2 {
    margin: 0;
    font-size: clamp(1.5rem, 1rem + 1.4vw, 2.4rem);
    font-weight: 700;
    line-height: 1.05;
    letter-spacing: -.01em;
}

.live-frame-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: .35rem;
}

.live-frame-code {
    font-weight: 700;
    letter-spacing: .14em;
    color: var(--ink-2);
    font-size: clamp(.85rem, .75rem + .3vw, 1.05rem);
}

.live-frame-stats {
    display: grid;
    grid-template-columns: auto auto minmax(0, 1fr);
    margin: 1.4vh 0 1.2vh;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
}

.live-frame-stats > div {
    padding: 1vh 1rem;
}

.live-frame-stats > div:first-child {
    padding-left: 0;
}

.live-frame-stats > div + div {
    border-left: 1px solid var(--line);
}

.live-frame-stats b {
    display: block;
    font-size: clamp(1.4rem, 1rem + 1.2vw, 2.3rem);
    font-weight: 700;
    line-height: 1.05;
}

.live-frame-stats span {
    font-size: clamp(.78rem, .7rem + .25vw, .95rem);
    font-weight: 600;
    color: var(--muted);
}

.live-frame-bar {
    display: block;
    height: 6px;
    margin-top: .45rem;
    background: #e6e9ee;
    border-radius: 2px;
    overflow: hidden;
}

.live-frame-bar > i {
    display: block;
    height: 100%;
    background: var(--brand);
}

.live-frame-winner {
    margin: 0 0 1vh;
    padding: .6rem .8rem;
    border: 1px solid var(--line);
    border-left: 4px solid var(--brand);
    border-radius: var(--radius);
    font-size: clamp(1rem, .85rem + .6vw, 1.45rem);
}

.live-frame-winner span {
    color: var(--brand);
    font-weight: 700;
    font-size: .8em;
    margin-right: .3rem;
}

.live-frame-empty {
    margin: 1vh 0 0;
    color: var(--muted);
    font-size: clamp(.95rem, .85rem + .4vw, 1.25rem);
}

.live-frame-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.live-frame-list li {
    display: grid;
    grid-template-columns: 1.6rem minmax(0, 1fr) auto 4.2rem;
    align-items: baseline;
    column-gap: .7rem;
    padding: .9vh 0 .8vh;
    border-bottom: 1px solid var(--line);
}

.live-frame-list li:last-child {
    border-bottom: 0;
}

.live-rank {
    font-weight: 700;
    color: var(--faint);
    font-size: clamp(.95rem, .85rem + .4vw, 1.3rem);
}

.live-frame-list .is-leader .live-rank {
    color: var(--brand);
}

.live-name {
    font-weight: 700;
    font-size: clamp(1rem, .85rem + .6vw, 1.5rem);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.live-votes {
    color: var(--muted);
    font-size: clamp(.85rem, .75rem + .3vw, 1.05rem);
    white-space: nowrap;
}

.live-votes b {
    position: relative;
    display: inline-block;
    color: var(--ink);
    font-size: clamp(1.15rem, .95rem + .8vw, 1.8rem);
}

.live-pct {
    text-align: right;
    color: var(--ink-2);
    font-size: clamp(.85rem, .75rem + .3vw, 1.05rem);
    white-space: nowrap;
}

.live-track {
    grid-column: 2 / -1;
    display: block;
    height: 8px;
    margin-top: .5vh;
    background: #e6e9ee;
    border-radius: 2px;
    overflow: hidden;
}

.live-track > i {
    display: block;
    height: 100%;
    background: #8a939f;
}

.live-frame-list .is-leader .live-track > i {
    background: var(--brand);
}

.live-frame-list .is-bumped {
    animation: live-bump 1.2s var(--ease);
}

@keyframes live-bump {
    from { background: var(--brand-50); }
    to { background: transparent; }
}

@media (prefers-reduced-motion: reduce) {
    .live-frame-list .is-bumped {
        animation: none;
    }
}

@media (max-width: 860px) {
    .live-grid {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (max-width: 420px) {
    .live-frame-stats {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .live-frame-stats > div {
        padding: .7rem .5rem;
    }

    .live-frame-list li {
        grid-template-columns: 1.3rem minmax(0, 1fr) auto 3.6rem;
        column-gap: .45rem;
    }
}

/* Mode « tous les scrutins » : tout tient sur un écran 16:9. */
.is-all .screen-top {
    margin-bottom: 1.4vh;
    padding-bottom: 1.2vh;
}

.live-all-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: .2rem 1.5rem;
    padding-bottom: 1.1vh;
    margin-bottom: 1.6vh;
}

.live-all-head h1 {
    font-size: clamp(1.5rem, 1rem + 1.5vw, 2.4rem);
}

.live-all-head .eyebrow {
    order: 2;
    margin: 0;
}

.live-grid {
    gap: 1.6vh 1.4vw;
}

.live-frame {
    padding: clamp(.8rem, .5rem + .7vw, 1.2rem) clamp(.9rem, .6rem + .8vw, 1.4rem);
}

.live-frame-head h2 {
    font-size: clamp(1.35rem, .95rem + 1.1vw, 2rem);
}

.live-frame-meta {
    flex-direction: row;
    align-items: center;
    gap: .7rem;
}

.live-frame-stats {
    margin: 1vh 0 .6vh;
}

.live-frame-stats > div {
    padding: .7vh .9rem;
}

.live-frame-stats b {
    font-size: clamp(1.25rem, .9rem + 1vw, 1.9rem);
}

.live-frame-winner {
    margin: .4vh 0 .6vh;
    padding: .45rem .75rem;
}

.live-frame-list li {
    padding: .55vh 0 .5vh;
}

.live-name {
    font-size: clamp(.98rem, .82rem + .5vw, 1.35rem);
}

.live-votes b {
    font-size: clamp(1.05rem, .9rem + .6vw, 1.55rem);
}

.live-track {
    height: 6px;
    margin-top: .35vh;
}

.is-all .screen-footer {
    margin-top: 1.6vh;
    padding-top: 1.2vh;
}

.screen-demo:fullscreen.is-all .screen-qr {
    width: clamp(70px, 5.5vw, 100px);
}

.screen-join-code[hidden] {
    display: none;
}

.is-all .screen-footer {
    font-size: clamp(.85rem, .75rem + .3vw, 1.05rem);
}

.screen-demo:fullscreen.is-all .screen-wrap {
    padding-top: 1.8vh;
    padding-bottom: 1.2vh;
}

.screen-demo:fullscreen.is-all .screen-qr {
    width: clamp(64px, 4.6vw, 88px);
}

.is-all .screen-footer {
    margin-top: 1.2vh;
    padding-top: .9vh;
}

.is-all .live-grid {
    gap: 1.3vh 1.4vw;
}

.admin-list {
    list-style: none;
    margin: 0;
    padding: 0;
    border-top: 1px solid var(--line);
}

.admin-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .6rem;
    padding: .55rem 0;
    border-bottom: 1px solid var(--line);
    overflow-wrap: anywhere;
}

/* ------------------------------------------- Compte votant (en ligne) */

.voter-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .6rem;
}

.link-button {
    margin-top: .8rem;
    padding: 0;
    font: inherit;
    font-size: .92rem;
    color: var(--brand);
    background: none;
    border: 0;
    text-decoration: underline;
    cursor: pointer;
}

.voter-or {
    display: flex;
    align-items: center;
    gap: .8rem;
    margin: 1.2rem 0;
    color: var(--muted);
    font-size: .9rem;
}

.voter-or::before,
.voter-or::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--line);
}

.voter-step {
    padding: .9rem 1rem;
    margin-bottom: 1rem;
    border: 1px solid var(--line);
    border-left: 4px solid var(--brand);
    border-radius: var(--radius);
}

.voter-step p:last-child {
    margin-bottom: 0;
}

@media (max-width: 420px) {
    .voter-actions {
        grid-template-columns: minmax(0, 1fr);
    }
}

.hero-cta {
    margin: 1.4rem 0 0;
}
