:root {
    --bg-color: #f8f9fc;
    --text-color: #2e384d;
    --accent-color: #4a6cf7;
    --accent-hover: #3654d9;
    --card-bg: #ffffff;
    --card-back-bg: #4a6cf7;
    --text-back: #ffffff;
    --border-radius: 18px;
    --shadow: 0 10px 30px rgba(0,0,0,0.06);
}

main {
    font-family: 'Segoe UI', system-ui, sans-serif;
    color: var(--text-color);
    margin: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
    /* padding: 20px; */
    box-sizing: border-box;
}


/* --- ELEMENTS COMMUNS --- */
.btn-principal, .nav-btn {
    padding: 15px 25px;
    border-radius: 12px;
    border: none;
    cursor: pointer;
    font-weight: 700;
    font-size: 1rem;
    transition: all 0.3s ease;
    text-align: center;
}

.btn-principal, .nav-btn.primary {
    background: var(--accent-color);
    color: white;
    width: 100%;
}

.btn-principal:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(74, 108, 247, 0.3);
}

/* --- PAGE D'ACCUEIL (INDEX) --- */
.config-card {
    background: var(--card-bg);
    padding: 35px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    width: 100%;
    /* max-width: 850px; */
}

h2 { text-align: center; margin-top: 0; color: #1a202c; margin-bottom: 25px; }

.form-group { margin-bottom: 30px; }

.inline-group {
    display: flex;
    align-items: center; /* Aligne verticalement au centre */
    gap: 20px;           /* Espace entre le texte et la case numérique */
    margin-bottom: 25px;
}

.inline-group .main-label {
    margin-bottom: 0;    /* Supprime la marge du bas pour bien aligner */
}

.main-label {
    display: block;
    font-weight: 700;
    margin-bottom: 15px;
    font-size: 0.85rem;
    text-transform: uppercase;
    color: #718096;
    letter-spacing: 0.5px;
}

input[type="number"] {
    width: 100px;
    padding: 12px;
    border: 2px solid #edf2f7;
    border-radius: 10px;
    font-size: 1rem;
    outline: none;
    color: var(--accent-color);
    font-weight: bold;
}

.action-bar { margin-bottom: 0px; display: flex; gap: 10px; }

.btn-mini {
    padding: 10px 18px;
    background: #edf2f7;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    color: #4a5568;
    transition: 0.2s;
}

.btn-mini:hover { background: #e2e8f0; color: #2d3748; }

.theme-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid #f1f4f8;
}

.theme-row:last-child { border-bottom: none; }

.chip input { display: none; }

.chip span {
    display: inline-block;
    padding: 10px 18px;
    background: #ffffff;
    border: 1.5px solid #edf2f7;
    border-radius: 12px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

.chip span strong { color: var(--accent-color); margin-right: 5px; }

.chip input:checked + span {
    background-color: var(--accent-color);
    border-color: var(--accent-color);
    color: white;
}

.chip input:checked + span strong { color: white; }

/* --- PAGE QUIZ --- */
.header {
    width: 100%;
    max-width: 650px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.card-area {
    width: 100%;
    max-width: 650px;
    perspective: 1500px;
    min-height: 400px;
}

.flashcard {
    width: 100%;
    min-height: 400px;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
}

.flashcard.flipped { transform: rotateY(180deg); }

.card-front, .card-back {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    backface-visibility: hidden;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 40px;
    box-sizing: border-box;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    background: white;
    text-align: center;
}

.card-back {
    transform: rotateY(180deg);
    background: var(--card-back-bg);
    color: white;
}

.card-content { font-size: 1.6rem; font-weight: 600; line-height: 1.5; }

.theme-tag {
    position: absolute;
    top: 25px;
    font-size: 0.8rem;
    font-weight: 800;
    text-transform: uppercase;
    opacity: 0.5;
}

.click-hint {
    position: absolute;
    bottom: 25px;
    font-size: 0.8rem;
    opacity: 0.6;
    font-style: italic;
}

.controls {
    display: flex;
    gap: 15px;
    margin-top: 30px;
    width: 100%;
    max-width: 450px;
}

.nav-btn {
    flex: 1;
    background: white;
    color: #4a5568;
    border: 2px solid #edf2f7;
}

.nav-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* --- RESPONSIVE --- */
@media (max-width: 600px) {
    .theme-row { flex-direction: column; }
    .chip span { display: block; width: 100%; box-sizing: border-box; }
    .card-area, .flashcard { min-height: 350px; }
    .card-content { font-size: 1.3rem; }
    .controls { flex-direction: column-reverse; }
    #bando { height: 44px;}
    #titre {
    color: #f9fbf2;
    max-width:1250px;
    margin: auto;
    font-size: 20px;
    line-height: 20px;
    padding: 12px 0px 12px 6px;
}
}