* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { width: 100%; height: 100%; overflow: hidden; background: #8fd3ff; }
body { font-family: 'Inter', sans-serif; font-weight: 800; color: #fff; user-select: none; touch-action: none; }
.cache { display: none !important; }
svg { display: block; }
#c3d { position: fixed; inset: 0; width: 100vw; height: 100vh; }

/* Colonne verticale du milieu (format téléphone) : tout l'affichage */
#scene { position: fixed; top: 0; bottom: 0; left: 0; right: 0; margin: 0 auto; width: min(100vw, calc(100vh * 9 / 16)); container-type: size; pointer-events: none; }
.ombre-txt { -webkit-text-stroke: .3cqh #1b2a4a; paint-order: stroke fill; }

/* ── Haut : wins, pièces, trajet jusqu'à l'arrivée, mètres ── */
#haut { position: absolute; top: 1.2cqh; left: 3%; right: 3%; display: flex; flex-direction: column; align-items: center; gap: .8cqh; }
.ligne-haut { width: 100%; display: flex; justify-content: space-between; align-items: center; }
.pastille { font-family: 'Luckiest Guy', sans-serif; font-size: 2.6cqh; line-height: 1; padding: .7cqh 1.4cqh .4cqh; border-radius: 1.4cqh; color: #fff; background: linear-gradient(180deg, #3d8bff, #1f5fd6); border: .3cqh solid #fff; box-shadow: 0 .5cqh 0 rgba(0,0,0,.3); display: flex; align-items: center; gap: .8cqh; -webkit-text-stroke: .25cqh #0d2a66; paint-order: stroke fill; }
.pastille small { font-size: .6em; }
.pastille.or { color: #fff8d6; background: linear-gradient(180deg, #ffd96b, #f0a623); -webkit-text-stroke-color: #6b3a00; }
.pastille.violet { background: linear-gradient(180deg, #d58cff, #7b2cbf); -webkit-text-stroke-color: #3a0f66; animation: battre 1s ease-in-out infinite; }
.pastille.pop { animation: pop .45s ease-out; }
@keyframes pop { 40% { transform: scale(1.2); } }
@keyframes battre { 50% { transform: scale(1.07); } }
.piece { width: 2.4cqh; height: 2.4cqh; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #fff3b0, #ffc83a 45%, #c98a00); border: .25cqh solid #8a5a00; flex: none; }
#trajet { width: 100%; display: flex; align-items: center; gap: 1cqh; }
.t-rail { position: relative; flex: 1; height: 1.8cqh; border-radius: 1cqh; background: rgba(15, 30, 60, .55); border: .3cqh solid #fff; box-shadow: 0 .4cqh 0 rgba(0,0,0,.25); }
.t-plein { position: absolute; left: 0; top: 0; bottom: 0; width: 0; border-radius: 1cqh; background: linear-gradient(90deg, #7dff6b, #ffd23f, #ff7b1c); }
.t-coureur { position: absolute; top: 50%; left: 0; transform: translate(-50%, -55%) scaleX(-1); font-size: 3cqh; filter: drop-shadow(0 .3cqh .3cqh rgba(0,0,0,.4)); transition: left .2s linear; }
.t-drapeau { font-size: 3.4cqh; filter: drop-shadow(0 .3cqh .3cqh rgba(0,0,0,.4)); }
#metres { font-family: 'Luckiest Guy', sans-serif; color: #fff; -webkit-text-stroke: .3cqh #1b2a4a; paint-order: stroke fill; text-shadow: 0 .4cqh 0 rgba(0,0,0,.25); }
#metres b { font-weight: normal; font-size: 4.4cqh; }
#metres small { font-size: 2.2cqh; margin-left: .6cqh; }
#multi { font-size: 2.2cqh; }

/* Effets en cours (jetpack, aimant…) */
#effets { position: absolute; left: 3%; top: 26%; display: flex; flex-direction: column; gap: .8cqh; }
.effet { display: flex; align-items: center; gap: .6cqh; padding: .4cqh 1cqh .4cqh .5cqh; border-radius: 99px; background: rgba(10, 20, 45, .65); border: .25cqh solid rgba(255,255,255,.8); font-family: 'Luckiest Guy', sans-serif; font-size: 2cqh; }
.effet span { font-size: 2.6cqh; line-height: 1; }
.effet.inverse { border-color: #ff6b6b; }

/* Compte à rebours 3, 2, 1, GO ! */
#depart { position: absolute; left: 0; right: 0; top: 34%; text-align: center; font-family: 'Luckiest Guy', sans-serif; font-size: 14cqh; color: #fff; -webkit-text-stroke: .6cqh #1b2a4a; paint-order: stroke fill; text-shadow: 0 1cqh 0 rgba(0,0,0,.25); }
#depart.pop { animation: depart .8s ease-out both; }
#depart.go { color: #7dff6b; }
@keyframes depart { 0% { transform: scale(2); opacity: 0; } 25% { transform: scale(1); opacity: 1; } 100% { transform: scale(.9); opacity: .9; } }

/* Annonces */
#annonce { position: absolute; left: 0; right: 0; top: 40%; text-align: center; font-family: 'Luckiest Guy', sans-serif; font-size: 5.6cqh; line-height: 1.1; color: #fff; -webkit-text-stroke: .45cqh #1b2a4a; paint-order: stroke fill; text-shadow: 0 .6cqh 0 rgba(0,0,0,.25); animation: annonce 2s ease-out both; }
#annonce small { display: block; font-size: .55em; color: #fff3c4; }
#annonce.vert { color: #7dff6b; } #annonce.rouge { color: #ff6b6b; } #annonce.or { color: #ffd23f; } #annonce.bleu { color: #5fd3ff; }
@keyframes annonce { 0% { transform: scale(.3); opacity: 0; } 12% { transform: scale(1.12); opacity: 1; } 20% { transform: scale(1); } 85% { opacity: 1; } 100% { opacity: 0; transform: translateY(-2cqh); } }
#chargement { position: absolute; left: 0; right: 0; top: 46%; text-align: center; font-family: 'Luckiest Guy', sans-serif; font-size: 3.4cqh; color: #fff; -webkit-text-stroke: .3cqh #1b2a4a; paint-order: stroke fill; animation: clignote 1s steps(1) infinite; }
@keyframes clignote { 50% { opacity: .4; } }

/* Boutons ronds (accueil, paramètres) : en haut à gauche de la fenêtre */
.btn-rond { position: fixed; z-index: 40; top: 16px; width: 48px; height: 48px; display: grid; place-items: center; border-radius: 50%; color: #fff; background: rgba(14, 13, 12, .55); border: 1px solid rgba(255,255,255,.22); box-shadow: 0 6px 18px rgba(0,0,0,.3); cursor: pointer; transition: transform .2s, background .2s; }
.btn-rond svg { width: 22px; height: 22px; }
.btn-rond:hover { transform: scale(1.07); background: rgba(14, 13, 12, .75); }
#btn-accueil { left: 16px; }
#btn-params { left: 74px; }
@media (max-width: 700px) { #btn-accueil, #btn-params { top: auto; bottom: 14px; } }

/* Paramètres */
#params { position: absolute; top: 76px; left: 16px; width: min(470px, calc(100vw - 32px)); max-height: calc(100vh - 100px); display: flex; flex-direction: column; z-index: 30; background: rgba(20, 19, 18, .94); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); border: 1px solid rgba(255,255,255,.12); border-radius: 20px; font-family: 'Inter', sans-serif; font-weight: 700; font-size: 14px; color: #ece8e1; box-shadow: 0 24px 60px rgba(0,0,0,.55); overflow: hidden; }
#params.cache { display: none !important; }
#params button { font-family: 'Inter', sans-serif; cursor: pointer; }
#params svg { width: 18px; height: 18px; }
#params .p-tete { display: flex; justify-content: space-between; align-items: center; padding: 16px 18px 10px; font-size: 19px; font-weight: 800; }
#params .p-tete button { display: grid; place-items: center; background: rgba(255,255,255,.07); border: 0; color: #ece8e1; width: 32px; height: 32px; border-radius: 50%; }
#params .p-tete button:hover { background: rgba(255,255,255,.14); }
#params .p-onglets { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; padding: 0 14px 12px; border-bottom: 1px solid rgba(255,255,255,.08); }
#params .p-onglets button { display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 9px 4px 8px; background: transparent; border: 0; border-radius: 12px; color: #9c968c; font-size: 12px; font-weight: 700; transition: background .15s, color .15s; }
#params .p-onglets button svg { width: 20px; height: 20px; }
#params .p-onglets button:hover { color: #ece8e1; background: rgba(255,255,255,.05); }
#params .p-onglets button.actif { background: rgba(233, 180, 76, .16); color: #f2c45f; }
#params .p-corps { flex: 1; overflow-y: auto; padding: 4px 18px 16px; }
#params section.cache { display: none !important; }
#params h4 { display: flex; justify-content: space-between; align-items: center; margin: 16px 0 8px; font-size: 11px; font-weight: 800; color: #8d877d; text-transform: uppercase; letter-spacing: .12em; }
#params .p-ligne { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 46px; padding: 6px 12px; background: rgba(255,255,255,.045); border: 1px solid rgba(255,255,255,.05); border-radius: 12px; margin-bottom: 6px; }
#params .p-ligne small { color: #8d877d; font-weight: 600; font-size: 11px; }
#params .p-liste .p-ligne { justify-content: flex-start; }
#params .p-droite { display: flex; gap: 8px; align-items: center; }
#params input[type=range] { width: 180px; accent-color: #e9b44c; }
#params select, #params input[type=number] { background: rgba(0,0,0,.35); color: #fff; border: 1px solid rgba(255,255,255,.12); border-radius: 9px; padding: 7px 9px; font: 700 14px 'Inter', sans-serif; width: 120px; }
#params input.p-court { width: 70px; }
#params .p-grille { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
#params .p-case { display: flex; justify-content: space-between; align-items: center; gap: 6px; background: rgba(255,255,255,.045); border: 1px solid rgba(255,255,255,.05); border-radius: 12px; padding: 6px 6px 6px 11px; font-size: 13px; }
#params .btn-touche { min-width: 58px; padding: 7px 9px; background: rgba(255,255,255,.08); color: #fff; border: 1px solid rgba(255,255,255,.14); border-radius: 9px; font-weight: 800; font-size: 13px; }
#params .btn-touche.ecoute { border-color: #f2c45f; color: #f2c45f; }
#params .p-unite { color: #8d877d; font-weight: 700; }
#params .p-suppr { display: grid; place-items: center; margin-left: auto; background: none; border: 0; color: #7d776e; padding: 6px; border-radius: 8px; }
#params .p-suppr svg { width: 16px; height: 16px; }
#params .p-suppr:hover { color: #ff8a80; background: rgba(255,138,128,.1); }
#params .p-plus, #params .p-rond { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; border: 0; background: #e9b44c; color: #1d1608; padding: 0; }
#params .p-plus svg { width: 15px; height: 15px; }
#params .p-rond { background: rgba(255,255,255,.1); color: #fff; }
#params .p-rond svg { width: 13px; height: 13px; }
#params .p-liste:empty::before { content: attr(data-vide); display: block; padding: 11px; border: 1px dashed rgba(255,255,255,.14); border-radius: 12px; color: #7d776e; font-size: 13px; text-align: center; }
#params .p-bas { display: flex; justify-content: space-between; align-items: center; padding: 11px 18px; border-top: 1px solid rgba(255,255,255,.08); }
#params .p-lien { background: none; border: 0; color: #7d776e; font-size: 12px; text-decoration: underline; }
#params #o-ok { color: #8ff0a8; font-size: 12px; }

#params input[type=checkbox] { width: 22px; height: 22px; accent-color: #e9b44c; cursor: pointer; }

#params select.p-large { width: 230px; max-width: 60%; }
/* Barre de défilement des paramètres, aux couleurs du panneau */
#params .p-corps { scrollbar-width: thin; scrollbar-color: rgba(233, 180, 76, .45) transparent; }
#params .p-corps::-webkit-scrollbar { width: 8px; }
#params .p-corps::-webkit-scrollbar-track { background: transparent; margin: 6px 0; }
#params .p-corps::-webkit-scrollbar-thumb { background: rgba(233, 180, 76, .35); border-radius: 8px; border: 2px solid rgba(20, 19, 18, .94); }
#params .p-corps::-webkit-scrollbar-thumb:hover { background: rgba(233, 180, 76, .65); }
#params #o-vol-clic { width: 120px; } #params #o-vol-clic-n { white-space: nowrap; min-width: 42px; text-align: right; }

#params .p-aide { margin: -2px 0 8px; font-size: 12px; color: #8d877d; font-weight: 600; line-height: 1.4; }
#params .p-btn { background: rgba(255,138,128,.12); color: #ff8a80; border: 1px solid rgba(255,138,128,.35); border-radius: 9px; padding: 7px 10px; font-weight: 800; font-size: 12px; }
#params .p-btn:hover { background: rgba(255,138,128,.22); }
#params { position: fixed; z-index: 45; }
#params .p-onglets { grid-template-columns: repeat(3, 1fr); }
#params input[type=text] { background: rgba(0,0,0,.35); color: #fff; border: 1px solid rgba(255,255,255,.12); border-radius: 9px; padding: 7px 9px; font: 700 14px 'Inter', sans-serif; width: 170px; }
#params .p-action { flex-wrap: wrap; gap: 6px; }
#params .p-action select { width: auto; max-width: 110px; padding: 6px; font-size: 13px; }
#params .p-action input.p-court { width: 78px; }
#params .p-action input.p-label { width: 90px; }

/* Choix des persos (façon Minerio) */
#params .p-onglets { grid-template-columns: repeat(4, 1fr); }
#params .p-camps { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin: 12px 0 6px; }
#params .p-camps button { padding: 10px 6px; border-radius: 12px; border: 2px solid transparent; background: rgba(255,255,255,.06); color: #ece8e1; font-weight: 800; font-size: 13px; text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#params .p-camps button[data-camp=g].actif { border-color: #ff4d5e; background: rgba(214,40,57,.2); }
#params .p-camps button[data-camp=d].actif { border-color: #4d95ff; background: rgba(31,111,214,.2); }
#params .p-persos { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
#params .p-groupe { grid-column: 1 / -1; color: #8d877d; font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .12em; margin: 10px 2px 0; }
#params .p-skin { position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 6px 4px 8px; background: rgba(255,255,255,.045); border: 2px solid transparent; border-radius: 14px; color: #c9c4ba; font-size: 11px; font-weight: 800; line-height: 1.15; text-align: center; }
#params .p-skin:hover { border-color: rgba(255,255,255,.18); }
#params .p-skin.actif { border-color: #e9b44c; background: rgba(233,180,76,.13); color: #fff; }
#params .p-img { width: 100%; aspect-ratio: 104 / 160; border-radius: 10px; background: radial-gradient(circle at 50% 35%, #2c2c3a, #0f0f15); display: grid; place-items: center; overflow: hidden; }
#params .p-img canvas { width: 100%; height: 100%; display: block; }
#params .p-img.charge::after { content: ''; width: 18px; height: 18px; border-radius: 50%; border: 2px solid rgba(255,255,255,.18); border-top-color: #f2c45f; animation: tourne .8s linear infinite; }
@keyframes tourne { to { transform: rotate(360deg); } }
#params .p-badge { position: absolute; top: 4px; width: 14px; height: 14px; border-radius: 50%; border: 2px solid #fff; }
#params .p-badge.g { left: 4px; background: #d62839; }
#params .p-badge.d { right: 4px; background: #1f6fd6; }


/* ── Compteur de win plus visible (halo doré + ombre, comme KO Arena) ── */
#wins.pastille.or {
  font-size: 3.1cqh;
  padding: .7cqh 1.6cqh .45cqh;
  border-width: .35cqh;
  background: linear-gradient(180deg, #ffe684, #f0a623 55%, #d4860f);
  box-shadow: 0 .5cqh 0 rgba(0,0,0,.5), 0 0 2.2cqh rgba(255,205,80,.95);
  text-shadow: 0 .12cqh 0 rgba(255,255,255,.45);
}
