:root {
    --fond: #fbf7f0;
    --carte: #ffffff;
    --bord: #eadfce;
    --texte: #2a211c;
    --discret: #6b5d52;
    --rouge: #b3262e;
    --rouge-fonce: #8f1d24;
    --vert: #1f5f45;
    --vert-clair: #e5f1ea;
    --erreur-fond: #fbe9e9;
    --or: #f2c14e;
    --puce: #f6eee2;
    --ombre: 0 1px 2px rgba(60, 40, 20, 0.06), 0 6px 20px rgba(60, 40, 20, 0.06);
    --titre: Georgia, 'Iowan Old Style', 'Palatino Linotype', 'Times New Roman', serif;
    --corps: system-ui, -apple-system, 'Segoe UI', Roboto, 'Noto Sans', sans-serif;
}

@media (prefers-color-scheme: dark) {
    :root {
        --fond: #14110f;
        --carte: #1f1b18;
        --bord: #3a322b;
        --texte: #f3ece2;
        --discret: #b3a596;
        --rouge: #e0525a;
        --rouge-fonce: #f07a80;
        --vert: #7cc8a2;
        --vert-clair: #1d3027;
        --erreur-fond: #3a1d1f;
        --puce: #2a2420;
        --ombre: none;
    }
}

* {
    box-sizing: border-box;
}

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

body {
    margin: 0;
    background: var(--fond);
    color: var(--texte);
    font: 17px/1.5 var(--corps);
}

.ruban {
    height: 10px;
    background: repeating-linear-gradient(135deg, #b3262e 0 14px, #ffffff 14px 28px);
}

.entete {
    max-width: 560px;
    margin: 0 auto;
    padding: 32px 16px 8px;
    text-align: center;
}

.entete h1 {
    margin: 8px 0 6px;
    font: 700 2.1rem/1.15 var(--titre);
    color: var(--rouge);
}

.entete p {
    margin: 0 auto;
    max-width: 32em;
    color: var(--discret);
}

.entete.compacte {
    padding-top: 20px;
}

.entete.compacte h1 {
    font-size: 1.6rem;
}

.icone {
    width: 56px;
    height: 56px;
}

.compacte .icone {
    width: 40px;
    height: 40px;
}

.nav {
    display: flex;
    justify-content: center;
    gap: 20px;
    align-items: center;
    font-size: 0.95rem;
}

main {
    max-width: 560px;
    margin: 0 auto;
    padding: 16px 16px 48px;
}

.carte {
    background: var(--carte);
    border: 1px solid var(--bord);
    border-radius: 14px;
    padding: 20px;
    margin: 0 0 16px;
    box-shadow: var(--ombre);
}

.carte.attention {
    border-color: var(--rouge);
    border-width: 2px;
}

.carte.discrete {
    background: transparent;
    box-shadow: none;
}

.carte h2 {
    margin: 0 0 12px;
    font: 700 1.25rem/1.3 var(--titre);
    display: flex;
    align-items: center;
    gap: 10px;
}

.carte > p {
    margin: 0 0 12px;
}

.carte > p:last-child {
    margin-bottom: 0;
}

.compte {
    font: 600 0.85rem/1 var(--corps);
    background: var(--puce);
    color: var(--discret);
    border-radius: 999px;
    padding: 5px 10px;
}

.aide,
.facultatif,
.discret,
.vide {
    color: var(--discret);
}

.aide {
    display: block;
    font-size: 0.9rem;
    font-weight: 400;
}

p.aide {
    margin: 12px 0 0;
}

.carte > p.aide.intro {
    margin: -4px 0 12px;
}

.vide {
    margin: 0;
    font-style: italic;
}

/* ---------------------------------------------------------- formulaires */

.formulaire {
    display: grid;
    gap: 14px;
}

label {
    display: grid;
    gap: 6px;
    font-weight: 600;
}

.facultatif {
    font-weight: 400;
}

input,
select {
    font: inherit;
    font-weight: 400;
    color: var(--texte);
    background: var(--fond);
    border: 1px solid var(--bord);
    border-radius: 10px;
    padding: 11px 12px;
    width: 100%;
    min-width: 0;
}

input:focus,
select:focus {
    outline: 2px solid var(--rouge);
    outline-offset: 1px;
    border-color: transparent;
}

button,
.bouton {
    font: 600 1rem/1.2 var(--corps);
    display: inline-block;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    border: 0;
    border-radius: 10px;
    padding: 12px 18px;
    background: var(--rouge);
    color: #ffffff;
}

button:hover,
.bouton:hover {
    background: var(--rouge-fonce);
}

@media (prefers-color-scheme: dark) {
    button,
    .bouton {
        color: #1a0f0f;
    }
}

button.secondaire,
.bouton.secondaire {
    background: transparent;
    color: var(--texte);
    border: 1px solid var(--bord);
}

button.secondaire:hover,
.bouton.secondaire:hover {
    background: var(--puce);
}

button.danger {
    background: var(--rouge-fonce);
}

button.lien {
    background: none;
    color: var(--rouge);
    padding: 0;
    font-weight: 400;
    text-decoration: underline;
}

a {
    color: var(--rouge);
}

.en-ligne {
    display: inline;
    margin: 0;
}

.boutons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 4px;
}

.paire {
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    margin-top: 12px;
}

.paire button {
    grid-column: 1 / -1;
}

