@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

@font-face {
    font-family: 'Bakso Menu';
    src: url('../fonts/BaksoMenu-7O82B.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}

@font-face {
    font-family: 'Sora';
    src: url('../fonts/Sora-VariableFont_wdth\,wght.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}

:root {
    /* --- La Palette de Couleurs --- */
    /* Le violet principal (pour les boutons, liens, etc.) */
    --color-primary: #7c3aed;
    /* Le violet un peu plus foncé quand on passe la souris dessus */
    --color-primary-hover: #6d28d9;

    --color-shadow: #FBCC3C;

    /* Les couleurs de fond et de surface */
    --color-bg: #D0A0FF;
    /* Le gris très clair du fond de page */
    --color-surface: #611EA2;
    /* Le blanc des cartes et des blocs */

    /* Les couleurs de texte */
    --color-text-main: #111827;
    /* Presque noir, pour le texte principal */
    --color-text-secondary: #ffffff;
    /* Gris moyen, pour les sous-titres */

    /* Les bordures et autres utilitaires */
    --color-border: #e5e7eb;

    /* Feedback (succès, erreur...) */
    --color-success: #10b981;
    --color-success-bg: #d1fae5;
    --color-success-text: #065f46;
    --color-error: #ef4444;

    /* --- Espacements & Arrondis --- */
    --radius-md: 0.75rem;
    /* Arrondi moyen */
    --radius-lg: 1rem;
    /* Arrondi large */

    /* --- Ombres (pour donner du relief) --- */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

/* --- Reset & Base (On remet tout à zéro) --- */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Sora', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--color-bg);
    color: var(--color-text-main);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a {
    text-decoration: none;
    color: inherit;
    transition: color 0.2s;
}

ul,
ol {
    list-style: none;
}

/* --- Typographie (Les titres et textes) --- */
h1,
h2,
h3,
h4 {
    font-family: 'Sora', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-weight: 700;
    color: var(--color-text-main);
    margin-bottom: 1rem;
    line-height: 1.2;
}

h1 {
    font-family: 'Bakso Menu', sans-serif;
    font-size: 96px;
    color: #EE087A;
    -webkit-text-stroke: 18px #611EA2;
    paint-order: stroke fill;
    letter-spacing: 0.02em;
}

h2 {
    font-size: 1.75rem;
    color: var(--color-text-secondary);
}

h3 {
    font-size: 1.25rem;
}

p {
    margin-bottom: 1rem;
    color: var(--color-text-secondary);
}

/* --- Mise en page (Layout) --- */
.container {
    width: 100%;
    max-width: 1200px;
    /* Largeur max du contenu */
    margin: 0 auto;
    /* Centrer le bloc */
    padding: 0 1.5rem;
}

.main {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem 0;
    width: 100%;
}

/* --- En-tête (Header) --- */
.site-header {
    background-color: var(--color-surface);
    padding: 0.5rem 0;
    width: 100%;
    box-shadow: var(--shadow-sm);
}

.header-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.brand {
    font-weight: 800;
    font-size: 1.5rem;
    color: var(--color-text-secondary);
    letter-spacing: -0.03em;
}

.brand:hover {
    color: var(--color-shadow);
}

.main-nav a {
    margin-left: 1.5rem;
    font-weight: 500;
    color: var(--color-text-secondary);
}

.main-nav a:hover {
    color: var(--color-shadow);
}

/* --- Pied de page (Footer) --- */
.site-footer {
    background-color: var(--color-surface);
    padding: 0.5rem 0;
    margin-top: auto;
    font-size: 0.875rem;
    color: var(--color-text-secondary);
    width: 100%;
}

.footer-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.legal a {
    color: var(--color-text-secondary);
}

.legal-page {
    background-color: var(--color-surface);
    padding: 2rem;
    border-radius: var(--radius-lg);
    margin-top: 3rem;
    color: var(--color-text-secondary);
}

.legal a:hover {
    color: var(--color-shadow);
}

.split-bg-color {
    background: #D0A0FF;
    background: linear-gradient(90deg, rgba(208, 160, 255, 1) 50%, rgba(253, 160, 206, 1) 50%);
}

/* --- Boutons --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    border-radius: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.2s ease;
    font-size: 1rem;
    text-align: center;
}

/* Bouton principal (Violet avec ombre jaune) */
.btn.primary {
    background-color: #611EA2;
    color: #ffffff;
    box-shadow: 4px 4px 2px var(--color-shadow);
    font-family: 'Bakso Menu', sans-serif;
    font-size: 1rem;
    font-weight: 300;
}

.btn.primary:hover {
    background-color: #4d1780;
    transform: translateY(-2px);
    box-shadow: 6px 6px 3px var(--color-shadow);
}

/* Bouton secondaire (Blanc avec bordure) */
.btn.secondary {
    background-color: #EE087A;
    color: #ffffff;
    box-shadow: 4px 4px 2px var(--color-shadow);
    font-family: 'Bakso Menu', sans-serif;
    font-size: 1rem;
    font-weight: 300;
}

.btn.secondary:hover {
    background-color: #b1075c;
    transform: translateY(-2px);
    box-shadow: 6px 6px 3px var(--color-shadow);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Boutons de sélection de mode (Gros boutons) */
.btn.mode {
    display: block;
    width: 100%;
    margin-bottom: 1rem;
    padding: 1.5rem;
    font-size: 1.25rem;
}

/* --- Champs de formulaire (Inputs) --- */
input[type="text"],
input[type="number"] {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    font-size: 1rem;
    transition: all 0.2s;
    background-color: #f9fafb;
}

input[type="text"]:focus,
input[type="number"]:focus {
    outline: none;
    border-color: var(--color-primary);
    background-color: #ffffff;
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1);
    /* Halo violet */
}

.form-group {
    display: flex;
    flex-direction: column;
    margin-bottom: 1.5rem;
    width: 100%;
    justify-content: center;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--color-text-main);
}

/* --- Cartes et Conteneurs --- */
/* Style générique pour les boîtes blanches centrées */
.card,
.lobby-container,
.lobby-create,
.mode-select {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    padding: 2.5rem;
    box-shadow: var(--shadow-md);
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    text-align: center;
}

.results-box {
    text-align: center;
    gap: 2rem;
}

.results-box h1 {
    margin-top: 100px;
    padding-bottom: 1.5rem;

}

.results-box p {
    font-family: 'Sora', sans-serif;
    font-size: 35px;
    padding-bottom: 1.5rem;
}

.mode-buttons {
    display: flex;
    justify-content: center;
    gap: 3rem;
}

#button-ready {
    margin-bottom: 2rem;
}


/* --- Section Hero (Accueil) --- */
.hero {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    max-width: 900px;
}

.hero h1 {
    margin-bottom: 1.5rem;
}

.lead {
    font-size: 1.25rem;
    color: var(--color-text-secondary);
    margin-bottom: 2.5rem;
    background-color: var(--color-surface);
    align-self: auto;
    padding-left: 10px;
    padding-right: 10px;
    padding-bottom: 3px;
    border-radius: 10px;
}

.cta {
    width: 100%;
    display: flex;
    justify-content: space-around;
}

/* --- Interface de Jeu --- */
.game-layout {
    display: flex;
    width: 100%;
    height: 100%;
}

.game-area {
    flex: 1;
    min-width: 0;
}

.multi {
    padding: 0;
    justify-content: space-between;
    align-items: stretch;
    max-width: 100%;
    height: 100%;
}

.media-container {
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin: 0 auto 2rem auto;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 400px;
    max-height: 60vh;
    max-width: 100%;
    position: relative;
}

.media-display {
    max-width: 100%;
    max-height: 60vh;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
    border-radius: var(--radius-lg);
}

.answers {
    display: flex;
    gap: 5rem;
    justify-content: center;
    margin-top: 2rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.answers .btn {
    min-width: 180px;
    font-size: 1.1rem;
    padding: 1rem 2rem;
}

.round-info {
    font-family: 'Bakso Menu', sans-serif;
    font-size: 3.5rem;
    font-weight: 400;
    color: #EE087A;
    -webkit-text-stroke: 5px #611EA2;
    text-align: center;
}

/* --- Sidebar du Classement (Leaderboard) --- */
.leaderboard-sidebar {
    width: 400px;
    min-height: 91vh;
    background: var(--color-surface);
    padding: 1.5rem;
    box-shadow: var(--shadow-md);
    flex-shrink: 0;
}

.leaderboard-sidebar h3 {
    font-family: 'Bakso Menu', sans-serif;
    font-weight: 300;
    font-size: 2rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    text-align: center;
    color: var(--color-text-secondary);
}

.leaderboard-list {
    list-style: none;
}

.player-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-radius: var(--radius-md);
    transition: background-color 0.2s;
    margin-bottom: 0.5rem;
}

.player-card:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.player-card:hover {
    background-color: var(--color-primary-hover);
}

.player-card.is-me {
    color: var(--color-text-secondary);
}

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

.player-card .player-name {
    font-weight: 600;
    color: var(--color-text-secondary);
}

.player-card .player-score {
    font-size: 0.875rem;
    color: var(--color-text-secondary);
}

.player-status {
    font-size: 0.75rem;
    padding: 0.25rem 0.75rem;
    border-radius: 2rem;
    background-color: var(--color-bg);
    color: var(--color-text-secondary);
    font-weight: 600;
}

.player-status.answered {
    background-color: var(--color-success-bg);
    color: var(--color-success-text);
}

/* --- Popups (Fenêtres modales) --- */
.popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(17, 24, 39, 0.7);
    /* Fond sombre semi-transparent */
    backdrop-filter: blur(4px);
    /* Effet de flou */
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.popup.show {
    opacity: 1;
    pointer-events: auto;
}

.popup-content {
    background: var(--color-text-secondary);
    padding: 3rem;
    border-radius: var(--radius-lg);
    text-align: center;
    box-shadow: var(--shadow-lg);
    max-width: 90%;
    width: 450px;
    transform: scale(0.95);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.popup.show .popup-content {
    transform: scale(1);
}

#popupTitle {
    color: #611EA2;
}

#popupText {
    font-size: 1.75rem;
    font-weight: 800;
    margin-bottom: 2rem;
    display: block;
    color: var(--color-primary-hover);
}

#gamePopupText {
    font-size: 1.75rem;
    font-weight: 800;
    margin-bottom: 2rem;
    display: block;
    color: var(--color-primary-hover);
}

#view-lobby {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    max-width: 900px;
}

