/* =====================================================================
   PASSE OU CASSE ! — gros contours noirs, couleurs qui pètent,
   boutons « cube » (pastilles épaisses avec leur ombre dessous).
   Rien ne clignote ; .photosensible coupe aussi les secousses.
   ===================================================================== */
:root {
    --noir: #14101c; --jaune: #ffd23d; --rose: #ff4fa3; --ciel: #35d6ff; --menthe: #5be35b; --orange: #ff9a3c; --violet: #9b6bff; --rouge: #ff5a4f; --blanc: #fff;
    --titre: "Luckiest Guy", "Lilita One", system-ui, sans-serif;
    --texte: "Nunito", system-ui, sans-serif;
    --haut: env(safe-area-inset-top, 0px); --bas: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--noir); color: var(--blanc); font-family: var(--texte); font-weight: 800; }
body { user-select: none; -webkit-user-select: none; overscroll-behavior: none; }
canvas#jeu { position: fixed; inset: 0; display: block; touch-action: none; }
button { font: inherit; color: inherit; cursor: pointer; }
.ico { width: 22px; height: 22px; display: block; }
[hidden] { display: none !important; }
.titre { font-family: var(--titre); letter-spacing: .02em; }
.contour { paint-order: stroke fill; -webkit-text-stroke: 6px var(--noir); }

