* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    /* Bloque le zoom accidentel sur mobile lors des "double-tap" */
    touch-action: manipulation;
}

/* 1. ON BLOQUE LA PAGE ENTIÈRE */
html,
body {
    margin: 0;
    height: 100vh;
    /* Fallback pour les vieux navigateurs */
    height: 100dvh;
    /* Hauteur dynamique stricte pour mobile */
    width: 100%;
    overflow-x: hidden;
    /* INTERDIT LE DÉFILEMENT GLOBAL */
    font-family: 'Inter Tight', sans-serif;
    display: flex;
    flex-direction: column;
    -webkit-text-size-adjust: 100%;
}

/* 2. LE HEADER */
header {
    width: 100%;
    display: flex;
    align-items: center;
    padding: 3vw 5vw;
    justify-content: space-between;
    flex-shrink: 0;
    background-color: #ffffff;
    z-index: 1000;
    user-select: none;
    -webkit-user-select: none;
}

header .logo-text {
    width: 30vw;
    /* Gère la largeur de ton logo de manière fluide */
    height: auto;
    pointer-events: none;
    /* Empêche de glisser l'image accidentellement */
}

header a {
    display: flex;
    align-items: center;
    -webkit-tap-highlight-color: transparent;
    /* Enlève le carré gris natif au clic sur mobile */
}

/* L'icône de déconnexion/connexion SVG */
header #logout {
    width: 8vw;
    max-width: 40px;
    height: auto;
    cursor: pointer;
    transition: transform 0.2s ease;
}

/* On cible UNIQUEMENT le logo avec sa classe */
header .logo-text {
    width: 30vw;
    pointer-events: none;
    /* Empêche de glisser l'image accidentellement */
}

/* On cible UNIQUEMENT l'icône de déconnexion */
header #logout img {
    width: 7vw;
    /* Taille adaptée pour une icône (à ajuster si besoin) */
    max-width: 35px;
    cursor: pointer;
    transition: transform 0.2s;
}

header #logout img:active {
    transform: scale(0.9);
    /* Petit effet d'appui quand on clique dessus */
}

/* 3. LA ZONE CENTRALE (Le secret de l'adaptation parfaite) */
.body {
    width: 100%;
    flex-grow: 1;
    display: flex;
    flex-direction: column;

    /* 🔴 CHANGEMENT ICI : On aligne en haut pour que le scroll fonctionne normalement */
    justify-content: flex-start;
    gap: 5vw;
    /* Crée l'espace automatique entre tes blocs */

    /* Active le scroll si le contenu dépasse (Formulaires, Avatars...) */
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;

    /* Marge de sécurité stricte de 110px pour ne JAMAIS toucher le footer */
    padding: 4vw 5vw calc(110px + env(safe-area-inset-bottom)) 5vw;
}

/* Masque la barre de défilement pour garder un look épuré "App" */
.body::-webkit-scrollbar {
    display: none;
}


/* =========================================================
   ACCUEIL ET INTRODUCTION (index.php)
   ========================================================= */
.logo {
    width: auto;
    max-width: 85%;
    max-height: 25vh;
    /* Le logo ne prendra jamais plus de 25% de l'écran */
    object-fit: contain;
    margin: 0 auto;
    display: block;
}

/* Boutons */
.buttons {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 4vw;
    /* Espace fixe entre les boutons */
    margin: 0;
}

.register-btn,
.login-btn,
.game-btn {
    -webkit-appearance: none;
    appearance: none;
    border: 2px solid #cc1b30;
    border-radius: 20px;
    background-color: transparent;
    width: 60vw;
    font-size: 6vw;
    padding: 3vw;
    color: #cc1b30;
    text-decoration: none;
    display: block;
    text-align: center;
    cursor: pointer;
    margin: 0;
}


/* =========================================================
   FORMULAIRES INSCRIPTION / CONNEXION
   ========================================================= */
form {
    display: flex;
    flex-direction: column;
    justify-content: space-evenly;
    flex-grow: 1;
    height: 100%;
}

h1 {
    text-align: center;
    margin: 0;
}

label {
    font-weight: 900;
}

.input {
    padding: 12px;
    margin-top: 2vw;
    background-color: #cc1b3060;
    color: #ffffff;
    border-radius: 10vw;
    overflow: hidden;

}

input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active {
    -webkit-text-fill-color: #000000;
    -webkit-box-shadow: 0 0 0px 1000px transparent inset;
    transition: background-color 5000s ease-in-out 0s;
}

.pseudo-container,
.email-container {
    margin-bottom: 0;
    width: 100%;
}