/* --- Spécifique au Lobby --- */
#lobbyCode {
    font-family: 'Inter', monospace;
    font-size: 3rem;
    font-weight: 800;
    letter-spacing: 0.2em;
    background: #f5f3ff;
    padding: 1rem 2rem;
    border-radius: var(--radius-md);
    color: var(--color-primary);
    display: inline-block;
    margin-bottom: 2rem;
    border: 2px dashed rgba(124, 58, 237, 0.3);
}

/* Nouveau layout Lobby (Split View) */
.lobby-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    width: 100%;
    max-width: 1200px;
    align-items: start;
}

.lobby-left {
    padding: 0;
}

.lobby-right {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    align-items: center;
}

.lobby-right .btn {
    max-width: 250px;
}

.player-list-item {
    margin: 0;
    border-radius: var(--radius-md);
    overflow: hidden;
    text-align: left;
}

.player-list-item {
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #e2dbff;
}

.player-list-item:last-child {
    border-bottom: none;
}

.player-list-item:nth-child(odd) {
    background-color: #f9fafb;
    /* Zébrure pour la lisibilité */
}

/* --- Checkboxes (Paramètres) --- */
#settingsArea {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1.5rem;
    border-radius: var(--radius-md);
    text-align: center;
}

#settingsArea label {
    display: inline-flex;
    align-items: center;
    margin-right: 20px;
    margin-bottom: 10px;
    cursor: pointer;
    font-weight: 500;
}

