/* =====================================================================
   FLAPPY POIRE V2 — style
   L'ambiance de la V1 : fond noir, jaune poire, Bangers, lignes de balayage.
   ===================================================================== */
:root {
    --poire: #FFFC00;
    --poire-sombre: #d4cf00;
    --vert: #7cfc00;
    --fond: #0a0e14;
    --carte: #111820;
    --danger: #ff3366;
    --or: #FFD700;
}
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
    background: var(--fond);
    background-image:
        radial-gradient(ellipse 70% 50% at 20% 30%, rgba(255,252,0,.05) 0%, transparent 60%),
        radial-gradient(ellipse 50% 60% at 80% 70%, rgba(124,252,0,.04) 0%, transparent 60%);
    color: #fff;
    font-family: 'Nunito', system-ui, sans-serif;
    overflow: hidden;
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
}
body::after {
    content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 9998;
    background: repeating-linear-gradient(0deg, transparent, transparent 3px, rgba(0,0,0,.06) 3px, rgba(0,0,0,.06) 4px);
}
button { font: inherit; color: inherit; cursor: pointer; border: none; background: none; }
button:disabled { cursor: not-allowed; opacity: .45; }
.bangers, h2, h3 { font-family: 'Bangers', Impact, sans-serif; letter-spacing: 2px; font-weight: 400; }

/* ---------- mise en page ---------- */
#scene { height: 100%; display: flex; justify-content: center; align-items: center; gap: 18px; padding-inline: 10px; }
.panneau-cote { flex: 0 1 250px; min-width: 0; max-height: 100%; overflow: hidden; display: flex; flex-direction: column; gap: 10px; }
@media (max-width: 899px) {
    .panneau-cote { display: none !important; }
    #scene { padding-inline: 0; }
}
.carte-cote {
    background: var(--carte); border: 1px solid rgba(255,252,0,.15); border-left: 4px solid var(--poire);
    border-radius: 12px; padding: 10px 12px;
}
.carte-cote:nth-child(2n) { border-left-color: var(--vert); }
.carte-cote h3 { color: var(--poire); font-size: 1rem; margin-bottom: 6px; }
.carte-cote small { opacity: .75; font-size: .74rem; line-height: 1.5; display: block; }

#cadre-conteneur { position: relative; flex: 0 0 auto; }
@media (min-width: 900px) {
    #cadre-conteneur {
        border-radius: 14px;
        box-shadow: 0 0 0 5px var(--poire), 0 0 0 7px var(--poire-sombre), 0 0 40px rgba(255,252,0,.3), 0 20px 60px rgba(0,0,0,.7);
        overflow: hidden;
    }
}
#cadre {
    position: absolute; left: 0; top: 0; width: 400px; height: 640px;
    transform: scale(var(--s, 1)); transform-origin: 0 0;
    overflow: hidden; touch-action: none;
}
#toile { position: absolute; inset: 0; width: 400px; height: 640px; display: block; }

.btn-hud {
    position: absolute; z-index: 5; background: rgba(0,0,0,.45); color: #fff;
    border: 2px solid rgba(255,255,255,.35); border-radius: 50%; width: 42px; height: 42px; font-size: 1.1rem;
}
#btn-pause { top: 10px; right: 10px; }
#btn-tsar { bottom: 70px; right: 10px; width: auto; border-radius: 22px; padding: 0 12px; font-family: 'Bangers', sans-serif; letter-spacing: 1px; background: rgba(120,20,0,.7); border-color: #ffb300; }

/* ---------- écrans ---------- */
#ecrans { position: absolute; inset: 0; z-index: 10; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; scrollbar-width: thin; touch-action: pan-y; }
#ecrans[hidden] { display: none !important; }
.ecran { min-height: 100%; }

