:root {
    --gauche: #e63946;
    --droite: #0077b6;
    --fond:   #f4f1ea;
    --texte:  #1a1a1a;
    --transition: 0.5s cubic-bezier(.22,1,.36,1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Helvetica Neue', Arial, sans-serif;
    background: var(--fond);
    color: var(--texte);
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
}

/* Le split */
.split {
    display: flex;
    height: 100vh;
    height: 100dvh;
    width: 100vw;
    position: relative;
}

.cote {
    flex: 1;
    border: none;
    cursor: pointer;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: flex var(--transition), filter .3s;
    position: relative;
    overflow: hidden;
}
.cote--gauche { background: var(--gauche); }
.cote--droite { background: var(--droite); }

.cote:hover { filter: brightness(1.08); }
.split.vote-fait .cote { cursor: default; }
.split.vote-fait .cote:hover { filter: none; }

/* Retour à la question suivante : transition plus rapide */
.split:not(.vote-fait) .cote {
    transition: flex .45s cubic-bezier(.22,1,.36,1), filter .3s;
}

.cote__contenu {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 20px;
    width: 100%;
    text-align: center;
    word-break: break-word;
    overflow-wrap: break-word;
}

/* Typos perso pour chaque camp */
.cote--gauche .cote__label {
    font-family: 'Dancing Script', cursive;
    font-weight: 700;
    text-transform: none;
    font-size: clamp(2.2rem, 6vw, 4rem);
    letter-spacing: 0;
}
.cote--droite .cote__label {
    font-family: 'Archivo Black', sans-serif;
    font-weight: 400;
    text-transform: uppercase;
    font-size: clamp(1.6rem, 4.5vw, 3rem);
    letter-spacing: 1px;
}

/* Empêche la coupure verticale du texte (type "ROIT") */
.cote__label, .cote__pct {
    white-space: nowrap;
    max-width: 100%;
}

/* Une fois le vote affiché, on réduit les labels et % */
.split.vote-fait .cote--gauche .cote__label {
    font-size: clamp(1.6rem, 3.5vw, 3rem);
}
.split.vote-fait .cote--droite .cote__label {
    font-size: clamp(1.1rem, 2.6vw, 2rem);
}
.split.vote-fait .cote__pct {
    font-size: clamp(1.6rem, 4.5vw, 3.5rem);
}

.cote__pct {
    font-size: clamp(2rem, 7vw, 4.5rem);
    font-weight: 800;
}
.cote.gagnant .cote__pct { text-shadow: 0 2px 20px rgba(0,0,0,.3); }

/* Sélecteur de catégorie (haut gauche) */
.cat-box {
    position: absolute;
    top: 24px;
    left: 24px;
    z-index: 6;
}
.cat-select {
    appearance: none;
    -webkit-appearance: none;
    background: rgba(255,255,255,.92);
    color: var(--texte);
    border: none;
    padding: 11px 38px 11px 16px;
    border-radius: 30px;
    font-size: .9rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(0,0,0,.2);
    transition: transform .15s, background .2s;
    /* petite flèche custom */
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%231a1a1a' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'></polyline></svg>");
    background-repeat: no-repeat;
    background-position: right 14px center;
}
.cat-select:hover { transform: translateY(-2px); background-color: #fff; }
.cat-select:focus { outline: none; }

/* Question EN HAUT */
.question-box {
    position: absolute;
    top: 40px; left: 50%;
    transform: translateX(-50%);
    z-index: 5;
    text-align: center;
    width: min(90%, 560px);
    pointer-events: none;
}
.question {
    background: var(--fond);
    padding: 22px 30px;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,.25);
}
.question__texte {
    font-size: clamp(1.3rem, 3.2vw, 2rem);
    font-weight: 700;
    line-height: 1.3;
}

/* "suggéré par" (dans la bulle blanche) */
.auteur {
    margin-top: 6px;
    font-style: italic;
    font-weight: 400;
    font-size: clamp(.8rem, 1.6vw, .95rem);
    color: #888;
}

.btn-suivant {
    pointer-events: auto;
    margin-top: 16px;
    background: var(--texte);
    color: #fff;
    border: none;
    padding: 14px 28px;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform .15s, opacity .3s;
}
.btn-suivant:hover { transform: translateY(-2px); }

/* Logo EN BAS */
.bottombar {
    position: absolute;
    bottom: 24px; left: 50%;
    transform: translateX(-50%);
    z-index: 5;
    pointer-events: none;
}
.logo-img {
    height: 70px;
    width: auto;
    display: block;
    /* Décommente si le logo manque de lisibilité sur la jointure rouge/bleu :
    background: rgba(255,255,255,.92); padding: 10px 18px; border-radius: 12px;
    box-shadow: 0 6px 20px rgba(0,0,0,.18); */
}

/* Bouton suggérer (bas droite) */
.btn-suggestion {
    position: absolute;
    bottom: 24px;
    right: 24px;
    z-index: 6;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(255,255,255,.92);
    color: var(--texte);
    border: none;
    padding: 12px 18px;
    border-radius: 30px;
    font-size: .95rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(0,0,0,.2);
    transition: transform .15s, background .2s;
}
.btn-suggestion:hover { transform: translateY(-2px); background: #fff; }
.btn-suggestion__plus { font-size: 1.1rem; line-height: 1; }

/* ===================== APPRÉCIATION (bas gauche) ===================== */
.appreciation {
    position: absolute;
    bottom: 24px;
    left: 24px;
    z-index: 6;
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255,255,255,.92);
    color: var(--texte);
    padding: 10px 14px;
    border-radius: 30px;
    box-shadow: 0 6px 20px rgba(0,0,0,.2);
    opacity: 1;
    transition: opacity .4s ease;
}
.appreciation[hidden] { display: none; }
.appreciation.fade-out { opacity: 0; }

.appreciation__txt {
    font-size: .85rem;
    font-weight: 600;
    white-space: nowrap;
}
.appreciation__btns {
    display: flex;
    gap: 6px;
}
.appr-btn {
    background: none;
    border: none;
    font-size: 1.3rem;
    line-height: 1;
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 8px;
    transition: transform .15s, background .2s;
}
.appr-btn:hover {
    transform: scale(1.2);
    background: rgba(0,0,0,.06);
}
.appreciation__merci {
    font-size: .9rem;
    font-weight: 700;
    color: #2e7d32;
    white-space: nowrap;
}
.appreciation__merci[hidden] { display: none; }

/* Modale */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.55);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 50;
    padding: 20px;
}
.modal[hidden] { display: none; }
.modal__box {
    background: var(--fond);
    padding: 32px 28px;
    border-radius: 16px;
    width: min(94%, 440px);
    position: relative;
    box-shadow: 0 20px 60px rgba(0,0,0,.3);
}
.modal__close {
    position: absolute;
    top: 14px; right: 16px;
    background: none;
    border: none;
    font-size: 1.3rem;
    cursor: pointer;
    color: #888;
}
.modal__titre { font-size: 1.4rem; margin-bottom: 18px; }
.modal__form { display: flex; flex-direction: column; gap: 12px; }
.modal__form input {
    padding: 13px 14px;
    border: 1px solid #ccc;
    border-radius: 8px;
    font-size: 1rem;
}
.modal__form button {
    padding: 13px;
    background: var(--texte);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
}
.modal__msg { font-size: .9rem; }
.modal__msg.ok { color: #2e7d32; }
.modal__msg.err { color: #c0392b; }

/* RESPONSIVE TÉLÉPHONE */
@media (max-width: 768px) {
    .split { flex-direction: row; }

    .cote--gauche .cote__label { font-size: clamp(1.4rem, 7vw, 2.4rem); }
    .cote--droite .cote__label { font-size: clamp(1.1rem, 5.5vw, 2rem); }
    .cote__pct { font-size: clamp(1.6rem, 8vw, 3rem); }

    .split.vote-fait .cote--gauche .cote__label { font-size: clamp(1.2rem, 5vw, 2rem); }
    .split.vote-fait .cote--droite .cote__label { font-size: clamp(0.9rem, 4vw, 1.6rem); }
    .split.vote-fait .cote__pct { font-size: clamp(1.3rem, 6vw, 2.4rem); }

    /* Aligner "De gauche" et "DE DROITE" au même niveau */
    .cote { align-items: flex-start; }
    .cote__contenu {
        position: absolute;
        top: 45%;
        left: 0;
        right: 0;
        transform: translateY(-50%);
        padding: 0 8px;
        gap: 8px;
    }
    .cote--gauche .cote__label { line-height: 1; transform: translateY(2px); }
    .cote--droite .cote__label { line-height: 1; }

    /* Sélecteur de catégorie compact en haut */
    .cat-box {
        top: 14px;
        left: 50%;
        transform: translateX(-50%);
    }
    .cat-select {
        padding: 8px 32px 8px 14px;
        font-size: .8rem;
        max-width: 70vw;
    }

    /* QUESTION : on la descend un peu pour laisser la place au sélecteur */
    .question-box {
        top: 62px;
        left: 50%;
        transform: translateX(-50%);
        width: min(94%, 480px);
    }
    .question {
        padding: 18px 20px;
    }
    .question__texte {
        font-size: clamp(1.2rem, 5vw, 1.8rem);
    }

    /* LOGO EN BAS */
    .bottombar {
        bottom: 28px;
        bottom: calc(28px + env(safe-area-inset-bottom));
        top: auto;
    }
    .logo-img { height: 48px; }

    /* Bouton suggérer = juste un + rond sur mobile */
    .btn-suggestion {
        bottom: 18px;
        bottom: calc(18px + env(safe-area-inset-bottom));
        right: 16px;
        width: 48px;
        height: 48px;
        padding: 0;
        justify-content: center;
        border-radius: 50%;
        font-size: 1.6rem;
    }
    .btn-suggestion__txt { display: none; }
    .btn-suggestion__plus { font-size: 1.8rem; }

    /* Appréciation compacte sur mobile (juste les pouces) */
    .appreciation {
        bottom: 18px;
        bottom: calc(18px + env(safe-area-inset-bottom));
        left: 16px;
        padding: 8px 10px;
        gap: 6px;
    }
    .appreciation__txt { display: none; }
    .appr-btn { font-size: 1.4rem; }
}