#settingsArea input[type="checkbox"] {
    margin-right: 10px;
    width: 20px;
    height: 20px;
    accent-color: var(--color-primary);
}

/* --- Résultats --- */
#rankingList {
    counter-reset: rank;
    margin: 2rem 0;
    text-align: left;
}

#rankingList li {
    background: white;
    border: 1px solid var(--color-border);
    padding: 1.5rem;
    margin-bottom: 1rem;
    border-radius: var(--radius-md);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    padding-left: 4rem;
    box-shadow: var(--shadow-sm);
}

#rankingList li::before {
    counter-increment: rank;
    content: counter(rank);
    position: absolute;
    left: 1.5rem;
    font-weight: 900;
    color: #b2b5ba;
    border-color: #b2b5ba;
    font-size: 1.5rem;
}

/* Le premier du classement en or/jaune */
#rankingList li:first-child {
    border-color: #fbbf24;
    background-color: #fffbeb;
    box-shadow: var(--shadow-md);
}

#rankingList li:first-child::before {
    color: #fbbf24;
}

#lobby {
    display: flex;
    flex-direction: row;
    justify-content: center;
    padding-bottom: 3rem;
    gap: 2rem;
}

/* --- Responsive (Mobile & Tablettes) --- */
@media (max-width: 900px) {
    h1 {
        padding-top: 2rem;
    }

    .game-layout {
        flex-direction: column;
        align-items: center;
    }

    .leaderboard-sidebar {
        width: 100%;
        max-width: 600px;
        margin-bottom: 2rem;
        order: -1;
        min-height: 100%;
        width: 100vw;
    }

    .lobby-grid {
        display: flex;
        flex-direction: column;
        padding-bottom: 3rem;
        justify-content: center;
        align-items: center;
    }

    .lobby-left {
        display: flex;
        flex-direction: column;
        justify-content: center;
        width: 85%;
    }

    #lobbyCode {
        font-family: 'Inter', monospace;
        font-size: 2rem;
        font-weight: 800;
        letter-spacing: 0.2em;
        background: #f5f3ff;
        padding: 1rem 2rem;
        border-radius: var(--radius-md);
        color: var(--color-primary);
        display: inline-block;
        margin-bottom: 2rem;
        border: 2px dashed rgba(124, 58, 237, 0.3);
    }
}