#pseudo,
#email {
    -webkit-appearance: none;
    appearance: none;
    background-color: transparent;
    border: transparent;
    height: 8vw;
    width: 100%;
    outline: none;

}

.login,
.register {
    text-align: center;
    margin: 0;
    font-size: 3.5vw;
    border: none;
    background: none;
}

.login a,
.register a {
    text-decoration: none;
    color: #cc1b30;
}

.message-success {
    color: #4b8549;
    text-align: center;
    font-weight: bold;
    margin: 2vw 0;
}

.message-error {
    color: #e74c3c;
    text-align: center;
    font-weight: bold;
    margin: 2vw 0;
}


/* =========================================================
   ACCUEIL JEU
   ========================================================= */
#logo-lobby {
    width: 80vw;
    /* Prend 80% de la largeur de l'écran */
    max-width: 350px;
    /* Ne devient pas gigantesque sur tablette/ordinateur */
    height: auto;
    /* Garde les bonnes proportions */
    max-height: 35vh;
    /* ⚠️ CRUCIAL : L'empêche de prendre plus de 35% de la hauteur de l'écran pour laisser la place au bouton */
    margin: 0 auto 4vw auto;
    /* Le centre horizontalement et laisse un petit espace en bas */
    display: block;
}

.welcome {
    /* Tes styles existants pour le texte "Bienvenue !" */
    color: #cc1b30;
    font-size: 10vw;
    font-weight: bold;
    text-align: center;
    margin: 0 auto;
}

.profils-img {
    margin: 0 auto;
}

.profils-img img {
    height: 10vw;
    display: block;
    margin: 0 auto;
}

.big-profil {
    background-color: #cc1b3040;
    border-radius: 100%;
    padding: 4vw;
    margin: 0 auto;
    width: fit-content;
}

.big-profil img {
    height: 50vw;
    display: block;
    margin: 0 auto;
}

.proposition-profils {
    margin: 0 auto;
}


/* =========================================================
   PAGE JEU SALONS
   ========================================================= */
.header-titles {
    text-align: center;
    margin: 0 0 5vw 0;
}

.title-main {
    font-size: 8vw;
    font-weight: 800;
    color: #000000;
    line-height: 1.1;
    letter-spacing: -1px;
    margin: 0;
}

.section-title {
    font-size: 4.5vw;
    font-weight: 400;
    color: #000000;
    margin-bottom: 2vw;
    text-align: left;
}

.section-block {
    margin-bottom: 4vw;
    width: 100%;
}

.room-list {
    display: flex;
    flex-direction: column;
    gap: 4vw;
}

.room-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 2px solid #cc1b30;
    border-radius: 25px;
    padding: 2vw 3vw 2vw 5vw;
    background-color: #ffffff;
}

.room-item .room-name {
    font-size: 4vw;
    color: #000000;
}

.room-item button {
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
    border: 1.5px solid #cc1b30;
    border-radius: 20px;
    padding: 1.5vw 4vw;
    font-size: 3.5vw;
    font-weight: 500;
    color: #000000;
    cursor: pointer;
    transition: all 0.2s ease;
}

.room-item button:active {
    background-color: #f0f0f0;
}

.creation-form {
    display: flex;
    flex-direction: column;
    text-align: left;
}

.creation-form label {
    font-size: 3.5vw;
    color: #000000;
    margin-bottom: 2vw;
}

.creation-form input[type="text"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    background-color: #f4b8be;
    border: none;
    border-radius: 20px;
    padding: 3vw 5vw;
    font-size: 4vw;
    color: #666666;
    margin-bottom: 4vw;
    outline: none;
}

.creation-form input[type="text"]::placeholder {
    color: #cc666e;
    opacity: 0.7;
}

.btn-center {
    display: flex;
    justify-content: center;
    width: 100%;
}

.btn-create {
    -webkit-appearance: none;
    appearance: none;
    background: #ffffff;
    border: 2px solid #cc1b30;
    border-radius: 20px;
    padding: 2.5vw 6vw;
    font-size: 4vw;
    font-weight: 500;
    color: #000000;
    cursor: pointer;
}


/* =========================================================
   JEU (PARTIE EN COURS)
   ========================================================= */


.game-top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    margin: 2vw 0 4vw 0;
}

.player-slot {
    display: flex;
    align-items: center;
    gap: 2vw;
    width: 35%;
}

.player-slot.right {
    justify-content: flex-end;
}

.avatar-circle {
    width: 12vw;
    height: 12vw;
    background-color: #cc1b3060;
    border: 2px solid #cc1b30;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    flex-shrink: 0;
}