/* ------------------------------ les cubes ------------------------------ */
.cube {
    --c1: var(--jaune); --c2: #ffb000;
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    min-height: 48px; padding: 10px 18px; border: 3px solid var(--noir); border-radius: 16px;
    background: linear-gradient(180deg, var(--c1), var(--c2)); color: var(--noir);
    font-family: var(--titre); font-size: 20px; letter-spacing: .03em; text-transform: uppercase;
    box-shadow: 0 6px 0 var(--noir), inset 0 3px 0 rgba(255,255,255,.45);
    transition: transform .08s ease, box-shadow .08s ease; position: relative;
}
.cube:active { transform: translateY(4px); box-shadow: 0 2px 0 var(--noir), inset 0 3px 0 rgba(255,255,255,.45); }
.cube:disabled { filter: grayscale(.8) brightness(.85); cursor: default; }
.cube-rose { --c1: #ff7ab9; --c2: var(--rose); color: #fff; }
.cube-ciel { --c1: #8fe9ff; --c2: var(--ciel); }
.cube-menthe { --c1: #a6f59a; --c2: var(--menthe); }
.cube-orange { --c1: #ffc07a; --c2: var(--orange); }
.cube-violet { --c1: #c3a6ff; --c2: var(--violet); color: #fff; }
.cube-rouge { --c1: #ff8c84; --c2: var(--rouge); color: #fff; }
.cube-gris { --c1: #f2f0f7; --c2: #c9c5d6; }
.cube-noir { --c1: #3a3448; --c2: #241f30; color: #fff; }
.cube-carre { width: 48px; padding: 0; }
.cube-geant { font-size: 34px; min-height: 76px; padding: 12px 34px; border-radius: 22px; border-width: 4px; box-shadow: 0 9px 0 var(--noir), inset 0 4px 0 rgba(255,255,255,.5); }
.cube .pastille { position: absolute; top: -10px; right: -8px; background: var(--rouge); color: #fff; border: 3px solid var(--noir); border-radius: 999px; font-size: 13px; padding: 1px 7px; font-family: var(--texte); font-weight: 900; }
.cube .sous { display: block; font-family: var(--texte); font-size: 12px; text-transform: none; letter-spacing: 0; opacity: .8; }
.ruban { position: absolute; top: -12px; left: -8px; background: var(--rose); color: #fff; border: 3px solid var(--noir); border-radius: 8px; font-family: var(--titre); font-size: 12px; padding: 2px 8px; transform: rotate(-6deg); }

/* ------------------------------- écrans ------------------------------- */
.ecran { position: fixed; inset: 0; overflow-y: auto; padding: calc(14px + var(--haut)) 16px calc(90px + var(--bas)); display: flex; flex-direction: column; align-items: center; }
.ecran:empty { display: none; }
body.en-jeu .ecran { pointer-events: none; }
.panneau { width: min(560px, 100%); background: rgba(20,16,28,.88); border: 4px solid var(--noir); border-radius: 24px; padding: 18px; box-shadow: 0 10px 0 rgba(0,0,0,.35); }
.entete { width: min(560px, 100%); display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.entete h2 { flex: 1; margin: 0; font-family: var(--titre); font-size: 30px; paint-order: stroke fill; -webkit-text-stroke: 6px var(--noir); color: var(--jaune); }

/* ------------------------------- accueil ------------------------------- */
.logo { margin: 6px 0 2px; text-align: center; font-family: var(--titre); line-height: .9; transform: rotate(-4deg); animation: respire 2.6s ease-in-out infinite; }
.logo .l1, .logo .l3 { display: block; font-size: clamp(46px, 13vw, 88px); color: var(--jaune); paint-order: stroke fill; -webkit-text-stroke: 12px var(--noir); text-shadow: 0 8px 0 var(--noir); }
.logo .l3 { color: var(--rose); }
.logo .l2 { display: inline-block; margin: 4px 0; font-size: clamp(24px, 6vw, 36px); background: var(--ciel); color: var(--noir); border: 4px solid var(--noir); border-radius: 12px; padding: 0 14px; transform: rotate(5deg); }
@keyframes respire { 0%, 100% { transform: rotate(-4deg) scale(1); } 50% { transform: rotate(-3deg) scale(1.04); } }
.accroche { margin: 8px 0 14px; text-align: center; font-size: 15px; color: #fff; text-shadow: 0 2px 0 var(--noir); max-width: 440px; }
.accueil-milieu { flex: 1; min-height: 120px; }
.accueil-bas { width: min(560px, 100%); display: grid; gap: 12px; }
.grille-modes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.grille-modes .cube { flex-direction: column; gap: 2px; font-size: 16px; min-height: 68px; padding: 8px 6px; }
.grille-menu { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.grille-menu .cube { flex-direction: column; font-size: 12px; gap: 2px; padding: 8px 4px; min-height: 64px; }
.grille-menu .cube svg { width: 26px; height: 26px; }
.niveau-barre { display: flex; align-items: center; gap: 10px; background: rgba(20,16,28,.8); border: 3px solid var(--noir); border-radius: 14px; padding: 6px 12px; font-size: 14px; }
.niveau-barre .n { font-family: var(--titre); font-size: 20px; color: var(--jaune); }
.barre { flex: 1; height: 12px; background: #2b2438; border-radius: 99px; overflow: hidden; border: 2px solid var(--noir); }
.barre i { display: block; height: 100%; background: linear-gradient(90deg, var(--menthe), var(--jaune)); border-radius: 99px; }
.record-ligne { display: flex; justify-content: space-between; font-size: 13px; color: #d9d4e8; gap: 8px; flex-wrap: wrap; }
.record-ligne b { color: var(--jaune); }
.defi-pote { border: 4px solid var(--noir); background: linear-gradient(135deg, #ff7ab9, #9b6bff); border-radius: 18px; padding: 12px; display: flex; align-items: center; gap: 12px; box-shadow: 0 6px 0 var(--noir); }
.defi-pote b { font-family: var(--titre); font-size: 20px; display: block; }

/* ------------------------------- HUD ------------------------------- */
#hud { position: fixed; inset: 0; pointer-events: none; }
.hud-haut { position: absolute; top: calc(10px + var(--haut)); left: 10px; right: 10px; display: flex; align-items: flex-start; gap: 10px; }
.hud-haut > * { pointer-events: auto; }
.hud-score { flex: 1; text-align: center; font-family: var(--titre); }
.hud-score b { display: block; font-size: 40px; line-height: 1; color: #fff; paint-order: stroke fill; -webkit-text-stroke: 8px var(--noir); font-weight: 400; }
.hud-score span { display: inline-block; margin-top: 4px; font-size: 18px; color: var(--noir); background: var(--jaune); border: 3px solid var(--noir); border-radius: 10px; padding: 0 8px; }
.hud-score span:empty { display: none; }
.hud-droite { text-align: right; }
#hud-coeurs { display: flex; gap: 2px; justify-content: flex-end; }
#hud-coeurs svg { width: 28px; height: 28px; }
#hud-mur { font-family: var(--titre); font-size: 16px; paint-order: stroke fill; -webkit-text-stroke: 5px var(--noir); }
#bandeau-mur { position: absolute; left: 50%; top: calc(92px + var(--haut)); transform: translateX(-50%); display: flex; align-items: center; gap: 8px; white-space: nowrap; }
#bandeau-mur b { font-family: var(--titre); font-weight: 400; font-size: 22px; color: var(--jaune); paint-order: stroke fill; -webkit-text-stroke: 6px var(--noir); }
#bandeau-mur span { font-family: var(--titre); font-size: 15px; border: 3px solid var(--noir); border-radius: 10px; padding: 1px 8px; color: var(--noir); background: var(--jaune); }
#bandeau-mur span:empty { display: none; }
#bandeau-mur span.rose { background: var(--rose); color: #fff; } #bandeau-mur span.violet { background: var(--violet); color: #fff; }
#bandeau-mur span.orange { background: var(--orange); } #bandeau-mur span.rouge { background: var(--rouge); color: #fff; }
#bandeau-mur.entre { animation: entre .45s cubic-bezier(.2, 1.6, .4, 1); }
@keyframes entre { from { transform: translateX(-50%) scale(.3) rotate(-8deg); opacity: 0; } to { transform: translateX(-50%) scale(1); opacity: 1; } }
#bouton-saut { position: fixed; right: 16px; bottom: calc(18px + var(--bas)); width: 96px; height: 96px; border-radius: 50%; flex-direction: column; gap: 0; font-size: 16px; --c1: #a6f59a; --c2: var(--menthe); }
#bouton-saut svg { width: 40px; height: 40px; }
#bouton-saut.calme { opacity: .45; }
#bouton-saut.vas-y { --c1: #fff08a; --c2: var(--jaune); animation: pousse .7s ease-in-out infinite; }
@keyframes pousse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.1); } }
#aide { position: fixed; left: 50%; bottom: calc(26px + var(--bas)); transform: translateX(-50%); width: min(92vw, 460px); text-align: center; background: rgba(20,16,28,.9); border: 3px solid var(--noir); border-radius: 16px; padding: 10px 14px; font-size: 15px; pointer-events: none; }
#aide b { color: var(--jaune); }

/* ------------------------------- annonces ------------------------------- */
#annonce { position: fixed; left: 0; right: 0; top: 30%; text-align: center; pointer-events: none; z-index: 20; }
.ann { display: inline-block; animation: ann 1.25s cubic-bezier(.2, 1.4, .4, 1) forwards; }
.ann b { display: block; font-family: var(--titre); font-weight: 400; font-size: clamp(44px, 12vw, 92px); line-height: 1; paint-order: stroke fill; -webkit-text-stroke: 12px var(--noir); text-shadow: 0 8px 0 var(--noir); transform: rotate(-5deg); }
.ann span { display: inline-block; margin-top: 10px; font-family: var(--titre); font-size: clamp(16px, 4vw, 24px); background: #fff; color: var(--noir); border: 3px solid var(--noir); border-radius: 12px; padding: 2px 12px; }
.ann span:empty { display: none; }
.ann.jaune b { color: var(--jaune); } .ann.rose b { color: var(--rose); } .ann.menthe b { color: var(--menthe); } .ann.rouge b { color: var(--rouge); }
.ann.ciel b { color: var(--ciel); } .ann.orange b { color: var(--orange); } .ann.violet b { color: var(--violet); }
@keyframes ann { 0% { transform: scale(.2) rotate(-12deg); opacity: 0; } 18% { transform: scale(1.12) rotate(2deg); opacity: 1; } 30% { transform: scale(1) rotate(0); } 80% { opacity: 1; transform: scale(1); } 100% { opacity: 0; transform: scale(1.05) translateY(-20px); } }
body.photosensible .ann { animation-name: ann-calme; }
@keyframes ann-calme { 0% { opacity: 0; } 15% { opacity: 1; } 80% { opacity: 1; } 100% { opacity: 0; } }
body.photosensible .logo, body.photosensible #bouton-saut.vas-y { animation: none; }

/* ------------------------------- fin de partie ------------------------------- */
.fin-titre { font-family: var(--titre); text-align: center; font-size: clamp(40px, 11vw, 70px); line-height: .95; paint-order: stroke fill; -webkit-text-stroke: 10px var(--noir); color: var(--rose); transform: rotate(-3deg); margin: 4px 0 10px; text-shadow: 0 6px 0 var(--noir); }
.fin-titre.record { color: var(--jaune); }
.photo { width: 100%; border: 4px solid var(--noir); border-radius: 18px; overflow: hidden; background: #000; position: relative; box-shadow: 0 6px 0 var(--noir); }
.photo canvas, .photo img { display: block; width: 100%; height: auto; max-height: 38vh; object-fit: cover; }
.photo .legende { position: absolute; left: 10px; top: 10px; font-family: var(--titre); background: var(--jaune); color: var(--noir); border: 3px solid var(--noir); border-radius: 10px; padding: 0 8px; transform: rotate(-3deg); }
.chiffres { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 12px 0; }
.chiffres div { background: #241f30; border: 3px solid var(--noir); border-radius: 14px; padding: 8px 4px; text-align: center; font-size: 12px; color: #cfc9de; }
.chiffres b { display: block; font-family: var(--titre); font-weight: 400; font-size: 26px; color: #fff; }
.chiffres .gros { grid-column: span 3; }
.chiffres .gros b { font-size: 46px; color: var(--jaune); }
.histo { display: flex; flex-wrap: wrap; gap: 3px; justify-content: center; margin: 6px 0; }
.histo i { width: 16px; height: 16px; border-radius: 4px; border: 2px solid var(--noir); }
.histo .P { background: var(--jaune); } .histo .O { background: var(--menthe); } .histo .X { background: var(--rouge); }
.actions { display: grid; gap: 10px; margin-top: 12px; }
.actions.deux { grid-template-columns: 1fr 1fr; }
.nouveau { display: flex; align-items: center; gap: 10px; background: #241f30; border: 3px solid var(--noir); border-radius: 14px; padding: 6px 10px; margin-top: 8px; }
.nouveau canvas, .nouveau .vignette { width: 44px; height: 44px; flex: none; }
.nouveau b { color: var(--jaune); font-family: var(--titre); font-weight: 400; }

/* ------------------------------- vestiaire / boutique ------------------------------- */
.onglets { width: min(560px, 100%); display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin-bottom: 12px; }
.onglets .cube { font-size: 12px; padding: 6px 2px; min-height: 44px; }
.onglets .cube.actif { --c1: #ff7ab9; --c2: var(--rose); color: #fff; }
.grille { width: min(560px, 100%); display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px; }
.objet { background: #241f30; border: 3px solid var(--noir); border-radius: 16px; padding: 8px; text-align: center; position: relative; box-shadow: 0 5px 0 var(--noir); cursor: pointer; }
.objet canvas { width: 100%; aspect-ratio: 1; display: block; border-radius: 10px; }
.objet .nom { font-size: 13px; margin-top: 4px; line-height: 1.15; }
.objet .cond { font-size: 11px; color: #bdb6cf; margin-top: 2px; }
.objet.porte { background: #3a2f12; border-color: var(--jaune); }
.objet.porte::after { content: 'PORTÉ'; position: absolute; top: -10px; right: -6px; background: var(--jaune); color: var(--noir); border: 3px solid var(--noir); border-radius: 8px; font-family: var(--titre); font-size: 11px; padding: 1px 6px; }
.objet.verrou canvas { filter: grayscale(1) brightness(.45); }
.offre { background: #241f30; border: 4px solid var(--noir); border-radius: 20px; padding: 14px; margin-bottom: 14px; position: relative; box-shadow: 0 6px 0 var(--noir); width: min(560px, 100%); }
.offre h3 { margin: 0 0 4px; font-family: var(--titre); font-weight: 400; font-size: 24px; }
.offre p { margin: 4px 0 10px; font-size: 14px; color: #d9d4e8; }
.offre .tetes { display: flex; gap: 6px; margin-bottom: 8px; }
.offre .tetes canvas { width: 52px; height: 52px; }
.offre .bas { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.offre .prix { font-family: var(--titre); font-size: 28px; color: var(--jaune); }
.offre .vaut { font-size: 12px; color: #bdb6cf; }
.offre.jaune { background: linear-gradient(160deg, #4a3b0e, #241f30); } .offre.rose { background: linear-gradient(160deg, #4d1834, #241f30); }
.offre.violet { background: linear-gradient(160deg, #2d1a52, #241f30); } .offre.orange { background: linear-gradient(160deg, #4d2a0e, #241f30); }
.note { width: min(560px, 100%); font-size: 13px; color: #d9d4e8; background: rgba(20,16,28,.85); border: 3px dashed #4a4260; border-radius: 14px; padding: 10px 12px; margin-bottom: 14px; }
.liste-succes { width: min(560px, 100%); display: grid; gap: 8px; }
.succes { display: flex; align-items: center; gap: 12px; background: #241f30; border: 3px solid var(--noir); border-radius: 14px; padding: 8px 12px; }
.succes .m { width: 38px; height: 38px; flex: none; border-radius: 50%; border: 3px solid var(--noir); background: #3a3448; display: grid; place-items: center; font-family: var(--titre); }
.succes.ok .m { background: var(--jaune); color: var(--noir); }
.succes small { display: block; color: #bdb6cf; font-weight: 700; }
.succes .gain { margin-left: auto; font-size: 11px; color: var(--ciel); text-align: right; }

/* ------------------------------- formulaires ------------------------------- */
.champ { display: grid; gap: 6px; margin-bottom: 12px; }
.champ label { font-size: 14px; }
input[type=text], textarea { width: 100%; font: inherit; font-weight: 800; background: #fff; color: var(--noir); border: 3px solid var(--noir); border-radius: 12px; padding: 10px 12px; user-select: text; -webkit-user-select: text; }
input[type=range] { width: 100%; accent-color: var(--jaune); }
.interrupteur { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 2px solid #2b2438; }
.interrupteur small { display: block; color: #bdb6cf; font-weight: 700; font-size: 12px; }
.bascule { width: 58px; height: 32px; border-radius: 99px; border: 3px solid var(--noir); background: #4a4260; position: relative; flex: none; }
.bascule::after { content: ''; position: absolute; top: 2px; left: 2px; width: 22px; height: 22px; border-radius: 50%; background: #fff; border: 2px solid var(--noir); transition: left .15s; }
.bascule.on { background: var(--menthe); } .bascule.on::after { left: 28px; }

/* ------------------------------- créateur et duel ------------------------------- */
/* la barre ne prend que les clics de ses boutons : le reste passe au perso dessous */
.barre-createur { position: fixed; left: 0; right: 0; bottom: 0; padding: 10px 12px calc(12px + var(--bas)); display: grid; gap: 8px; background: linear-gradient(180deg, rgba(20,16,28,0), rgba(20,16,28,.95) 30%); pointer-events: none; }
.barre-createur button { pointer-events: auto; }
.haut-createur { pointer-events: none; }
.haut-createur button { pointer-events: auto; }
.barre-createur .rangee { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.barre-createur .cube { font-size: 15px; min-height: 44px; padding: 6px 12px; }
.vignettes { display: flex; gap: 6px; justify-content: center; }
.vignettes span { width: 38px; height: 38px; border: 3px solid var(--noir); border-radius: 10px; background: #3a3448; display: grid; place-items: center; font-family: var(--titre); font-size: 16px; }
.vignettes span.plein { background: var(--jaune); color: var(--noir); }
.haut-createur { position: fixed; top: calc(10px + var(--haut)); left: 10px; right: 10px; display: flex; gap: 10px; align-items: center; }
.haut-createur h2 { flex: 1; margin: 0; font-family: var(--titre); font-weight: 400; font-size: 24px; paint-order: stroke fill; -webkit-text-stroke: 6px var(--noir); color: var(--jaune); }
.joueurs { display: grid; gap: 8px; margin-bottom: 12px; }
.joueur { display: flex; align-items: center; gap: 8px; }
.joueur canvas { width: 48px; height: 48px; cursor: pointer; flex: none; }
.podium { display: grid; gap: 8px; }
.podium div { display: flex; align-items: center; gap: 10px; background: #241f30; border: 3px solid var(--noir); border-radius: 14px; padding: 8px 12px; }
.podium .rang { font-family: var(--titre); font-size: 26px; width: 34px; color: var(--jaune); }
.podium canvas { width: 44px; height: 44px; }
.podium b { flex: 1; }

/* ------------------------------- modale, toasts, pubs ------------------------------- */
#modale { position: fixed; inset: 0; z-index: 40; background: rgba(10,8,16,.72); display: grid; place-items: center; padding: 16px; }
.boite { width: min(440px, 100%); max-height: 92vh; overflow-y: auto; background: #1d1828; border: 4px solid var(--noir); border-radius: 24px; padding: 18px; box-shadow: 0 10px 0 rgba(0,0,0,.4); }
.boite h3 { margin: 0 0 10px; font-family: var(--titre); font-weight: 400; font-size: 28px; color: var(--jaune); paint-order: stroke fill; -webkit-text-stroke: 6px var(--noir); text-align: center; }
.boite p { font-size: 15px; color: #e3deef; }
.boite code { background: #2b2438; border-radius: 6px; padding: 2px 6px; user-select: all; -webkit-user-select: all; }
#toasts { position: fixed; top: calc(12px + var(--haut)); left: 50%; transform: translateX(-50%); z-index: 50; display: grid; gap: 8px; pointer-events: none; width: min(92vw, 420px); }
.toast { background: #fff; color: var(--noir); border: 3px solid var(--noir); border-radius: 14px; padding: 8px 12px; box-shadow: 0 5px 0 var(--noir); animation: toast .3s ease-out; display: flex; align-items: center; gap: 10px; }
.toast canvas { width: 36px; height: 36px; flex: none; }
@keyframes toast { from { transform: translateY(-20px); opacity: 0; } }
#banniere { position: fixed; left: 0; right: 0; bottom: 0; z-index: 5; text-align: center; padding-bottom: var(--bas); }
.banniere-test { display: inline-block; margin: 0 auto 6px; padding: 10px 18px; font-size: 12px; color: #bdb6cf; background: #241f30; border: 2px dashed #4a4260; border-radius: 10px; }
.pub-test { position: fixed; inset: 0; z-index: 90; background: rgba(0,0,0,.85); display: grid; place-items: center; }
.pub-test-boite { width: min(340px, 90vw); background: #fff; color: var(--noir); border: 4px solid var(--noir); border-radius: 20px; padding: 18px; text-align: center; }
.pub-test-badge { display: inline-block; background: var(--rouge); color: #fff; border: 3px solid var(--noir); border-radius: 10px; font-family: var(--titre); padding: 2px 10px; }
.pub-test-type { font-size: 13px; color: #555; }
.pub-icone { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 6px; background: var(--noir); color: #fff; font-size: 10px; font-family: var(--titre); }

@media (max-width: 420px) {
    .grille-menu .cube { font-size: 10px; }
    .grille-modes .cube { font-size: 14px; }
    .hud-score b { font-size: 32px; }
    #bandeau-mur { top: calc(80px + var(--haut)); }
    #bandeau-mur b { font-size: 18px; }
    #bouton-saut { width: 82px; height: 82px; }
}