@media (max-width: 640px) {
    h1 {
        font-size: 3rem;
    }

    .container {
        padding: 0 0.5rem;
    }

    .answers {
        flex-direction: column;
        gap: 1rem;
    }

    .answers .btn {
        width: 100%;
    }

    .header-inner {
        flex-direction: column;
        gap: 1rem;
    }

    .main-nav a {
        margin: 0 0.75rem;
    }

    .popup-content {
        padding: 2rem;
        width: 95%;
    }
}

#astuce {
    background-color: #FDA0CE;
}

#head-astuce,
#foot-astuce {
    background-color: #EE087A;
}

#astuce-text {
    background-color: #EE087A;
}

.home {
    background: #D0A0FF;
    background: linear-gradient(90deg, var(--color-surface) 50%, #EE087A 50%);
}

/* --- Carousel Astuces --- */
.carousel {
    width: 100%;
    overflow-x: auto;
    margin: 3rem auto;
    display: flex;
    gap: 2rem;
    padding: 1rem 0;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.carousel::-webkit-scrollbar {
    display: none;
}

.carousel .card {
    flex: 0 0 400px;
    background-color: #EE087A;
    border-radius: var(--radius-lg);
    padding: 1rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: auto;
    min-height: 500px;
    scroll-snap-align: center;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    text-align: left;
}

.carousel .card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.carousel .card h3 {
    color: var(--color-text-secondary);
    font-size: 1.1rem;
    margin-bottom: 1.5rem;
    text-align: left;
    font-weight: normal;
    line-height: 1.5;
}

.carousel .card strong {
    color: var(--color-shadow);
    font-weight: 700;
}

.carousel .card img {
    width: 100%;
    height: 220px;
    object-fit: cover;
    border-radius: var(--radius-md);
    margin-top: auto;
    box-shadow: var(--shadow-sm);
}

.scroll-buttons {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-top: 1rem;
    margin-bottom: 3rem;
}

.scroll-left,
.scroll-right {
    background-color: #EE087A;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s, background-color 0.2s;
    box-shadow: var(--shadow-md);
    padding: 0;
}

.scroll-left:hover,
.scroll-right:hover {
    background-color: #c90666;
    transform: scale(1.1);
}

.scroll-left img,
.scroll-right img {
    width: 24px;
    height: 24px;
    filter: brightness(0) invert(1);
}

.scroll-left:disabled,
.scroll-right:disabled {
    background-color: #555;
    cursor: not-allowed;
    transform: none;
}

@media (max-width: 500px) {
    .carousel .card {
        flex: 0 0 90%;
    }
}