.pilule { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 20px; background: rgba(0,0,0,.15); font-weight: 900; font-size: .85rem; white-space: nowrap; }
.pilule.or { background: #000; color: var(--or); }
.btn-rond { width: 36px; height: 36px; border-radius: 50%; background: rgba(255,255,255,.1); font-size: 1.2rem; font-weight: 900; flex: 0 0 auto; }
.btn { background: rgba(255,255,255,.1); border: 2px solid rgba(255,255,255,.2); border-radius: 12px; padding: 7px 12px; font-weight: 900; font-size: .85rem; transition: transform .1s; }
.btn:active { transform: translateY(2px); }
.btn.or { background: var(--poire); color: #000; border-color: var(--poire-sombre); }
.btn.noir { background: #000; color: var(--poire); border-color: #000; }
.btn.danger { background: var(--danger); color: #fff; border-color: #b0103a; }
.btn.fantome { background: transparent; border-color: rgba(0,0,0,.25); }
.btn.large { font-family: 'Bangers', sans-serif; font-size: 1.3rem; letter-spacing: 3px; }
.lien { background: none; text-decoration: underline; font-weight: 900; font-size: .8rem; padding: 4px; }
.note { font-size: .74rem; opacity: .75; line-height: 1.4; margin: 6px 0; }
.centre { text-align: center; }
.grand { font-family: 'Bangers', sans-serif; font-size: 1.5rem; letter-spacing: 2px; }
.barre { height: 8px; background: rgba(0,0,0,.25); border-radius: 5px; overflow: hidden; margin: 4px 0; }
.barre i { display: block; height: 100%; border-radius: 5px; transition: width .3s; }
.champ { background: rgba(255,255,255,.08); border: 2px solid rgba(255,252,0,.3); color: #fff; border-radius: 10px; padding: 8px 10px; font: inherit; font-weight: 900; min-width: 0; flex: 1; }
.champ:focus { outline: none; border-color: var(--poire); }
.ligne { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 6px 0; }
.boite { background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.1); border-radius: 14px; padding: 10px 12px; margin: 10px 12px; }
.boite p { font-size: .82rem; margin: 6px 0; line-height: 1.4; }
.vide { text-align: center; opacity: .6; padding: 18px; font-size: .85rem; }
.titre-section { color: var(--poire); text-align: center; margin: 12px 0 4px; font-size: 1.1rem; }

/* ---------- accueil (la carte jaune de la V1) ---------- */
.accueil {
    margin: 12px; min-height: calc(100% - 24px);
    background: var(--poire); color: #000; border-radius: 22px; padding: 12px 14px 10px;
    box-shadow: 0 8px 0 var(--poire-sombre), 0 15px 40px rgba(0,0,0,.5);
    display: flex; flex-direction: column; align-items: stretch; gap: 7px;
    animation: pop .4s cubic-bezier(.17,.89,.32,1.49);
}
@keyframes pop { from { transform: scale(.5) rotate(-4deg); opacity: 0; } to { transform: none; opacity: 1; } }
.barre-joueur { display: flex; align-items: center; gap: 6px; }
.profil { flex: 1; min-width: 0; text-align: left; background: rgba(0,0,0,.12); border-radius: 20px; padding: 4px 10px; font-weight: 900; font-size: .8rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.logo { font-family: 'Bangers', sans-serif; font-size: 2.35rem; letter-spacing: 2px; text-align: center; line-height: 1; margin-top: 4px; cursor: pointer; animation: bat 1.5s ease-in-out infinite; }
.logo.boing { animation: boing .3s; }
@keyframes bat { 50% { transform: scale(1.05); } }
@keyframes boing { 40% { transform: scale(1.18) rotate(-3deg); } }
.logo .v2 { background: #000; color: var(--poire); border-radius: 10px; padding: 0 8px; font-size: 1.8rem; vertical-align: middle; }
.sous-titre { text-align: center; font-family: 'Bangers', sans-serif; letter-spacing: 6px; font-size: .9rem; margin-top: -4px; opacity: .7; }
.bandeau-event { font-family: 'Bangers', sans-serif; letter-spacing: 1.5px; font-size: .9rem; padding: 5px 10px; border-radius: 10px; text-align: center; margin: 2px 0; }
.btn-jouer {
    width: 100%; background: #000; color: var(--poire); border-radius: 14px; padding: 12px;
    font-family: 'Bangers', sans-serif; font-size: 1.7rem; letter-spacing: 4px;
    box-shadow: 0 5px 0 #333; transition: transform .1s, box-shadow .1s; margin-top: 4px;
}
.btn-jouer:active { transform: translateY(3px); box-shadow: 0 2px 0 #333; }
.btn-jouer:disabled { opacity: .4; }
.record { text-align: center; font-size: .8rem; font-weight: 700; }
.grille-modes { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.grille-modes button {
    background: rgba(0,0,0,.1); border: 2px solid rgba(0,0,0,.18); border-radius: 12px; padding: 6px 4px;
    font-family: 'Bangers', sans-serif; font-size: 1.05rem; letter-spacing: 1.5px; display: flex; flex-direction: column; align-items: center; line-height: 1.1;
}
.grille-modes button span { font-size: 1.3rem; }
.grille-modes small { font-family: 'Nunito', sans-serif; font-size: .64rem; font-weight: 900; letter-spacing: 0; opacity: .7; }
.rangee-icones { display: flex; justify-content: space-between; gap: 2px; }
.rangee-icones button { flex: 1; display: flex; flex-direction: column; align-items: center; font-size: .56rem; font-weight: 900; padding: 4px 0; border-radius: 10px; text-transform: uppercase; }
.rangee-icones button:hover { background: rgba(0,0,0,.1); }
.rangee-icones span { font-size: 1.25rem; }
.xp-ligne { background: rgba(0,0,0,.1); border-radius: 12px; padding: 5px 10px; text-align: left; font-weight: 900; font-size: .72rem; }
.xp-ligne .barre i { background: #000 !important; }
.xp-ligne small { font-size: .62rem; opacity: .7; }
.citation { font-style: italic; color: #444; font-size: .74rem; text-align: center; margin-top: auto; }

/* ---------- volets ---------- */
.volet { background: rgba(10,14,20,.96); padding-bottom: 20px; animation: glisse .25s ease; }
@keyframes glisse { from { transform: translateY(20px); opacity: 0; } }
.volet-entete { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 8px; padding: 10px 12px; background: #0a0e14; border-bottom: 2px solid var(--poire); }
.volet-entete h2 { flex: 1; color: var(--poire); font-size: 1.35rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.onglets { display: flex; gap: 5px; padding: 8px 12px 2px; flex-wrap: wrap; }
/* les onglets passent à la ligne : rien à faire défiler sur PC */
.onglets.defile-x { flex-wrap: wrap; justify-content: center; }
.onglets.defile-x .onglet { padding: 5px 9px; font-size: .74rem; }
.onglet { padding: 6px 10px; border-radius: 20px; background: rgba(255,255,255,.07); font-weight: 900; font-size: .78rem; white-space: nowrap; border: 2px solid transparent; }
.onglet.actif { background: var(--poire); color: #000; }
.onglets.mondes .onglet { flex: 1; font-size: 1.3rem; padding: 6px 0; }
.onglet.ferme { opacity: .45; }

/* aventure */
.carte-monde { margin: 10px 12px; border-radius: 16px; padding: 12px; background: linear-gradient(160deg, color-mix(in srgb, var(--c) 30%, #111820), #111820 70%); border: 2px solid var(--c); }
.carte-monde h3 { color: var(--c); font-size: 1.2rem; }
.carte-monde > p { font-size: .8rem; opacity: .85; margin: 4px 0 8px; }
.chemin { display: flex; flex-direction: column; align-items: center; gap: 8px; margin: 6px 0; }
.noeud {
    display: grid; grid-template-columns: 50px 1fr auto; align-items: center; gap: 10px; width: 78%;
    transform: translateX(calc(var(--decal) * 34px));
    background: #000; border: 3px solid var(--c); border-radius: 30px; padding: 5px 14px 5px 5px; text-align: left;
    box-shadow: 0 4px 0 rgba(0,0,0,.5); transition: transform .15s;
}
.noeud:not(:disabled):hover { transform: translateX(calc(var(--decal) * 34px)) scale(1.04); }
.noeud .num { width: 42px; height: 42px; border-radius: 50%; background: var(--c); color: #000; display: grid; place-items: center; font-family: 'Bangers', sans-serif; font-size: 1.4rem; }
.noeud .nom { font-family: 'Bangers', sans-serif; letter-spacing: 1px; font-size: 1rem; }
.noeud .etoiles { color: var(--or); letter-spacing: 1px; }
.noeud.boss { border-width: 4px; background: #1a0000; }
.noeud.boss .nom { color: #ff5252; font-size: .95rem; }
.noeud.ferme { filter: grayscale(1); opacity: .5; }

/* défi, fous, duel */
.meca-jour { background: rgba(255,252,0,.1); border: 2px dashed var(--poire); border-radius: 12px; padding: 8px; margin: 8px 0; font-size: 1.2rem; }
.meca-jour small { display: block; font-size: .75rem; opacity: .8; }
.volet .record { color: #ddd; margin: 6px 0; }
.grille-fous { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin: 8px 12px; }
.carte-fou { background: rgba(255,255,255,.06); border: 2px solid rgba(255,255,255,.12); border-radius: 12px; padding: 8px; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 2px; }
.carte-fou span { font-size: 1.6rem; }
.carte-fou b { font-size: .82rem; }
.carte-fou small { font-size: .64rem; opacity: .7; line-height: 1.2; }
.carte-fou.actif { background: rgba(255,252,0,.16); border-color: var(--poire); }
.duel-touches { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 12px 0; }
.duel-touches > div { border-radius: 12px; padding: 10px 6px; display: flex; flex-direction: column; gap: 2px; font-size: .8rem; }
.duel-touches .j1 { background: rgba(255,252,0,.12); border: 2px solid var(--poire); }
.duel-touches .j2 { background: rgba(79,195,255,.12); border: 2px solid #4fc3ff; }
.duel-touches small { opacity: .7; font-size: .66rem; }

/* boutique */
.grille-articles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; margin: 8px 12px; }
.article { background: rgba(255,255,255,.05); border: 2px solid rgba(255,255,255,.1); border-radius: 12px; padding: 6px 4px; display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; }
.article b { font-size: .7rem; line-height: 1.1; min-height: 1.6em; display: flex; align-items: center; }
.article.equipe { border-color: var(--poire); background: rgba(255,252,0,.08); }
.article.verrou .vignette img, .article.verrou canvas { filter: grayscale(.6) brightness(.8); }
.article .btn { padding: 3px 8px; font-size: .7rem; }
.article .etat { font-size: .6rem; font-weight: 900; opacity: .75; line-height: 1.2; }
.article .etat.equipe { color: var(--poire); opacity: 1; }
.vignette { display: grid; place-items: center; border-radius: 10px; background: #70c5ce; overflow: hidden; font-size: 1.8rem; }
.vignette img { width: 100%; height: 100%; object-fit: contain; }
.vignette.icone { width: 58px; height: 58px; background: rgba(255,255,255,.08); }
canvas.apercu { width: 58px; height: 58px; border-radius: 10px; }
.ligne-amelio { display: grid; grid-template-columns: 34px 1fr auto; align-items: center; gap: 8px; margin: 7px 12px; background: rgba(255,255,255,.05); border-radius: 12px; padding: 8px; }
.ligne-amelio .ic { font-size: 1.5rem; text-align: center; }
.ligne-amelio small { color: var(--poire); letter-spacing: 1px; }
.ligne-amelio .note { margin: 2px 0 0; }

/* pass, succès, quêtes, classement */
.liste-paliers { margin: 6px 12px; display: flex; flex-direction: column; gap: 3px; }
.palier { display: grid; grid-template-columns: 34px 1fr 24px; align-items: center; gap: 6px; padding: 5px 8px; border-radius: 9px; background: rgba(255,255,255,.04); font-size: .8rem; }
.palier .n { font-family: 'Bangers', sans-serif; font-size: 1.1rem; color: var(--poire); text-align: center; }
.palier.special { border: 1px solid rgba(255,215,0,.5); background: rgba(255,215,0,.08); }
.palier.fait { opacity: .55; }
.grille-succes { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin: 6px 12px; }
.succes { background: rgba(255,255,255,.04); border-radius: 10px; padding: 7px; display: grid; grid-template-columns: 28px 1fr; column-gap: 6px; align-items: center; opacity: .5; }
.succes span { grid-row: span 2; font-size: 1.3rem; text-align: center; }
.succes b { font-size: .72rem; line-height: 1.1; }
.succes small { font-size: .6rem; opacity: .75; line-height: 1.15; }
.succes.ok { opacity: 1; border: 1px solid rgba(255,252,0,.35); }
.quete { display: flex; align-items: center; gap: 8px; margin: 8px 12px; background: rgba(255,255,255,.05); border-radius: 12px; padding: 10px; }
.quete > div { flex: 1; font-size: .85rem; }
.quete small { opacity: .7; font-size: .7rem; }
.quete.ok { border: 1px solid #39ff6a; }
.quete-mini { font-size: .72rem; margin-bottom: 6px; }
.quete-mini.ok { opacity: .6; }
.liste-top { margin: 6px 12px; }
.ligne-top { display: grid; grid-template-columns: 30px 1fr auto; align-items: center; gap: 6px; padding: 5px 6px; border-bottom: 1px solid rgba(255,255,255,.06); font-size: .82rem; }
.ligne-top .nom { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ligne-top b { color: var(--poire); }
.ligne-top.moi { background: rgba(255,252,0,.1); border-radius: 8px; }
.ligne-top .rang { text-align: center; }
.carte-cote .ligne-top { padding: 3px 2px; font-size: .76rem; }
.guerre { background: rgba(139,0,0,.35); border: 1px solid #ff4444; border-radius: 10px; padding: 8px; margin-top: 6px; }
.guerre b { font-family: 'Bangers', sans-serif; letter-spacing: 2px; }

/* réglages */
.bascule { display: flex; align-items: center; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid rgba(255,255,255,.06); font-weight: 700; font-size: .88rem; cursor: pointer; }
.bascule input { display: none; }
.bascule i { width: 44px; height: 24px; border-radius: 12px; background: #333; position: relative; transition: background .2s; }
.bascule i::after { content: ''; position: absolute; left: 3px; top: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .2s; }
.bascule input:checked + i { background: var(--poire); }
.bascule input:checked + i::after { transform: translateX(20px); background: #000; }
input[type=range] { accent-color: var(--poire); flex: 1; }

/* ---------- fin de partie (carte jaune) ---------- */
.carte-fin {
    min-height: auto; margin: 70px 20px 20px; background: var(--poire); color: #000; border-radius: 22px; padding: 18px 16px;
    box-shadow: 0 8px 0 var(--poire-sombre), 0 15px 40px rgba(0,0,0,.5); text-align: center;
    display: flex; flex-direction: column; gap: 8px; animation: pop .4s cubic-bezier(.17,.89,.32,1.49);
}
.titre-fin { font-family: 'Bangers', sans-serif; font-size: 1.9rem; letter-spacing: 2px; line-height: 1.05; }
.score-fin { font-family: 'Bangers', sans-serif; font-size: 3.4rem; line-height: 1; }
.etoiles-fin { color: #b8860b; letter-spacing: 4px; text-shadow: 0 2px 0 rgba(0,0,0,.15); }
.sous-fin { font-weight: 900; font-size: .8rem; opacity: .8; }
.medaille { font-family: 'Bangers', sans-serif; font-size: 1.25rem; letter-spacing: 2px; background: #000; color: var(--or); border-radius: 12px; padding: 5px; }
.medaille small { font-family: 'Nunito', sans-serif; font-size: .7rem; letter-spacing: 0; }
.gains { display: flex; justify-content: center; gap: 12px; font-weight: 900; font-size: .95rem; }
.info-fin { background: rgba(0,0,0,.1); border-radius: 10px; padding: 5px 8px; font-size: .76rem; font-weight: 900; }
.boutons-fin { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-top: 4px; }
.boutons-fin .btn { flex: 1 1 40%; border-color: rgba(0,0,0,.25); background: rgba(0,0,0,.08); }
.boutons-fin .btn.noir { flex-basis: 100%; background: #000; color: var(--poire); }
.carte-fin .citation { margin-top: 2px; }
.continuer .btn-jouer { font-size: 1.4rem; }
.compte { height: 6px; background: rgba(0,0,0,.2); border-radius: 3px; overflow: hidden; }
.compte i { display: block; height: 100%; width: 100%; background: #000; transition: width .1s linear; }

/* ---------- modales ---------- */
.surcouche { position: fixed; inset: 0; z-index: 99990; background: rgba(0,0,0,.82); backdrop-filter: blur(5px); display: grid; place-items: center; padding: 16px; }
.modale {
    position: relative; background: var(--carte); border: 2px solid var(--poire); border-radius: 18px; padding: 20px 18px;
    width: min(360px, 100%); text-align: center; animation: pop .3s cubic-bezier(.17,.89,.32,1.49);
}
.modale h2 { color: var(--poire); font-size: 1.5rem; margin-bottom: 8px; }
.modale .fermer { position: absolute; top: 8px; right: 10px; width: 28px; height: 28px; border-radius: 50%; background: rgba(255,255,255,.1); }
.modale .actions { display: flex; gap: 8px; justify-content: center; margin-top: 12px; }
.grand-champ { width: 100%; text-align: center; font-size: 1.1rem; letter-spacing: 2px; margin-top: 8px; }
.msg-code { min-height: 22px; margin-top: 8px; font-weight: 900; font-size: .85rem; }
.texte-msg { margin: 10px 0; line-height: 1.5; white-space: pre-wrap; }

/* ---------- toasts & pluie ---------- */
#toasts { position: fixed; top: 12px; left: 50%; transform: translateX(-50%); z-index: 99999; display: flex; flex-direction: column; gap: 6px; align-items: center; pointer-events: none; width: min(360px, calc(100% - 24px)); }
.toast { background: #111820; border: 1px solid rgba(255,255,255,.15); border-left: 5px solid var(--poire); border-radius: 12px; padding: 9px 14px; font-weight: 900; font-size: .85rem; box-shadow: 0 8px 24px rgba(0,0,0,.5); animation: toastIn .3s cubic-bezier(.17,.89,.32,1.49); width: 100%; }
.toast.sort { opacity: 0; transform: translateY(-10px); transition: all .3s; }
@keyframes toastIn { from { transform: translateY(-20px); opacity: 0; } }
.succes-toast { display: flex; gap: 10px; align-items: center; border-left-color: var(--or); }
.succes-toast .ic { font-size: 1.6rem; }
.succes-toast small { display: block; font-weight: 400; opacity: .7; font-size: .7rem; }
.poire-fond, .emoji-tombe { position: fixed; top: -60px; z-index: 0; pointer-events: none; animation: tombe linear forwards; }
.poire-fond { opacity: .35; }
.emoji-tombe { z-index: 9997; font-size: 1.3rem; }
@keyframes tombe { to { transform: translateY(115vh) rotate(360deg); } }
#scene { position: relative; z-index: 1; }
