/* ── Écran de sélection du niveau ── */
body {
    margin: 0;
    font-family: 'Segoe UI', Arial, sans-serif;
    background: #f0f4f8;
}

.niveau-header {
    text-align: center;
    padding: 20px 24px 16px;
}

.niveau-header h1 {
    font-size: 22px;
    font-weight: 700;
    color: #1a2b4a;
    margin: 0 0 6px;
    letter-spacing: .2px;
}

.niveau-header p {
    font-size: 14px;
    color: #5a6a80;
    margin: 0;
}

.niveau-cards {
    display: flex;
    gap: 24px;
    flex-wrap: nowrap;
    justify-content: center;
    padding: 0 24px 48px;
    max-width: 100%;
    margin: 0 auto;
    overflow-x: hidden;
}

.niveau-card {
    background: #fff;
    border: 2px solid #dce4ef;
    border-radius: 14px;
    padding: 32px 28px 28px;
    width: 220px;
    min-width: 200px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    box-shadow: 0 2px 10px rgba(0, 0, 0, .06);
    transition: transform .18s, box-shadow .18s;
}

.niveau-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 28px rgba(0, 0, 0, .12);
}

.niveau-card.n1 {
    border-top: 5px solid #e67e22;
}

.niveau-card.n2 {
    border-top: 5px solid #c4748a;
}

.niveau-card.n3 {
    border-top: 5px solid #E8500A;
}

.niveau-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: .6px;
    text-transform: uppercase;
    margin-bottom: 14px;
    width: fit-content;
}

.n1 .niveau-badge {
    background: #fdf2e3;
    color: #e67e22;
}

.n2 .niveau-badge {
    background: #fce8ef;
    color: #a0355a;
}

.n3 .niveau-badge {
    background: #fde8de;
    color: #b03808;
}

.niveau-card h3 {
    font-size: 22px;
    font-weight: 700;
    color: #1a2b4a;
    margin: 0 0 10px;
}

.niveau-card .niveau-desc {
    font-size: 15px;
    color: #5a6a80;
    line-height: 1.55;
    margin: 0 0 18px;
    flex-grow: 1;
}

.niveau-stats {
    list-style: none;
    padding: 0;
    margin: 0 0 22px;
    border-top: 1px solid #edf1f7;
    padding-top: 14px;
}

.niveau-stats li {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
    color: #3a4a60;
    padding: 5px 0;
    border-bottom: 1px solid #f0f4f8;
}

.niveau-stats li:last-child {
    border-bottom: none;
}

.niveau-stats .stat-val {
    font-weight: 700;
    color: #1a2b4a;
}

/* Boutons d'accès aux interfaces */
.niveau-btns {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: auto;
}

.btn-interface {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: opacity .15s, transform .1s;
    cursor: pointer;
}

.btn-interface:hover {
    opacity: .88;
    transform: translateX(2px);
}

.btn-interface svg {
    flex-shrink: 0;
}

.n1 .btn-pgi {
    background: #e67e22;
    color: #fff;
}

.n1 .btn-bank {
    background: #fdf2e3;
    color: #e67e22;
    border: 1.5px solid #f5cfa0;
}

.n2 .btn-pgi {
    background: #b5546a;
    color: #fff;
}

.n2 .btn-bank {
    background: #fce8ef;
    color: #a0355a;
    border: 1.5px solid #f0b8c8;
}

.n3 .btn-pgi {
    background: #E8500A;
    color: #fff;
}

.n3 .btn-bank {
    background: #fde8de;
    color: #b03808;
    border: 1.5px solid #f5b090;
}

.niveau-card.ndemo {
    border-top: 5px solid #7b68ee;
    opacity: .9;
}

.ndemo .niveau-badge {
    background: #eeecfd;
    color: #5a4fcf;
}

.ndemo .btn-pgi {
    background: #7b68ee;
    color: #fff;
}

footer {
    text-align: center;
    padding: 24px 16px;
    font-size: 13px;
    color: #9aabbf;
}

/* ── Section rapprochement bancaire ── */
.rb-section {
    max-width: 960px;
    margin: 0 auto 44px;
    padding: 0 24px;
}

.rb-section h2 {
    font-size: 20px;
    font-weight: 700;
    color: #1a2b4a;
    margin: 0 0 8px;
}