.piege {
    position: absolute;
    left: -10000px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

/* ---------------------------------------------------------- messages */

.message {
    border-radius: 12px;
    padding: 12px 16px;
    margin: 0 0 16px;
}

.message.ok {
    background: var(--vert-clair);
    color: var(--vert);
}

.message.erreur {
    background: var(--erreur-fond);
    color: var(--rouge);
}

.ok-texte {
    color: var(--vert);
}

.erreur-texte {
    color: var(--rouge);
    font-weight: 600;
}

/* ---------------------------------------------------------- listes */

.noms {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.noms li {
    background: var(--puce);
    border-radius: 999px;
    padding: 6px 14px;
}

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

.ligne {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px 12px;
    padding: 12px 0;
    border-top: 1px solid var(--bord);
}

.ligne:first-child {
    border-top: 0;
    padding-top: 0;
}

.qui {
    display: grid;
    gap: 2px;
    min-width: 0;
    overflow-wrap: anywhere;
}

.qui span {
    font-size: 0.92rem;
}

.qui .paire-noms {
    font-size: 1rem;
}

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

.actions button,
.actions .bouton {
    padding: 8px 14px;
    font-size: 0.92rem;
}

details {
    order: 2;
    width: 100%;
}

.actions details {
    order: 0;
    width: auto;
}

details[open] {
    flex-basis: 100%;
}

summary {
    cursor: pointer;
    color: var(--rouge);
    font-size: 0.92rem;
    padding: 8px 4px;
}

details .formulaire {
    margin: 8px 0 4px;
}

/* ---------------------------------------------------------- fiche à montrer */

.revelation {
    background: var(--rouge);
    color: #ffffff;
}

.revelation .ruban {
    background: repeating-linear-gradient(135deg, #ffffff 0 14px, var(--rouge) 14px 28px);
}

.secret {
    min-height: calc(100vh - 10px);
    min-height: calc(100dvh - 10px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 8px;
}

.secret .icone {
    width: 88px;
    height: 88px;
    padding: 14px;
    margin-bottom: 8px;
    background: #ffffff;
    border-radius: 50%;
}

.secret .pour {
    font-size: 1.3rem;
    margin: 0;
}

.secret .receveur {
    font: 700 clamp(2.6rem, 12vw, 4.5rem) / 1.1 var(--titre);
    margin: 4px 0 16px;
    overflow-wrap: anywhere;
}

.secret .bouton {
    margin-top: 24px;
    background: #ffffff;
    color: #8f1d24;
}

@media (prefers-color-scheme: dark) {
    .revelation {
        background: #7a1a20;
    }
    .revelation .ruban {
        background: repeating-linear-gradient(135deg, #ffffff 0 14px, #7a1a20 14px 28px);
    }
}

/* ---------------------------------------------------------- revoir son tirage */

[hidden] {
    display: none !important;
}

.noms.liens li {
    background: none;
    padding: 0;
}

.noms.liens a {
    display: block;
    padding: 9px 16px;
    border-radius: 999px;
    background: var(--puce);
    border: 1px solid var(--bord);
    color: var(--texte);
    text-decoration: none;
    font-weight: 600;
}

.noms.liens a:hover,
.noms.liens a:focus-visible {
    border-color: var(--rouge);
    color: var(--rouge);
}

.chiffres {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin: 4px 0 8px;
}

.chiffre {
    min-height: 76px;
    font: 700 2rem/1 var(--titre);
    background: var(--puce);
    color: var(--texte);
    border: 2px solid var(--bord);
}

.chiffre:hover {
    background: var(--puce);
    border-color: var(--rouge);
}

.chiffre.bon,
.chiffre.bon:hover {
    background: var(--vert);
    border-color: var(--vert);
    color: #ffffff;
    cursor: default;
}

@media (prefers-color-scheme: dark) {
    .chiffre.bon,
    .chiffre.bon:hover {
        color: #10201a;
    }
}

.secoue {
    animation: secouer 0.35s ease-in-out;
}

@keyframes secouer {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-8px); }
    40%, 80% { transform: translateX(8px); }
}

.note-jeu {
    min-height: 1.5em;
    margin: 0;
}

.ecran-secret {
    position: fixed;
    inset: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
    text-align: center;
    background: #b3262e;
    color: #ffffff;
}

.decompte p {
    margin: 0;
    font-size: 1.4rem;
}

.decompte .chiffre-decompte {
    font: 700 clamp(6rem, 40vw, 11rem) / 1 var(--titre);
    margin-top: 12px;
}

.resultat .pour {
    font-size: 1.3rem;
    margin: 0;
}

.resultat .receveur {
    font: 700 clamp(2.6rem, 13vw, 5rem) / 1.1 var(--titre);
    margin: 8px 0 16px;
    overflow-wrap: anywhere;
}

.barre {
    width: min(320px, 80vw);
    height: 6px;
    margin: 28px auto 0;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.3);
    overflow: hidden;
}

.barre span {
    display: block;
    height: 100%;
    background: #ffffff;
    transform-origin: left;
}

.barre span.file {
    animation: vider linear forwards;
}

@keyframes vider {
    from { transform: scaleX(1); }
    to { transform: scaleX(0); }
}

@media (prefers-color-scheme: dark) {
    .ecran-secret {
        background: #7a1a20;
    }
}

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