.player-info-text {
    display: flex;
    flex-direction: column;
}

.text-right {
    text-align: right;
}

.player-name {
    font-size: 2.5vw;
    font-weight: 700;
    color: #000000;
}

.player-score {
    font-size: 3vw;
    font-weight: 500;
    color: #000000;
}

.timer-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 25%;
}

.timer-circle {
    width: 16vw;
    height: 16vw;
    border: 3px solid #cc1b30;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 7vw;
    font-weight: 800;
    color: #000000;
}

.question-header-title {
    font-size: 4.5vw;
    font-weight: 800;
    color: #000000;
    text-align: center;
    margin-bottom: 4vw;
}

.category-header-title {
    text-align: center;
    margin: 4vw 0;
}

.category-header-title .txt-win {
    font-size: 7vw;
    font-weight: 500;
    color: #000000;
    margin: 0;
    line-height: 1.1;
}

.category-header-title .txt-sub {
    font-size: 6.5vw;
    font-weight: 400;
    color: #000000;
    margin: 2vw 0 0 0;
    line-height: 1.2;
}

.ui-winner-label {
    font-size: 4.5vw;
    font-weight: 700;
    color: #cc1b30;
    text-align: center;
    margin-bottom: 3vw;
    text-transform: uppercase;
}

.question-statement-box {
    background-color: #f4b8be;
    border-radius: 25px;
    padding: 6vw 5vw;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 4vw;
}

.question-statement-box p {
    font-size: 3.5vw;
    font-weight: 500;
    color: #000000;
    text-align: center;
    line-height: 1.2;
    margin: 0;
}

.answers-stack {
    display: flex;
    flex-direction: column;
    gap: 3vw;
    width: 100%;
}

.btn-answer-stacked {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    background-color: #ffffff;
    border: 2px solid #cc1b30;
    border-radius: 25px;
    padding: 3.5vw 4vw;
    font-size: 4vw;
    font-weight: 400;
    color: #000000;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    outline: none;
    word-wrap: break-word;
}

.btn-answer-stacked.selected {
    background-color: #f0f0f0 !important;
    border-color: #999999 !important;
    color: #333333 !important;
}

.btn-answer-stacked.correct {
    background-color: #2bb94c !important;
    border-color: #cc1b30 !important;
    color: #ffffff !important;
    font-weight: 700 !important;
    opacity: 1 !important;
}

.btn-answer-stacked.wrong {
    background-color: #cc1b3040 !important;
    border-color: #cc1b30 !important;
    color: #cc1b30 !important;
    font-weight: 700 !important;
    opacity: 1 !important;
}

.answers-stack button:disabled {
    cursor: default;
}

.btn-quit-wrapper {
    display: flex;
    justify-content: center;
    margin-top: 4vw;
}

.btn-quit-maquette {
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
    border: none;
    color: #999999;
    font-size: 3.5vw;
    text-decoration: underline;
    cursor: pointer;
}


/* =========================================================
   COMPTE (PROFIL)
   ========================================================= */
.account-pseudo {
    text-align: center;
    font-size: 9vw;
    font-weight: 500;
    color: #222;
    margin: 4vw 0 1vw 0;
    letter-spacing: -1px;
}

.account-score {
    text-align: center;
    font-size: 6.5vw;
    font-weight: 500;
    color: #333;
    margin-bottom: 4vw;
}

.account-instruction {
    text-align: center;
    font-size: 4.5vw;
    font-weight: 400;
    color: #333;
    margin: 0 10vw 4vw 10vw;
    line-height: 1.3;
}

.account-big-avatar {
    width: 45vw;
    height: 45vw;
    max-width: 200px;
    max-height: 200px;
    background-color: #fce8ea;
    border: 2px solid #cc1b30;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 6vw auto;
}

.account-big-avatar svg {
    width: 65%;
    height: auto;
}

.account-avatars-list {
    display: flex;
    justify-content: center;
    gap: 5vw;
    margin-bottom: 6vw;
}

.account-small-avatar {
    width: 18vw;
    height: 18vw;
    max-width: 80px;
    max-height: 80px;
    background-color: #fce8ea;
    border: 2px solid #cc1b30;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.account-small-avatar:active {
    transform: scale(0.6);
}

.account-small-avatar svg {
    width: 60%;
    height: auto;
}

.account-infos {
    text-align: center;
    font-size: 4.5vw;
    color: #333;
    line-height: 1.5;
    margin-bottom: 4vw;
}