.rb-section .rb-def {
    font-size: 16px;
    color: #4a5a72;
    line-height: 1.7;
    margin: 0 0 28px;
    max-width: 1180px;
}

.rb-section .rb-def strong {
    color: #1a2b4a;
}

/* Grille de flip cards */
.flip-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
}

.flip-card {
    height: 120px;
    perspective: 1000px;
    cursor: pointer;
}

/* Survol sur desktop */
@media (hover: hover) {
    .flip-card:hover .flip-inner {
        transform: rotateY(180deg);
    }
}

/* Clic sur tactile */
.flip-card.flipped .flip-inner {
    transform: rotateY(180deg);
}

.flip-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform .5s cubic-bezier(.4, 0, .2, 1);
    transform-style: preserve-3d;
}

.flip-front,
.flip-back {
    position: absolute;
    inset: 0;
    border-radius: 10px;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 18px 16px;
    text-align: center;
}

/* Face avant */
.flip-front {
    background: #fff;
    border: 1px solid #dce4ef;
    box-shadow: 0 2px 8px rgba(26, 43, 74, .06);
    gap: 10px;
}

.flip-step {
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: #aab8cc;
}

.flip-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.flip-front-title {
    font-size: 14px;
    font-weight: 700;
    color: #1a2b4a;
    line-height: 1.35;
}

/* Face arrière */
.flip-back {
    transform: rotateY(180deg);
    background: #1a2b4a;
    padding: 16px 18px;
    gap: 8px;
}

.flip-back p {
    font-size: 13px;
    color: rgba(255, 255, 255, .9);
    line-height: 1.58;
    margin: 0;
}

/* Couleurs des icônes face avant */
.ic-1 {
    background: #e8f5ee;
}

.ic-2 {
    background: #e8f0fb;
}

.ic-3 {
    background: #fef3e2;
}

.ic-4 {
    background: #fbe9e9;
}

.ic-5 {
    background: #eee8f8;
}

.ic-6 {
    background: #e2f4f8;
}

/* Couleurs face arrière */
.fb-1 {
    background: #1b4332;
}

.fb-2 {
    background: #1a3260;
}

.fb-3 {
    background: #6b3a10;
}

.fb-4 {
    background: #6b1a1a;
}

.fb-5 {
    background: #3b1f6b;
}

.fb-6 {
    background: #0d4a5c;
}

/* Cards ressource (video / wiki) — pas de flip, clic direct */
.flip-card.is-link .flip-inner {
    transition: none;
}

.flip-card.is-link:hover .flip-inner {
    transform: none;
}

.flip-card.is-link .flip-front {
    background: #f5f8fc;
    border: 1.5px dashed #b0c4d8;
    box-shadow: none;
    cursor: pointer;
    text-decoration: none;
    gap: 8px;
}

.flip-card.is-link:hover .flip-front {
    background: #edf2f8;
    border-color: #7a99bb;
}

/* Centre la carte ressource quand elle est seule sur la dernière ligne */
.flip-grid > .flip-card:nth-child(5):last-child {
    grid-column: 2 / span 2;
}

.flip-card.is-link a {
    position: absolute;
    inset: 0;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    gap: 10px;
    padding: 16px;
    text-align: center;
}

.link-tag {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    padding: 3px 8px;
    border-radius: 10px;
}

.tag-video {
    background: #fde8e8;
    color: #c0392b;
}

.tag-wiki {
    background: #e8f0fb;
    color: #2471a3;
}

.link-icon {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.li-video {
    background: #fde8e8;
}

.li-wiki {
    background: #e8f0fb;
}

.link-title {
    font-size: 13.5px;
    font-weight: 700;
    color: #1a2b4a;
    line-height: 1.3;
}

.link-cta {
    font-size: 11.5px;
    color: #7a99bb;
}

@media (max-width: 860px) {
    .flip-grid {
        grid-template-columns: repeat(4, 1fr);
    }

    .flip-card {
        height: 175px;
    }
}

@media (max-width: 640px) {
    .flip-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .flip-grid > .flip-card:nth-child(5):last-child {
        grid-column: 1 / -1;
    }

    .flip-card {
        height: 165px;
    }

    .flip-front-title {
        font-size: 13px;
    }

    .flip-back p {
        font-size: 12px;
    }
}