/* ==========================================================================
   MAACO GAMES STUDIO — Puissance 4 contre BOB (plateau, BOB, note de jeu)
   ========================================================================== */
:root {
  --g-night: #0F1A4A;
  --g-night-2: #1A2766;
  --g-line: rgba(255, 201, 60, .3);
  --g-line-2: rgba(255, 255, 255, .12);
  --g-muted: rgba(230, 236, 255, .74);
  --g-ink: #172057;
  --g-spring: cubic-bezier(.34, 1.56, .64, 1);
  --g-out: cubic-bezier(.16, 1, .3, 1);
}
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--g-line); border-top-color: var(--gold); animation: gspin .8s linear infinite; }
@keyframes gspin { to { transform: rotate(360deg); } }

/* ---------- Puissance 4 ---------- */
.p4 { position: relative; display: grid; gap: 1rem; width: 100%; max-width: 640px; }
.p4__top { display: flex; align-items: center; gap: 1rem; min-height: 74px; }
.p4__speech { position: relative; flex: 1; margin: 0; padding: .75rem 1rem; border-radius: 18px 18px 18px 4px; background: var(--cream); color: var(--g-ink); font-weight: 700; font-size: .9rem; box-shadow: 0 14px 30px -14px #000; }
.p4__speech.is-in { animation: gPop .45s var(--g-spring); }
@keyframes gPop { from { opacity: 0; transform: translateY(6px) scale(.96); } }
.p4__bar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.p4__series { display: flex; align-items: center; gap: .7rem; flex-wrap: wrap; }
.p4__series small { font-size: .68rem; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; color: var(--g-muted); }
.p4__slots { display: flex; gap: .35rem; }
.p4__slots i { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--g-line); color: var(--g-night); }
.p4__slots i .i { width: 14px; height: 14px; stroke-width: 3; }
.p4__slots i.is-won { background: linear-gradient(135deg, #FFE08A, #FFC93C); border-color: transparent; }
.p4__slots i.is-lost { background: rgba(255, 77, 94, .25); border-color: rgba(255, 77, 94, .6); color: var(--ember-2); }
.p4__slots i.is-draw { background: rgba(244, 239, 230, .15); }
.p4__slots i.is-live { border-color: var(--ember); animation: gLive 1.2s ease-in-out infinite; }
@keyframes gLive { 50% { box-shadow: 0 0 0 6px rgba(255, 77, 94, .2); } }
.p4__wins { font-size: .82rem; color: var(--g-muted); }
.p4__wins b { font-family: var(--f-display); font-weight: 400; font-size: 1.4rem; color: var(--gold-2); }
.p4__overlay { position: absolute; inset: 64px 0 46px; z-index: 6; display: grid; place-items: center; padding: 1rem; border-radius: 26px; background: rgba(10, 18, 64, .74); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); animation: gFade .4s; }
@keyframes gFade { from { opacity: 0; } }
.p4-card { display: grid; justify-items: center; gap: .7rem; max-width: 420px; padding: 1.6rem; text-align: center; border-radius: 24px; background: var(--g-night-2); border: 1px solid var(--g-line); box-shadow: 0 30px 60px -20px #000; animation: gPop .5s var(--g-spring); }
.p4-card h3 { margin: 0; font-family: var(--f-display); font-weight: 400; font-size: 2.2rem; line-height: 1; text-transform: uppercase; }
.p4-card p { margin: 0; color: var(--g-muted); font-size: .9rem; }
.p4-card .t-ember { color: var(--ember-2); }
.p4-code { display: flex; gap: .5rem; flex-wrap: wrap; justify-content: center; }
.p4-code .input { width: 170px; text-align: center; text-transform: uppercase; letter-spacing: .14em; font-weight: 800; }

.c4 { position: relative; padding-top: calc(100% / 7); user-select: none; -webkit-user-select: none; }
.c4__ghost { position: absolute; top: 0; left: calc(var(--c, 3) * 100% / 7); width: calc(100% / 7); aspect-ratio: 1; display: grid; place-items: center; opacity: 0; transition: left .18s var(--g-out), opacity .2s; pointer-events: none; }
.c4__ghost::before { content: ''; width: 72%; height: 72%; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #FF8A95, var(--ember) 60%, #B3122A); box-shadow: 0 0 20px rgba(255, 77, 94, .5); animation: gBob 1s ease-in-out infinite; }
.c4__ghost.is-on { opacity: .9; }
@keyframes gBob { 50% { transform: translateY(-5px); } }
.c4__board { position: relative; isolation: isolate; aspect-ratio: 7 / 6; }
.c4__tokens { position: absolute; inset: 0; z-index: 1; }
.c4-tok { position: absolute; left: calc(var(--c) * 100% / 7); top: calc((5 - var(--r)) * 100% / 6); width: calc(100% / 7); height: calc(100% / 6); display: grid; place-items: center; }
.c4-tok::before { content: ''; width: 79%; height: 79%; border-radius: 50%; transition: box-shadow .4s, opacity .4s; }
.c4-tok--p1::before { background: radial-gradient(circle at 34% 28%, #FFB3BB 0%, #FF7A86 22%, var(--ember) 55%, #B3122A 100%); box-shadow: inset 0 -4px 8px rgba(0, 0, 0, .3), inset 0 0 0 4px rgba(255, 255, 255, .08); }
.c4-tok--p2::before { background: radial-gradient(circle at 34% 28%, #FFF6D2 0%, #FFE08A 25%, var(--gold) 58%, #A86F00 100%); box-shadow: inset 0 -4px 8px rgba(0, 0, 0, .3), inset 0 0 0 4px rgba(255, 255, 255, .1); }
.c4-tok svg { position: absolute; width: 46%; height: 46%; color: rgba(150, 90, 0, .55); }
.c4-tok.is-win::before { box-shadow: 0 0 0 4px #FEFDF9, 0 0 30px 10px rgba(255, 210, 120, .75); animation: gTokWin .9s ease-in-out infinite alternate; }
@keyframes gTokWin { to { transform: scale(1.08); } }
.c4.is-over .c4-tok:not(.is-win) { opacity: .4; }
.c4__front { position: absolute; inset: 0; z-index: 2; width: 100%; height: 100%; pointer-events: none; border-radius: 4.5%; filter: drop-shadow(0 26px 30px rgba(0, 0, 0, .55)); }
.c4__board::after { content: ''; position: absolute; inset: -6px; z-index: -1; border-radius: 6%; background: linear-gradient(135deg, #7FA6FF, #2442D6 50%, #4F8CFF); box-shadow: 0 40px 60px -30px #000; }
.c4__board::before { content: ''; position: absolute; inset: 0; z-index: 0; border-radius: 4.5%; background: #0A1240; }
.c4__cols { position: absolute; inset: calc(-100% / 6) 0 0; z-index: 3; display: grid; grid-template-columns: repeat(7, 1fr); }
.c4__cols button { border-radius: 14px; transition: background .2s; -webkit-tap-highlight-color: transparent; }
.c4.is-active .c4__cols button { cursor: pointer; }
.c4.is-active .c4__cols button:hover { background: linear-gradient(180deg, rgba(254, 253, 249, .06), rgba(254, 253, 249, .02)); }
.c4.is-active .c4__cols button:focus-visible { outline: 2px solid var(--gold); outline-offset: -4px; }
.c4.is-shake { animation: gShake .4s; }
@keyframes gShake { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }

/* Fin de partie : ligne gagnante, bandeau, confettis, plateau qui tremble */
.c4__line { position: absolute; inset: 0; z-index: 4; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.c4__line line { stroke: #FFF6DC; stroke-width: 15; stroke-linecap: round; stroke-dasharray: 1; stroke-dashoffset: 1; animation: c4Line .55s .1s var(--g-out) forwards; }
.c4__line--won { filter: drop-shadow(0 0 6px #FF8A95) drop-shadow(0 0 18px #FF4D5E); }
.c4__line--lost { filter: drop-shadow(0 0 6px #FFEFB8) drop-shadow(0 0 18px #FFC93C); }
@keyframes c4Line { to { stroke-dashoffset: 0; } }
.c4-banner { position: absolute; left: 50%; top: 50%; z-index: 5; display: grid; justify-items: center; width: max-content; max-width: 104%; translate: -50% -50%; text-align: center; pointer-events: none; }
.c4-banner b { font-family: var(--f-display); font-weight: 400; font-size: clamp(2.5rem, 11.5vw, 5.4rem); line-height: .95; letter-spacing: .02em; text-transform: uppercase; white-space: nowrap; }
.c4-banner span { margin-top: .5rem; padding: .4rem 1rem; border-radius: 999px; background: rgba(10, 18, 64, .82); border: 1px solid var(--g-line); color: var(--cream); font-weight: 800; font-size: clamp(.78rem, 2.6vw, .95rem); animation: c4Rise .5s .35s var(--g-out) both; }
.c4-banner--won::before { content: ''; position: absolute; left: 50%; top: 45%; z-index: -1; width: 190%; aspect-ratio: 1; translate: -50% -50%; border-radius: 50%; background: repeating-conic-gradient(rgba(255, 228, 160, .26) 0deg 8deg, transparent 8deg 20deg); -webkit-mask: radial-gradient(circle, #000 18%, transparent 66%); mask: radial-gradient(circle, #000 18%, transparent 66%); animation: gspin 9s linear infinite, gFade .6s both; }
.c4-banner--won b { background: linear-gradient(180deg, #FFF8E6 10%, #FFE08A 50%, #FFC93C 90%); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 5px 0 #A86F00) drop-shadow(0 16px 26px rgba(0, 0, 0, .7)); animation: c4Slam .75s var(--g-spring) both; }
.c4-banner--lost b { color: #FF4D5E; text-shadow: 0 0 26px rgba(255, 70, 40, .75), 3px 0 0 rgba(0, 220, 255, .5), -3px 0 0 rgba(255, 0, 90, .55), 0 10px 26px rgba(0, 0, 0, .8); animation: c4Slam .55s var(--g-spring) both, c4Glitch 1.8s .7s steps(1) infinite; }
.c4-banner--draw b { color: var(--cream); text-shadow: 0 10px 26px rgba(0, 0, 0, .8); animation: c4Rise .6s var(--g-out) both; }
@keyframes c4Slam { from { opacity: 0; transform: scale(2.7) rotate(-7deg); } 55% { opacity: 1; } }
@keyframes c4Rise { from { opacity: 0; transform: translateY(16px); } }
@keyframes c4Glitch { 0%, 100% { transform: none; } 6% { transform: translate(-4px, 1px) skewX(-9deg); } 8% { transform: translate(4px, -1px); } 10% { transform: none; } 54% { transform: translate(3px, 0) skewX(7deg); } 56% { transform: none; } }
.c4.is-glory .c4__board::after { animation: c4Glory 1.1s ease-in-out 2; }
@keyframes c4Glory { 50% { box-shadow: 0 0 0 4px rgba(255, 230, 170, .6), 0 0 70px 14px rgba(255, 77, 94, .55), 0 40px 60px -30px #000; filter: brightness(1.35); } }
.c4.is-quake .c4__board { animation: c4Quake .65s cubic-bezier(.36, .07, .19, .97) both; }
@keyframes c4Quake { 10%, 90% { transform: translateX(-2px) rotate(-.3deg); } 20%, 80% { transform: translateX(5px) rotate(.4deg); } 30%, 50%, 70% { transform: translateX(-9px) rotate(-.6deg); } 40%, 60% { transform: translateX(9px) rotate(.6deg); } }
.c4-flash { position: absolute; inset: -8px; z-index: 6; border-radius: 6%; pointer-events: none; box-shadow: inset 0 0 90px 26px rgba(230, 40, 25, .6); animation: c4Flash 1.4s ease-out forwards; }
@keyframes c4Flash { from { opacity: 0; } 12% { opacity: 1; } to { opacity: 0; } }
.c4-confetti { position: fixed; inset: 0; z-index: 150; width: 100%; height: 100%; pointer-events: none; }

/* BOB, le champion de MAACO GAMES STUDIO */
.bob { position: relative; flex: none; width: 78px; height: 66px; display: flex; align-items: center; justify-content: center; gap: 14px; border-radius: 20px; background: linear-gradient(180deg, #2A3B9C, #16206A); border: 2px solid var(--gold); box-shadow: 0 12px 26px -10px #000, inset 0 2px 0 rgba(255, 255, 255, .08); margin-top: 14px; }
.bob__ant { position: absolute; top: -17px; left: 50%; width: 3px; height: 15px; translate: -50% 0; background: var(--gold); border-radius: 2px; }
.bob__ant::after { content: ''; position: absolute; top: -8px; left: 50%; width: 10px; height: 10px; translate: -50% 0; border-radius: 50%; background: var(--ember-2); box-shadow: 0 0 12px 3px rgba(255, 122, 134, .7); animation: gAnt 1.8s ease-in-out infinite; }
@keyframes gAnt { 50% { opacity: .55; } }
.bob__eye { position: relative; width: 15px; height: 15px; border-radius: 50%; background: var(--ember-2); box-shadow: 0 0 12px 3px rgba(255, 122, 134, .65); animation: gBlink 4.5s infinite; transition: height .3s, border-radius .3s, background .3s; }
@keyframes gBlink { 0%, 92%, 100% { transform: scaleY(1); } 95% { transform: scaleY(.1); } }
.bob__mouth { position: absolute; bottom: 9px; left: 50%; width: 24px; height: 4px; translate: -50% 0; border-radius: 4px; background: rgba(254, 253, 249, .32); transition: all .3s; }
.bob--think .bob__eye { animation: gScan .7s ease-in-out infinite alternate; }
.bob--think .bob__ant::after { animation-duration: .35s; }
@keyframes gScan { from { transform: translateX(-4px); } to { transform: translateX(4px); } }
.bob--happy .bob__eye { height: 8px; border-radius: 15px 15px 2px 2px; }
.bob--happy .bob__mouth { height: 8px; width: 26px; border-radius: 0 0 14px 14px; background: var(--gold); }
.bob--sad .bob__eye { height: 7px; border-radius: 2px 2px 15px 15px; background: #8DC2F0; box-shadow: 0 0 12px 3px rgba(91, 164, 230, .6); }
.bob--sad .bob__mouth { width: 18px; height: 6px; border-radius: 14px 14px 0 0; bottom: 8px; }
.bob--smug .bob__eye:last-of-type { height: 4px; border-radius: 4px; }
.bob--smug .bob__mouth { width: 18px; translate: -30% 0; rotate: -8deg; }
/* BOB gagne : il saute de joie, yeux rouges incandescents */
.bob--victory { animation: bobHop .45s ease-in-out 5; }
.bob--victory .bob__eye { height: 9px; border-radius: 15px 15px 3px 3px; background: #FF3B2F; box-shadow: 0 0 20px 6px rgba(255, 59, 47, .85); animation: none; }
.bob--victory .bob__mouth { width: 30px; height: 10px; border-radius: 0 0 16px 16px; background: var(--gold); }
.bob--victory .bob__ant::after { animation-duration: .25s; }
@keyframes bobHop { 50% { transform: translateY(-9px) rotate(-5deg); } }
/* BOB perd : court-circuit, yeux en croix */
.bob--ko { animation: bobKo 1s var(--g-out) forwards; }
.bob--ko .bob__eye { background: none; box-shadow: none; animation: none; }
.bob--ko .bob__eye::before, .bob--ko .bob__eye::after { content: ''; position: absolute; left: 50%; top: 50%; width: 17px; height: 3px; border-radius: 2px; background: #8DC2F0; box-shadow: 0 0 8px rgba(91, 164, 230, .8); translate: -50% -50%; rotate: 45deg; }
.bob--ko .bob__eye::after { rotate: -45deg; }
.bob--ko .bob__mouth { width: 20px; height: 3px; rotate: 8deg; }
.bob--ko .bob__ant::after { background: #8DC2F0; box-shadow: 0 0 12px 3px rgba(91, 164, 230, .7); animation: gAnt .14s steps(2) infinite; }
@keyframes bobKo { 25% { transform: rotate(-14deg) translateX(-4px); } 50% { transform: rotate(9deg); } 75% { transform: rotate(-5deg); } to { transform: rotate(-7deg) translateY(3px); } }
.bob--sm { width: 56px; height: 48px; gap: 10px; border-radius: 15px; margin-top: 10px; }
.bob--sm .bob__eye { width: 11px; height: 11px; }

@media (max-width: 560px) {
  .p4__overlay { inset: 60px 0 50px; }
  .bob { width: 64px; height: 54px; gap: 11px; }
  .bob__eye { width: 12px; height: 12px; }
  .p4__speech { font-size: .82rem; }
  .gp__stage { padding: 1rem .7rem; }
}

/* ---------- Puissance 4 : qui commence ? ---------- */
.p4__overlay { display: flex; overflow-y: auto; overscroll-behavior: contain; }
.p4__overlay > .p4-card { margin: auto; }
.p4-first { display: grid; justify-items: center; gap: .45rem; width: 100%; }
.p4-first > span { font-size: .68rem; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; color: var(--g-muted); }
.p4-first__opts { display: inline-grid; grid-auto-flow: column; gap: 4px; padding: 4px; border-radius: 999px; background: rgba(254, 253, 249, .06); border: 1px solid var(--g-line-2); }
.p4-first__opts button { display: inline-flex; align-items: center; gap: .45rem; height: 38px; padding: 0 1.1rem; border-radius: 999px; font-weight: 800; font-size: .86rem; color: var(--g-muted); transition: background .3s, color .3s, transform .3s var(--g-spring); }
.p4-first__opts button.is-on { background: var(--cream); color: var(--g-ink); box-shadow: 0 8px 20px -10px #000; }
.p4-first__opts button:active { transform: scale(.95); }
.p4-first__dot { width: 14px; height: 14px; border-radius: 50%; flex: none; }
.p4-first__dot--p1 { background: radial-gradient(circle at 34% 28%, #FFB3BB, #FF7A86 30%, var(--ember) 60%, #B3122A); }
.p4-first__dot--p2 { background: radial-gradient(circle at 34% 28%, #FFF6D2, #FFE08A 30%, var(--gold) 62%, #A86F00); }
.p4-first small { font-size: .74rem; color: var(--g-muted); }

/* ---------- Puissance 4 : note de jeu (écran de résultat) ---------- */
@property --p { syntax: '<number>'; inherits: false; initial-value: 0; }
.p4r-mini { display: inline-flex; align-items: baseline; gap: .45rem; padding: .35rem .95rem; border-radius: 999px; background: rgba(255, 201, 60, .14); border: 1px solid var(--g-line); }
.p4r-mini b { font-family: var(--f-display); font-weight: 400; font-size: 1.7rem; line-height: 1; color: var(--gold-2); }
.p4r-mini span { font-size: .8rem; font-weight: 800; color: var(--cream); }
.p4r-see { font-size: .78rem; font-weight: 700; color: var(--gold-2); text-decoration: underline; text-underline-offset: 3px; }

.p4m { position: fixed; inset: 0; z-index: 420; display: grid; place-items: center; padding: 20px; }
.p4m__bg { position: absolute; inset: 0; background: rgba(8, 12, 40, .74); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); opacity: 0; transition: opacity .35s; }
.p4m.is-open .p4m__bg { opacity: 1; }
.p4m__box {
  position: relative; width: min(560px, 100%); max-height: calc(100svh - 40px); overflow-y: auto; overscroll-behavior: contain;
  border-radius: 32px; border: 1px solid var(--g-line); color: var(--cream); scrollbar-width: thin; scrollbar-color: rgba(255, 201, 60, .4) transparent;
  background: radial-gradient(ellipse 120% 60% at 50% 0%, rgba(255, 201, 60, .14), transparent 60%), linear-gradient(180deg, #1C2A72, #111A4D);
  box-shadow: 0 50px 100px -30px #000, inset 0 1px 0 rgba(255, 255, 255, .05);
  opacity: 0; transform: translateY(26px) scale(.96); transition: opacity .35s, transform .6s var(--g-spring);
}
.p4m.is-open .p4m__box { opacity: 1; transform: none; }
.p4m__x { position: absolute; top: 14px; right: 14px; z-index: 3; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: rgba(254, 253, 249, .08); color: var(--cream); transition: background .25s, transform .4s var(--g-spring); }
.p4m__x:hover { background: rgba(254, 253, 249, .16); transform: rotate(90deg); }
.p4m__x .i { width: 18px; height: 18px; }

.p4m__hero { display: grid; justify-items: center; gap: .55rem; padding: 2.1rem 3.6rem 1.3rem; text-align: center; }
.p4m__hero--won { background: radial-gradient(ellipse 80% 75% at 50% 0%, rgba(61, 190, 122, .22), transparent 70%); }
.p4m__hero--lost { background: radial-gradient(ellipse 80% 75% at 50% 0%, rgba(255, 77, 94, .2), transparent 70%); }
.p4m__outcome { font-size: .7rem; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; color: var(--g-muted); }
.p4m__ring {
  position: relative; width: 170px; height: 170px; margin: .35rem 0 .15rem; border-radius: 50%; display: grid; place-content: center; text-align: center;
  background: conic-gradient(from 210deg, var(--ember) 0%, var(--gold) calc(var(--p) * .55%), var(--gold-2) calc(var(--p) * 1%), rgba(254, 253, 249, .07) calc(var(--p) * 1%));
  filter: drop-shadow(0 18px 30px rgba(0, 0, 0, .55)); animation: p4mRing 1.6s var(--g-out);
}
.p4m__ring::before { content: ''; position: absolute; inset: 12px; border-radius: 50%; background: radial-gradient(circle at 50% 28%, #24348A, #121B52 72%); box-shadow: inset 0 2px 10px rgba(0, 0, 0, .5); }
.p4m__ring b, .p4m__ring small { position: relative; }
.p4m__ring b { font-family: var(--f-display); font-weight: 400; font-size: 4.2rem; line-height: .85; letter-spacing: .01em; font-variant-numeric: tabular-nums; }
.p4m__ring small { margin-top: .2rem; font-size: .62rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--g-muted); }
@keyframes p4mRing { from { --p: 0; } }
.p4m__hero h2 { margin: .1rem 0 0; font-family: var(--f-display); font-weight: 400; font-size: 2.7rem; line-height: 1; letter-spacing: .02em; text-transform: uppercase; color: var(--gold-2); text-shadow: 0 6px 24px rgba(255, 201, 60, .3); }
.p4m__hero p { margin: 0; max-width: 38ch; font-size: .92rem; color: var(--g-muted); }
.p4m__badge { display: inline-flex; align-items: center; gap: .45rem; padding: .45rem 1rem; border-radius: 999px; background: linear-gradient(135deg, #FFEFB8, #FFC93C); color: var(--g-ink); font-size: .8rem; font-weight: 800; box-shadow: 0 10px 24px -10px rgba(255, 201, 60, .8); animation: p4mBadge .8s var(--g-spring) 1s backwards; }
.p4m__badge .i { width: 16px; height: 16px; }
@keyframes p4mBadge { from { opacity: 0; transform: scale(.5) rotate(-8deg); } }
.p4m__tag { padding: .3rem .8rem; border-radius: 999px; border: 1px solid var(--g-line); font-size: .72rem; font-weight: 800; color: var(--gold-2); }

.p4m__stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: .5rem; padding: 0 1.4rem; }
.p4m__stats div { display: grid; gap: .2rem; padding: .85rem .4rem; border-radius: 18px; background: rgba(254, 253, 249, .05); border: 1px solid rgba(254, 253, 249, .07); text-align: center; }
.p4m__stats b { font-size: 1.2rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.p4m__stats span { font-size: .66rem; font-weight: 700; letter-spacing: .03em; color: var(--g-muted); }

.p4m__sec { display: grid; gap: .75rem; margin: 1.3rem 1.4rem 0; padding-top: 1.2rem; border-top: 1px solid rgba(254, 253, 249, .07); }
.p4m__sec h3 { margin: 0; font-size: .7rem; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; color: var(--gold); }
.p4m__bars { display: flex; align-items: flex-end; gap: 5px; height: 84px; padding: 0 2px 2px; border-bottom: 1px dashed rgba(254, 253, 249, .12); }
.p4m__bars i { flex: 1; max-width: 26px; height: var(--h); min-height: 6px; border-radius: 7px 7px 3px 3px; background: linear-gradient(180deg, var(--c), color-mix(in srgb, var(--c) 55%, #000)); transform-origin: bottom; animation: p4mBar .7s var(--g-out) backwards; animation-delay: calc(var(--i, 0) * 50ms + .35s); }
@keyframes p4mBar { from { transform: scaleY(0); } }
.p4m .is-brillant { --c: #B48CF2; }
.p4m .is-parfait { --c: #3DBE7A; }
.p4m .is-excellent { --c: #8EDDB0; }
.p4m .is-bon { --c: #FFE08A; }
.p4m .is-imprecis { --c: #E8A33D; }
.p4m .is-erreur { --c: #FF7A86; }
.p4m .is-gaffe { --c: #FF4D5E; }
.p4m__legend { display: flex; flex-wrap: wrap; gap: .4rem 1rem; font-size: .8rem; color: var(--g-muted); }
.p4m__legend span { display: inline-flex; align-items: center; gap: .35rem; }
.p4m__legend i { width: 10px; height: 10px; border-radius: 3px; background: var(--c); }
.p4m__legend b { color: var(--cream); }
.p4m__turn { display: flex; align-items: flex-start; gap: .55rem; margin: 0; padding: .75rem .9rem; border-radius: 16px; background: rgba(255, 77, 94, .1); border: 1px solid rgba(255, 77, 94, .22); color: #FFC2A8; font-size: .84rem; line-height: 1.45; }
.p4m__turn.is-good { background: rgba(180, 140, 242, .1); border-color: rgba(180, 140, 242, .25); color: #D9C6FA; }
.p4m__turn .i { flex: none; width: 18px; height: 18px; margin-top: 1px; }

.p4m__board { margin: 0; padding: 0; list-style: none; display: grid; gap: .35rem; }
.p4m__board li { display: flex; align-items: center; gap: .75rem; padding: .55rem .8rem; border-radius: 14px; background: rgba(254, 253, 249, .04); font-size: .9rem; }
.p4m__board li span:nth-child(2) { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.p4m__board li b { font-variant-numeric: tabular-nums; }
.p4m__board li.is-me { background: rgba(255, 201, 60, .16); color: var(--gold-2); font-weight: 800; box-shadow: inset 0 0 0 1px var(--g-line); }
.p4m__rank { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; flex: none; font-size: .74rem; font-weight: 800; background: rgba(254, 253, 249, .08); color: var(--cream); }
.p4m__board li:nth-child(1) .p4m__rank { background: linear-gradient(135deg, #FFEFB8, #FFC93C); color: var(--g-ink); }
.p4m__board li:nth-child(2) .p4m__rank { background: linear-gradient(135deg, #EEF1F4, #9AA3AB); color: var(--g-ink); }
.p4m__board li:nth-child(3) .p4m__rank { background: linear-gradient(135deg, #FFC9A8, #C46A2E); color: var(--g-ink); }
.p4m__best { margin: 0; font-size: .86rem; color: var(--g-muted); }
.p4m__best b { color: var(--gold-2); }
.p4m__best--solo { margin: 1.1rem 1.4rem 0; text-align: center; }

.p4m__how { margin: 1.2rem 1.4rem 0; border-radius: 16px; background: rgba(254, 253, 249, .04); border: 1px solid rgba(254, 253, 249, .06); }
.p4m__how summary { display: flex; align-items: center; gap: .5rem; padding: .85rem 1rem; cursor: pointer; list-style: none; font-size: .84rem; font-weight: 800; color: var(--gold-2); }
.p4m__how summary::-webkit-details-marker { display: none; }
.p4m__how summary::after { content: '+'; margin-left: auto; font-size: 1.1rem; transition: transform .3s; }
.p4m__how[open] summary::after { transform: rotate(45deg); }
.p4m__how summary .i { width: 17px; height: 17px; }
.p4m__how ul { display: grid; gap: .5rem; margin: 0; padding: 0 1.1rem 1.1rem 2.1rem; font-size: .82rem; line-height: 1.5; color: var(--g-muted); }
.p4m__how b { color: var(--cream); }

.p4m__next { justify-items: center; }
.p4m__next h3 { justify-self: start; }
.p4m__foot { position: sticky; bottom: 0; z-index: 2; display: flex; align-items: center; justify-content: center; gap: .6rem; margin-top: 1.1rem; padding: 1.4rem 1.4rem 1.2rem; background: linear-gradient(to top, #111A4D 64%, rgba(17, 26, 77, 0)); }
.p4m__cta { flex: 1; max-width: 300px; }
.p4m__close { height: 50px; padding: 0 1.2rem; border-radius: 999px; border: 1px solid var(--g-line-2); font-size: .86rem; font-weight: 700; color: var(--g-muted); transition: color .25s, border-color .25s; }
.p4m__close:hover { color: var(--cream); border-color: var(--g-line); }

@media (max-width: 560px) {
  .p4m { padding: 0; place-items: end stretch; }
  .p4m__box { width: 100%; max-height: 94svh; border-radius: 28px 28px 0 0; border-bottom: 0; transform: translateY(100%); opacity: 1; transition: transform .55s var(--g-out); padding-bottom: env(safe-area-inset-bottom); }
  .p4m__hero { padding: 1.8rem 3.4rem 1.2rem; }
  .p4m__ring { width: 144px; height: 144px; }
  .p4m__ring b { font-size: 3.5rem; }
  .p4m__hero h2 { font-size: 2.2rem; }
  .p4m__stats { grid-template-columns: repeat(2, 1fr); padding: 0 1rem; }
  .p4m__sec, .p4m__how { margin-left: 1rem; margin-right: 1rem; }
  .p4m__bars { gap: 3px; }
  .p4-card { padding: 1.1rem; gap: .55rem; }
  .p4-card h3 { font-size: 1.8rem; }
}
@media (prefers-reduced-motion: reduce) {
  .p4m__ring, .p4m__bars i, .p4m__badge { animation: none; }
}

/* BOB : expressions, accessoire de l'« humeur du soir » (une par partie) et petites bulles qui s'envolent */
.bob__acc { position: absolute; pointer-events: none; }
.bob__fx { position: absolute; z-index: 3; top: -8px; right: -12px; font-family: var(--f-display, 'Bebas Neue', Impact, sans-serif); font-size: 1.1rem; line-height: 1; letter-spacing: .05em; color: var(--gold-2, #FFE08A); text-shadow: 0 2px 8px rgba(0, 0, 0, .7); white-space: nowrap; pointer-events: none; animation: bobFx 1.35s cubic-bezier(.16, 1, .3, 1) forwards; }
.bob__fx--l { right: auto; left: -14px; animation-name: bobFxL; }
@keyframes bobFx { from { opacity: 0; transform: translate(0, 8px) scale(.5) rotate(-10deg); } 22% { opacity: 1; transform: translate(4px, -4px) scale(1.12) rotate(5deg); } to { opacity: 0; transform: translate(16px, -34px) scale(.9) rotate(12deg); } }
@keyframes bobFxL { from { opacity: 0; transform: translate(0, 8px) scale(.5) rotate(10deg); } 22% { opacity: 1; transform: translate(-4px, -4px) scale(1.12) rotate(-5deg); } to { opacity: 0; transform: translate(-16px, -34px) scale(.9) rotate(-12deg); } }

/* Rire : il se secoue, yeux plissés, grande bouche */
.bob--laugh { animation: bobLaugh .17s ease-in-out 10; }
@keyframes bobLaugh { 50% { transform: translateY(-3px) rotate(-2.5deg); } }
.bob--laugh .bob__eye { height: 8px; background: none; box-shadow: none; animation: none; border: 3px solid var(--ember-2); border-bottom: 0; border-radius: 12px 12px 0 0; }
.bob--laugh .bob__mouth { width: 26px; height: 11px; bottom: 6px; border-radius: 3px 3px 14px 14px; background: var(--gold); }
/* Clin d'œil */
.bob--wink { animation: bobTilt .55s var(--g-spring); }
@keyframes bobTilt { 45% { transform: rotate(-8deg); } }
.bob--wink .bob__eye:last-of-type { height: 3px; border-radius: 3px; animation: none; }
.bob--wink .bob__mouth { width: 18px; translate: -24% 0; rotate: -10deg; background: var(--gold); }
/* Surprise */
.bob--shock { animation: bobJump .45s var(--g-spring); }
@keyframes bobJump { 40% { transform: translateY(-9px) scale(1.05); } }
.bob--shock .bob__eye { transform: scale(1.32); animation: none; }
.bob--shock .bob__mouth { width: 12px; height: 12px; bottom: 5px; border-radius: 50%; background: transparent; border: 3px solid rgba(254, 253, 249, .75); }
/* Sueurs froides */
.bob--sweat .bob__eye { height: 10px; border-radius: 4px 4px 12px 12px; animation: gScan .9s ease-in-out infinite alternate; }
.bob--sweat .bob__mouth { width: 20px; rotate: -7deg; }
.bob--sweat::after { content: ''; position: absolute; top: 8px; right: -3px; width: 9px; height: 9px; border-radius: 0 50% 50% 50%; rotate: 45deg; background: #8DC2F0; box-shadow: 0 0 8px rgba(91, 164, 230, .7); animation: bobDrop 1.5s ease-in infinite; }
@keyframes bobDrop { from { opacity: 0; transform: translate(0, -2px); } 20% { opacity: 1; } to { opacity: 0; transform: translate(18px, 18px); } }
/* Étoiles dans les yeux (coup de maître) */
.bob--starry .bob__eye { width: 19px; height: 19px; border-radius: 0; background: var(--gold-2); box-shadow: none; clip-path: polygon(50% 0, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%); animation: bobSpin 1.6s linear infinite; }
@keyframes bobSpin { to { transform: rotate(360deg); } }
.bob--starry .bob__mouth { width: 14px; height: 10px; border-radius: 50%; background: transparent; border: 3px solid rgba(254, 253, 249, .65); }
/* Sommeil */
.bob--sleep { animation: bobBreath 2.6s ease-in-out infinite; }
@keyframes bobBreath { 50% { transform: scale(.97) translateY(2px); } }
.bob--sleep .bob__eye { height: 3px; border-radius: 3px; background: rgba(254, 253, 249, .55); box-shadow: none; animation: none; }
.bob--sleep .bob__ant::after { animation-duration: 3.2s; opacity: .45; }
/* Faux énervement */
.bob--angry { animation: bobShake .1s linear 7; }
@keyframes bobShake { 25% { transform: translateX(-2px) rotate(-1.5deg); } 75% { transform: translateX(2px) rotate(1.5deg); } }
.bob--angry .bob__eye { height: 9px; border-radius: 2px 2px 12px 12px; background: #FF3B2F; box-shadow: 0 0 14px 4px rgba(255, 59, 47, .7); animation: none; }
.bob--angry .bob__eye:first-of-type { rotate: 18deg; }
.bob--angry .bob__eye:last-of-type { rotate: -18deg; }
.bob--angry .bob__ant::after { background: #FF3B2F; animation-duration: .2s; }
/* Danse */
.bob--dance { animation: bobDance .5s ease-in-out 6; }
@keyframes bobDance { 25% { transform: rotate(-8deg) translateY(-3px); } 75% { transform: rotate(8deg) translateY(-3px); } }
.bob--dance .bob__eye { height: 8px; border-radius: 15px 15px 2px 2px; animation: none; }
.bob--dance .bob__mouth { width: 24px; height: 8px; border-radius: 0 0 14px 14px; background: var(--gold); }
/* Lunettes noires */
.bob--cool .bob__eye { width: 20px; height: 11px; border-radius: 3px 3px 9px 9px; background: #0B1015; border: 2px solid var(--gold); box-shadow: inset 5px -2px 0 rgba(255, 255, 255, .16); animation: none; }
.bob--cool .bob__mouth { width: 16px; translate: -20% 0; rotate: -6deg; background: var(--gold); }

/* Humeur du soir : accessoires */
.bob--acc-bowtie .bob__acc { left: 50%; bottom: -13px; width: 30px; height: 13px; translate: -50% 0; background: linear-gradient(180deg, #FFE08A, #D99A00); clip-path: polygon(0 0, 42% 34%, 58% 34%, 100% 0, 100% 100%, 58% 66%, 42% 66%, 0 100%); animation: bobTie 3.2s ease-in-out infinite; }
@keyframes bobTie { 50% { transform: rotate(-4deg); } }
.bob--acc-cap .bob__ant { z-index: 2; }
.bob--acc-cap .bob__acc { z-index: 1; left: 9px; top: -9px; width: 56px; height: 15px; border-radius: 30px 30px 3px 3px; background: linear-gradient(180deg, #FF7A86, var(--ember)); box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .18); }
.bob--acc-cap .bob__acc::after { content: ''; position: absolute; left: -15px; bottom: 0; width: 22px; height: 5px; border-radius: 6px 0 0 6px; background: #C21F36; }
.bob--acc-phones .bob__acc { left: -8px; right: -8px; top: -12px; height: 42px; border: 4px solid var(--gold); border-bottom: 0; border-radius: 40px 40px 0 0; animation: bobBeat .55s ease-in-out infinite; }
.bob--acc-phones .bob__acc::before, .bob--acc-phones .bob__acc::after { content: ''; position: absolute; bottom: -14px; width: 12px; height: 22px; border-radius: 6px; background: linear-gradient(180deg, var(--ember-2), var(--ember)); border: 2px solid var(--gold); }
.bob--acc-phones .bob__acc::before { left: -9px; }
.bob--acc-phones .bob__acc::after { right: -9px; }
@keyframes bobBeat { 50% { transform: translateY(-1.5px); } }
.bob--acc-glasses .bob__acc { left: 50%; top: 50%; width: 48px; height: 19px; translate: -50% -50%; background: linear-gradient(rgba(254, 253, 249, .85), rgba(254, 253, 249, .85)) center 8px / 10px 2px no-repeat; }
.bob--acc-glasses .bob__acc::before, .bob--acc-glasses .bob__acc::after { content: ''; position: absolute; top: 0; width: 19px; height: 19px; border-radius: 50%; border: 2px solid rgba(254, 253, 249, .85); box-shadow: inset 0 0 6px rgba(254, 253, 249, .12); }
.bob--acc-glasses .bob__acc::before { left: 0; }
.bob--acc-glasses .bob__acc::after { right: 0; }
.bob--acc-mic .bob__acc { right: -15px; bottom: -8px; width: 7px; height: 22px; border-radius: 3px; background: linear-gradient(90deg, #2A3B9C, #0D1318); border: 1px solid rgba(254, 253, 249, .25); rotate: 22deg; animation: bobMic 2.4s ease-in-out infinite; }
.bob--acc-mic .bob__acc::before { content: ''; position: absolute; left: 50%; top: -11px; width: 14px; height: 14px; translate: -50% 0; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #F1ECE3, #8A8F96 60%, #4A5058); box-shadow: 0 0 0 2px var(--gold); }
@keyframes bobMic { 50% { transform: rotate(-6deg); } }
.bob--acc-crown .bob__ant { opacity: 0; }
.bob--acc-crown .bob__acc { left: 50%; top: -19px; width: 38px; height: 19px; translate: -50% 0; background: linear-gradient(110deg, #FFC93C 20%, #FFF6D2 45%, #FFC93C 70%) 0 0 / 300% 100%; clip-path: polygon(0 100%, 0 26%, 20% 62%, 35% 4%, 50% 58%, 65% 4%, 80% 62%, 100% 26%, 100% 100%); animation: bobGleam 3s linear infinite; }
@keyframes bobGleam { to { background-position: 150% 0; } }
.bob--ko.bob--acc-crown .bob__acc { rotate: -24deg; translate: -85% 6px; transition: rotate .5s, translate .5s; }
.bob--ko.bob--acc-cap .bob__acc { rotate: 14deg; }
@media (max-width: 560px) {
  .bob--acc-glasses .bob__acc { width: 38px; height: 15px; background-position: center 6px; background-size: 8px 2px; }
  .bob--acc-glasses .bob__acc::before, .bob--acc-glasses .bob__acc::after { width: 15px; height: 15px; }
  .bob--acc-cap .bob__acc { left: 6px; width: 48px; }
  .bob--starry .bob__eye { width: 15px; height: 15px; }
  .bob--cool .bob__eye { width: 16px; height: 9px; }
}
@media (prefers-reduced-motion: reduce) {
  .bob, .bob__acc, .bob__fx, .bob::after { animation: none !important; }
}