.account-infos strong {
    font-weight: 800;
}


/* =========================================================
   CLASSEMENT (LE SEUL QUI A LE DROIT DE SCROLLER)
   ========================================================= */
/* THE SCROLLABLE WRAPPER */
.body-leaderboard {
    width: 100%;
    flex-grow: 1;
    /* Remplace height: 100% pour occuper exactement l'espace restant */
    display: flex;
    flex-direction: column;
    overflow: hidden;
    /* Interdit le scroll ici pour éviter les conflits */
    /* Padding identique à votre classe .body pour ne pas passer sous le footer fixe */
    padding: 2vw 5vw calc(100px + env(safe-area-inset-bottom)) 5vw;
}

.page-title {
    text-align: center;
    font-size: 8vw;
    font-weight: 900;
    color: #cc1b30;
    margin: 0 0 4vw 0;
    text-transform: uppercase;
    flex-shrink: 0;
    /* Empêche le titre de se faire écraser ou de disparaître */
}

/* 2. LA ZONE DES SCORES (C'est elle, et uniquement elle, qui va scroller !) */
.leaderboard-container {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    /* Prend tout l'espace disponible sous le titre */
    overflow-y: auto;
    /* ACTIVE LE SCROLL VERTICAL ICI UNIQUEMENT */
    -webkit-overflow-scrolling: touch;
    /* Rend le scroll ultra fluide sur iOS */
}

/* Masque la barre de défilement pour garder un design épuré "App" */
.leaderboard-container::-webkit-scrollbar {
    display: none;
}

/* Le Podium (Reste intact, mais ne s'écrasera pas) */
.podium-wrapper {
    display: flex;
    justify-content: center;
    align-items: flex-end;
    gap: 2vw;
    height: 50vw;
    max-height: 250px;
    margin-bottom: 6vw;
    border-bottom: 3px solid #eee;
    flex-shrink: 0;
    /* Empêche le podium de se déformer lors du scroll de la liste */
}

.podium-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    width: 30%;
    border-radius: 15px 15px 0 0;
    padding: 3vw 1vw;
    text-align: center;
    position: relative;
}

.pod-rank {
    font-size: 8vw;
    font-weight: 900;
    margin-bottom: 2vw;
    line-height: 1;
}

.pod-rank svg.icon-trophee {
    height: 8vw;
    width: auto;
    /* Garde les proportions */
}

/* Si le trophée est aussi dans la liste classique */
.class-rank svg.icon-trophee {
    height: 5vw;
    /* Ou la taille que tu avais définie */
    width: auto;
}

.pod-name {
    font-size: 2.2vw;
    font-weight: bold;
    width: 95%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 1vw;
}

.pod-score {
    font-size: 3.6vw;
    font-weight: 900;
    margin-top: auto;
}

.pod-moi-txt {
    font-size: 2vw;
    opacity: 0.9;
    color: #2bb94c;
}

.step-1 {
    height: 100%;
    order: 2;
    background-color: #fce8ea;
    border: 2px solid #cc1b30;
    border-bottom: none;
    color: #cc1b30;
    z-index: 2;
}

.step-2 {
    height: 75%;
    order: 1;
    background-color: #fce8ea;
    border: 2px solid #cc1b30;
    border-bottom: none;
    color: #cc1b30;
    z-index: 1;
}

.step-3 {
    height: 60%;
    order: 3;
    background-color: #fce8ea;
    border: 2px solid #cc1b30;
    border-bottom: none;
    color: #cc1b30;
    z-index: 1;
}

.step-1.is-me {
    border: 3px solid #2bb94cc1;
    color: #2bb94c;
    box-shadow: 0 -4px 10px rgba(43, 185, 76, 0.3);
}

.step-2.is-me,
.step-3.is-me {
    border-color: #2bb94c;
    color: #2bb94c;
}

/* La Liste */
.list-wrapper {
    display: flex;
    flex-direction: column;
    gap: 3vw;
}

.class-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: white;
    border: 2px solid #cc1b30;
    border-radius: 50px;
    padding: 3vw 6vw;
    font-family: 'Arial', sans-serif;
    font-weight: bold;
    flex-shrink: 0;
}

.class-rank {
    font-size: 5.5vw;
    color: #cc1b30;
    width: 12vw;
    text-align: left;
}

