/* ---------- SPACE PARTY (téléphone) ---------- */
#space-ov { position: fixed; inset: 0; z-index: 300; display: flex; flex-direction: column; background: radial-gradient(110% 70% at 50% 0%, #2b1660 0%, #0c0824 60%, #03020a 100%); color: #fff; padding: calc(env(safe-area-inset-top) + 12px) 16px calc(env(safe-area-inset-bottom) + 14px); overflow-y: auto; }
#space-ov[hidden] { display: none; }
body.space-open { overflow: hidden; }
/* chat et paramètres restent accessibles pendant la Space Party (au-dessus de l'écran du voyage) */
body.space-open #chat-fab, body.space-open #gear-fab { z-index: 310; }
body.space-open .sheet { z-index: 320; }
.spo-top { display: flex; justify-content: space-between; align-items: center; font: 900 16px 'Orbitron', 'Inter', sans-serif; letter-spacing: 2px; color: #ffd23a; }
.spo-top b { font: 800 15px 'Inter', sans-serif; color: #fff; letter-spacing: 0; }
.spo-main { flex: 1; display: flex; flex-direction: column; justify-content: center; max-width: 520px; width: 100%; margin: 0 auto; }
.spo-info { text-align: center; }
.spo-big { font: 900 84px 'Inter', sans-serif; line-height: 1.1; margin-bottom: 10px; }
.spo-info h2 { margin: 0 0 8px; font-size: 26px; }
.spo-info p { margin: 0; color: #c9c3ee; font-size: 17px; line-height: 1.4; }
.spo-stop { margin: 10px auto 0; display: block; background: none; border: 0; color: rgba(255, 255, 255, 0.5); font: 600 14px 'Inter', sans-serif; text-decoration: underline; padding: 8px; }
/* swipe */
.spo-sw { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.spo-card { position: relative; width: 100%; padding: 20px 18px; border-radius: 26px; background: linear-gradient(160deg, #241a52, #120c2c); border: 4px solid #000; box-shadow: 6px 6px 0 #000; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 4px; transition: transform 0.25s; user-select: none; }
.spo-card img { width: 58vw; max-width: 230px; aspect-ratio: 1; object-fit: contain; pointer-events: none; }
.spo-card b { font: 900 28px 'Inter', sans-serif; }
.spo-card small { color: #ffd23a; font-weight: 800; letter-spacing: 2px; text-transform: uppercase; font-size: 13px; }
.spo-card p { margin: 4px 0 0; color: #c9c3ee; font-size: 15px; }
.spo-stamp { position: absolute; top: 26px; padding: 4px 14px; border: 5px solid currentColor; border-radius: 12px; font: 900 30px 'Inter', sans-serif; opacity: 0; transition: opacity 0.15s; }
.spo-stamp.yes { left: 16px; color: #3cd36e; transform: rotate(-14deg); }
.spo-stamp.no { right: 16px; color: #ff4655; transform: rotate(14deg); }
.spo-card.to-yes .spo-stamp.yes, .spo-card.to-no .spo-stamp.no { opacity: 1; }
.spo-btns { display: flex; gap: 22px; align-items: center; }
.spo-btns button { width: 72px; height: 72px; border-radius: 50%; border: 4px solid #000; box-shadow: 4px 4px 0 #000; font: 900 32px 'Inter', sans-serif; color: #fff; display: grid; place-items: center; padding: 0; }
.spo-no { background: #c92a3a; }
.spo-yes { background: #2f9e44; }
.spo-undo { width: 52px !important; height: 52px !important; font-size: 22px !important; background: #2a2f4a; }
.spo-count { margin: 0; color: #c9c3ee; font-size: 14px; }
.spo-go { width: 100%; min-height: 56px; font-size: 18px; }
/* mini-défis */
.spo-tap { width: 100%; height: 62dvh; border-radius: 30px; border: 5px solid #000; box-shadow: 6px 6px 0 #000; background: radial-gradient(circle, #ff5fd2, #a3157a); color: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; touch-action: manipulation; user-select: none; }
.spo-tap b { font: 900 54px 'Inter', sans-serif; }
.spo-n { font: 900 80px 'Inter', sans-serif; }
.spo-tap.hit { animation: spo-hit 0.12s; }
@keyframes spo-hit { 50% { transform: scale(0.97); } }
.spo-rx { width: 100%; height: 62dvh; border-radius: 30px; border: 5px solid #000; box-shadow: 6px 6px 0 #000; color: #fff; font: 900 38px 'Inter', sans-serif; touch-action: manipulation; }
.spo-rx.wait { background: #a51d2d; }
.spo-rx.go { background: #2f9e44; }
.spo-rx.early { background: #5c1a22; }
.spo-rx.ok { background: #1d5a33; }
.spo-guess, .spo-vote { text-align: center; display: flex; flex-direction: column; gap: 12px; }
.spo-guess h2, .spo-vote h2 { margin: 0; font-size: 26px; }
.spo-guess p { margin: 0; color: #c9c3ee; }
.spo-guess form { display: flex; gap: 10px; }
.spo-guess .input { flex: 1; min-width: 0; font-size: 30px; text-align: center; }
.spo-v { width: 100%; padding: 16px; border-radius: 16px; border: 3px solid #000; box-shadow: 4px 4px 0 #000, inset 6px 0 0 var(--c); background: #1b1740; color: #fff; font: 800 20px 'Inter', sans-serif; }
.spo-v.on { background: #8a1e2b; }
/* bouton admin à côté de la roue et du minuteur */
.pk-tools .pk-space { flex-basis: 100%; }
.spo-ico { width: 180px; height: 160px; object-fit: contain; }

/* admin : petits boutons Pause / Arrêter en bas */
.spo-admin { display: flex; gap: 10px; justify-content: center; margin-top: 10px; }
.spo-admin button { padding: 8px 16px; border-radius: 12px; border: 2px solid rgba(255, 255, 255, 0.2); background: rgba(255, 255, 255, 0.06); color: rgba(255, 255, 255, 0.75); font: 700 14px 'Inter', sans-serif; text-decoration: none; margin: 0; }
.spo-admin .spo-pause.on { background: #ffd23a; color: #000; border-color: #000; }

/* happenings : écrans génériques (choix, joueurs, nombre, mot, chrono) */
.spo-q { margin: 0 0 14px; font-size: 22px; text-align: center; line-height: 1.3; }
.spo-opts, .spo-vote, .spo-form { display: flex; flex-direction: column; gap: 10px; }
.spo-o { padding: 18px; border-radius: 18px; border: 3px solid #000; box-shadow: 4px 4px 0 #000; background: #2a2160; color: #fff; font: 800 22px 'Inter', sans-serif; }
.spo-o.on, .spo-v.on { background: #ffd23a; color: #000; }
.spo-form form { display: flex; gap: 8px; align-items: center; }
.spo-form .input { flex: 1; min-width: 0; font-size: 26px; text-align: center; }
.spo-unit { font-weight: 800; color: #c9c3ee; }
.spo-sent { text-align: center; color: #3cd36e; font-weight: 700; min-height: 1.4em; margin: 6px 0 0; }
.spo-chrono { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.spo-cd { font: 900 70px 'Inter', sans-serif; color: #ffd23a; height: 84px; }
.spo-cd.pop { animation: spo-pop 0.5s cubic-bezier(.2, 1.6, .4, 1); }
@keyframes spo-pop { from { transform: scale(0.3); opacity: 0; } }
.spo-time { font: 900 76px 'Inter', sans-serif; font-variant-numeric: tabular-nums; }
.spo-stopb { width: 100%; height: 34dvh; border-radius: 30px; border: 5px solid #000; box-shadow: 6px 6px 0 #000; background: #e03131; color: #fff; font: 900 54px 'Inter', sans-serif; }
.spo-stopb:disabled { background: #4a3a3a; opacity: 0.6; }

/* barre du temps restant pendant un défi */
.spo-timer { width: 100%; height: 14px; margin: 4px 0 14px; border-radius: 99px; background: #151b2c; border: 3px solid #000; overflow: hidden; }
.spo-timer i { display: block; height: 100%; background: #ffd23a; transform-origin: left center; animation: spo-timer linear both; }
@keyframes spo-timer { from { transform: scaleX(var(--k, 1)); } to { transform: scaleX(0); } }
/* choix d'un joueur : place, nom, points */
.spo-v { display: flex; align-items: center; gap: 12px; text-align: left; }
.spo-v em { font-style: normal; min-width: 42px; font: 900 18px 'Orbitron', 'Inter', sans-serif; color: #ffd23a; }
.spo-v b { flex: 1; font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.spo-v span { font: 800 17px 'Inter', sans-serif; color: #cfd2e6; }
.spo-v.on em, .spo-v.on span { color: #000; }
/* champ de réponse : le champ prend la place, le bouton reste petit */
.spo-form form .btn { flex: none; width: auto; padding-left: 20px; padding-right: 20px; }
.spo-form .input { flex: 1 1 auto; }

/* happening : mes points qui montent ou descendent jusqu'au nouveau total */
@property --ptsn { syntax: '<integer>'; inherits: false; initial-value: 0; }
.ptsroll { --ptsn: var(--a); counter-reset: n var(--ptsn); animation: ptsroll 1.6s cubic-bezier(.3, .7, .3, 1) 0.6s forwards; font-variant-numeric: tabular-nums; }
.ptsroll::after { content: counter(n) ' pts'; }
.ptsroll.up { color: #3cd36e; } .ptsroll.down { color: #ff5a6a; }
@keyframes ptsroll { from { --ptsn: var(--a); } to { --ptsn: var(--b); } }
/* admin pendant la Space Party (hors jeu) : la barre du haut reste au-dessus de l'écran du voyage */
body.space-adm .admnav { position: fixed; top: 0; left: 0; right: 0; margin: 0; z-index: 330; }
body.space-adm #v-main { padding-top: 64px; }
body.space-adm.space-open #space-ov { padding-top: 12px; }
/* l'espace en fond de l'écran Space Party (logo + orbite au lancement, vaisseaux qui passent sur la carte) */
.specspace.sp-bg { z-index: 299; }
body.sp-bg-on #space-ov, body.sp-clear #space-ov { background: transparent; }
body.sp-bg-on .spo-info, body.sp-bg-on .spo-adv, body.sp-bg-on .spo-loop { position: relative; }
body.sp-bg-on .spo-info { padding: 18px 16px; border-radius: 20px; background: rgba(8, 6, 26, 0.72); }
.spo-info h2 small { font: 700 17px 'Inter', sans-serif; color: #c9c3ee; }
.spo-wait { margin: auto 0 8px; text-align: center; font: 700 16px 'Inter', sans-serif; color: #c9c3ee; text-shadow: 0 2px 6px #000; }
body.sp-bg-on .spo-main:has(.spo-wait) { justify-content: flex-end; }
/* podium final (admin) : juste les deux boutons, en bas, par-dessus l'espace et les feux d'artifice */
.spo-endbtns { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }
body.sp-clear .spo-main { justify-content: flex-end; }
.spo-gain { font-size: 20px !important; }
/* Tapis ! sur le téléphone : le dé roule 1,5 s, puis le verdict */
.spo-allin { position: relative; display: grid; place-items: center; }
.spo-allin > * { grid-area: 1 / 1; }
.ai-dice { font-size: 120px; animation: ai-roll 0.25s linear 6, ai-gone 0.2s ease 1.5s forwards; }
.ai-res { opacity: 0; animation: ai-show 0.5s cubic-bezier(.2, 1.6, .4, 1) 1.6s forwards; text-align: center; }
.ai-res > b { display: block; font: 900 40px 'Orbitron', 'Inter', sans-serif; text-shadow: 3px 3px 0 #000; }
.spo-allin.up .ai-res > b { color: #3cd36e; } .spo-allin.down .ai-res > b { color: #ff5a6a; }
.spo-allin.down .ai-res { animation: ai-show 0.5s cubic-bezier(.2, 1.6, .4, 1) 1.6s forwards, ai-shk 0.35s ease 2.1s 2; }
@keyframes ai-roll { to { transform: rotate(360deg); } }
@keyframes ai-gone { to { opacity: 0; transform: scale(0.3); } }
@keyframes ai-show { from { opacity: 0; transform: scale(0.4); } to { opacity: 1; transform: scale(1); } }
@keyframes ai-shk { 25% { translate: -8px 0; } 75% { translate: 8px 0; } }