.class-name {
    flex-grow: 1;
    text-align: center;
    font-size: 4.5vw;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.class-score {
    font-size: 4.5vw;
    color: #333;
    width: 18vw;
    text-align: right;
}

.class-item.is-me {
    border-color: #2bb94c;
    background-color: #f0fdf4;
}

.class-item.is-me .class-rank {
    color: #2bb94c;
}

.class-item.is-me .class-name {
    color: #2bb94c;
}

.txt-moi {
    font-size: 0.8em;
    font-weight: normal;
    opacity: 0.9;
}


/* =========================================================
   FOOTER
   ========================================================= */
.navigation {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 90px;
    background: #cc1b30;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    z-index: 999;
    padding-bottom: env(safe-area-inset-bottom);
}

.navigation ul {
    display: flex;
    width: 100%;
    max-width: 500px;
    padding: 0;
    margin: 0;
    position: relative;
}

.navigation ul li {
    list-style: none;
    flex: 1;
    height: 60px;
    z-index: 1;
    -webkit-tap-highlight-color: transparent;
}

.navigation ul li a {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 100%;
    text-decoration: none;
}

.navigation ul li.active a .icon {
    position: absolute;
    background: #fff;
    color: #cc1b30;
    width: 55px;
    height: 50px;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 0 0 25px 25px;
    transition: 0.3s;
    z-index: 10;
}

.nav-svg {
    width: 24px;
    height: 24px;
    transition: 0.3s;
    filter: brightness(0) invert(1);
}

/* La bulle blanche qui descend quand le menu est actif */
.navigation ul li.active a .icon {
    position: absolute;
    background: #fff;
    width: 65px;
    height: 60px;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 0 0 25px 25px;
    transition: 0.3s;
    z-index: 10;
}

/* Quand le menu est actif, on retrouve le ROUGE de base */
.navigation ul li.active a .icon .nav-svg {
    /* On annule le filtre blanc : votre icône retrouve son rouge parfait d'origine ! */
    filter: none;
}

.footer-text {
    position: absolute;
    bottom: calc(8px + env(safe-area-inset-bottom));
    width: 100%;
    text-align: center;
    color: white;
    font-size: 10px;
    opacity: 0.8;
    pointer-events: none;
}

.footer-text {
    position: absolute;
    bottom: calc(8px + env(safe-area-inset-bottom));
    width: 100%;
    text-align: center;
    color: white;
    font-size: 10px;
    opacity: 0.8;
    pointer-events: none;
}


/*HORS CONNEXION*/
#offline-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(15, 15, 15, 0.95);
    /* Fond très sombre mais légèrement transparent */
    color: white;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.5s ease;
    /* Transition très fluide */
}

/* Quand la classe 'active' est ajoutée par le JS */
#offline-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Le contenu central - VERSION RENFORCÉE */
.offline-content {
    text-align: center;
    display: flex !important;
    flex-direction: column !important;
    align-items: center;
    justify-content: center;
    gap: 15px;
    width: 90vw;
}


#offline {
    height: 30vw;
    margin: 5vw;
}

.offline-btn {
    -webkit-appearance: none;
    appearance: none;
    border: 2px solid #cc1b30;
    border-radius: 20px;
    background-color: white;
    width: 60vw;
    font-size: 4vw;
    padding: 3vw;
    color: #cc1b30;
    text-decoration: none;
    display: block;
    text-align: center;
    cursor: pointer;
    margin: 5vw;
}

/* =========================================================
   MODE HORS CONNEXION MINI (Bannière pour le Classement)
   ========================================================= */
/* =========================================================
   MODE HORS CONNEXION MINI (Bannière Fixe et Immobile)
   ========================================================= */

#offline-overlay.active.minimized {
    position: fixed !important;
    /* FORCE la bannière à rester totalement figée à l'écran */
    top: auto !important;
    bottom: 90px !important;
    /* Reste pile au-dessus du footer (90px) */
    left: 0 !important;
    width: 100% !important;
    height: 60px !important;
    background-color: #cc1b30;
    z-index: 10000;
    /* Reste au-dessus du classement qui défile */
    box-shadow: 0 -4px 15px rgba(0, 0, 0, 0.3);
}

/* On aligne le contenu horizontalement dans la petite bannière */
#offline-overlay.minimized .offline-content {
    flex-direction: row !important;
    justify-content: center;
    align-items: center;
    gap: 3vw;
    width: 90vw;
    height: 100%;
    padding: 0 4vw;
}

#offline-overlay.minimized #offline {
    height: 6vw;
    max-height: 25px;
    margin: 0;
}

#offline-overlay.minimized .offline-btn {
    width: auto;
    font-size: 3.5vw;
    padding: 1.5vw 4vw;
    margin: 0;
    border-radius: 10px;
    background-color: white;
    color: #cc1b30;
}