/* Coursevélo — ESSAI « route défilante » */
.essai { padding: 1.5rem 0 3.5rem; }
.essai-tete { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: .75rem; margin-bottom: 1rem; }
.essai-tete h1 { font-size: clamp(1.5rem, 3vw, 2.2rem); margin: 0; }
.camera { display: flex; align-items: center; gap: .35rem; flex-wrap: wrap; }
.camera-lbl { font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--ink-2); }
.cam-btn {
  border: 2px solid var(--ink); background: var(--paper); color: var(--ink); border-radius: 4px;
  font-weight: 600; font-size: .85rem; padding: .25rem .7rem; box-shadow: 2px 2px 0 var(--ink);
}
.cam-btn.active { background: var(--ink); color: var(--paper); }

/* La scène : toute la largeur */
.scene-wrap { position: relative; border-top: 3px solid var(--ink); border-bottom: 3px solid var(--ink); background: #8fcbd8; }
#scene { display: block; width: 100%; height: 400px; cursor: grab; touch-action: pan-y; }
#scene:active { cursor: grabbing; }
.scene-info {
  position: absolute; left: 12px; top: 10px; max-width: min(60%, 520px);
  background: rgba(34, 26, 18, .72); color: #fff8e1; font-size: .82rem; padding: .25rem .6rem; border-radius: 4px;
}
.scene-info:empty { display: none; }
.scene-phase { position: absolute; right: 12px; top: 10px; }
.badge-phase {
  display: inline-block; background: var(--paper); color: var(--ink); border: 2px solid var(--ink);
  font-family: 'Alfa Slab One', serif; font-size: .9rem; padding: .15rem .6rem; border-radius: 4px; box-shadow: 2px 2px 0 var(--ink);
}
.badge-phase.accel { background: #7b3fa0; color: #fff; animation: clignote 1.4s ease-in-out infinite; }
.badge-phase.fin { background: var(--red); color: #fff; }
@keyframes clignote { 50% { filter: brightness(1.3); } }
.scene-centre {
  position: absolute; left: 50%; top: 32%; transform: translate(-50%, -50%);
  background: rgba(34, 26, 18, .8); color: #ffe082; font-family: 'Alfa Slab One', serif; font-size: 1.6rem;
  padding: .6rem 1.4rem; border-radius: 8px; text-align: center; pointer-events: none;
}
.scene-centre small { display: block; font-family: 'DM Sans', sans-serif; font-size: .9rem; color: #fff8e1; }
.toast-course {
  position: absolute; left: 50%; bottom: 18%; transform: translateX(-50%);
  background: var(--paper); border: 3px solid var(--ink); border-radius: 8px; box-shadow: 4px 4px 0 var(--ink);
  font-family: 'Alfa Slab One', serif; font-size: 1.15rem; padding: .4rem 1rem; animation: monte 3.5s ease forwards; pointer-events: none;
}
.toast-course.rouge { color: var(--red-dark); } .toast-course.bleu { color: #3a4470; } .toast-course.vert { color: #2e7d32; }
@keyframes monte { 0% { opacity: 0; transform: translate(-50%, 12px); } 10%, 80% { opacity: 1; transform: translate(-50%, 0); } 100% { opacity: 0; transform: translate(-50%, -10px); } }
.profil-wrap { background: var(--ink); border-bottom: 3px solid var(--red); }
#profil { display: block; width: 100%; height: 74px; cursor: pointer; }

/* Tableau de bord */
.tableau { display: grid; gap: 1rem; grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1199.98px) { .tableau { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 575.98px) { .tableau { grid-template-columns: 1fr; } }
.carte {
  background: var(--paper); border: 2px solid var(--ink); border-radius: 8px; box-shadow: 4px 4px 0 var(--ink);
  padding: .9rem 1rem; min-height: 190px;
}
.carte-titre { font-family: 'Alfa Slab One', serif; font-size: 1.02rem; margin-bottom: .5rem; }
.carte-titre .equipe { font-family: 'DM Sans', sans-serif; font-size: .8rem; font-weight: 700; }
.petit { font-size: .82rem; color: var(--ink-2); margin: .3rem 0 0; }
.ok { color: #2e7d32; font-weight: 700; margin: .4rem 0; }
.grand { font-family: 'Alfa Slab One', serif; font-size: 2.4rem; line-height: 1; color: var(--red); display: block; }
.grand sup { font-size: .45em; }
.petit-grand { font-size: 1.2rem; padding-top: .9rem; }
.duo { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; text-align: center; }
.duo > div { background: var(--cream); border-radius: 6px; padding: .5rem .3rem; }
.duo > div:last-child .grand { color: var(--teal); }
.lbl { font-size: .7rem; text-transform: uppercase; letter-spacing: .15em; color: var(--ink-2); font-weight: 700; }
.chips { display: flex; flex-wrap: wrap; gap: .3rem; margin-top: .55rem; }
.chip { font-size: .75rem; font-weight: 700; padding: .1rem .45rem; border-radius: 10px; }
.chip.bon { background: #e8f5e9; color: #2e7d32; } .chip.mal { background: #ffebee; color: #b71c1c; }
.pilules { display: flex; flex-wrap: wrap; gap: .25rem; margin-top: .25rem; }
.pilules span { color: #fff; font-size: .72rem; font-weight: 700; padding: .1rem .5rem; border-radius: 10px; }

.btn-des {
  width: 100%; margin-top: .4rem; background: linear-gradient(to bottom, #ffca28, #f57f17); color: #4e2600;
  border: 2px solid var(--ink); border-bottom-width: 5px; border-radius: 10px; padding: .7rem; font-weight: 800;
  font-size: 1.05rem; text-transform: uppercase; letter-spacing: .05em; box-shadow: 3px 3px 0 var(--ink);
}
.btn-des:hover { filter: brightness(1.07); }
.btn-des:active { transform: translateY(2px); border-bottom-width: 3px; }
.des { display: flex; gap: .5rem; justify-content: center; margin: .2rem 0 .4rem; }
.de { width: 44px; height: 44px; }
.de rect { fill: #fff; stroke: var(--ink); stroke-width: 3; }
.de circle { fill: var(--ink); }
.carte-des.lancer .de { animation: rouler .55s ease; }
@keyframes rouler { 30% { transform: rotate(-35deg) translateY(-8px); } 70% { transform: rotate(20deg); } }
.tirage { font-family: 'Alfa Slab One', serif; font-size: 1.35rem; text-align: center; }
.tirage small { font-family: 'DM Sans', sans-serif; font-size: .75rem; color: var(--ink-2); }
.tirage.mal { color: var(--red-dark); } .tirage.bon { color: var(--teal-dark); }
.tour { height: 8px; background: var(--cream-2); border-radius: 4px; overflow: hidden; margin-top: .4rem; }
.tour-barre { height: 100%; width: 0; background: repeating-linear-gradient(45deg, var(--mustard) 0 8px, #e8b85a 8px 16px); transition: width .25s linear; }
.baremes { list-style: none; padding: 0; margin: .4rem 0 0; columns: 2; font-size: .74rem; }
.baremes li.mal { color: var(--red-dark); } .baremes li.bon { color: var(--teal-dark); }

.gourdes { display: flex; flex-wrap: wrap; gap: .2rem; margin: .3rem 0 .6rem; min-height: 40px; align-items: center; }
.gourde { border: 0; background: none; padding: 0; }
.gourde img { width: 36px; height: 36px; }
.gourde.actif img { animation: tremble 1s ease-in-out infinite; cursor: pointer; }
@keyframes tremble { 25% { transform: rotate(-10deg); } 75% { transform: rotate(10deg); } }
.fruits { display: grid; grid-template-columns: repeat(3, 1fr); gap: .35rem; }
.fruit {
  display: flex; flex-direction: column; align-items: center; gap: .1rem; background: var(--cream); border: 2px solid var(--ink);
  border-radius: 6px; padding: .35rem .2rem; font-size: .72rem; font-weight: 700;
}
.fruit img { width: 20px; }
.fruit b { font-family: 'Alfa Slab One', serif; font-size: .9rem; }
.fruit:not(:disabled):hover { background: #fff; transform: translateY(-1px); }
.fruit:disabled { opacity: .45; }

.classement { list-style: none; padding: 0; margin: 0; font-size: .82rem; }
.classement li { display: grid; grid-template-columns: 22px 1fr auto; gap: .3rem; padding: .15rem 0; border-bottom: 1px dashed rgba(34,26,18,.15); }
.classement .rg { font-weight: 800; color: var(--ink-2); }
.classement .nm { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.classement .ec { font-size: .72rem; color: var(--ink-2); white-space: nowrap; }
.classement li.moi { background: #fff3c4; }

/* Chat flottant (déplaçable, redimensionnable, repliable) — en flux normal sur mobile */
.chat-entete { display: flex; align-items: center; justify-content: space-between; gap: .5rem; user-select: none; }
.chat-outils { display: flex; gap: .25rem; }
.chat-outils button {
  border: 2px solid rgba(255,255,255,.7); background: rgba(0,0,0,.15); color: #fff; border-radius: 4px;
  width: 26px; height: 24px; line-height: 1; font-weight: 800; padding: 0;
}
.chat-outils button:hover { background: rgba(0,0,0,.35); }
.chat-nouveaux { background: var(--mustard); color: var(--ink); font-family: 'DM Sans', sans-serif; font-size: .7rem; font-weight: 800; border-radius: 10px; padding: 0 .45rem; }
.essai .chat-flottant { height: 380px; margin: 1.5rem .75rem 0; }
@media (min-width: 768px) {
  .essai .chat-flottant {
    position: fixed; z-index: 1040; right: 16px; bottom: 16px; width: 340px; height: 420px; margin: 0;
    min-width: 240px; min-height: 160px; max-width: 90vw; max-height: 90vh; resize: both;
  }
  .chat-flottant .chat-entete { cursor: move; }
  .chat-flottant.deplace { opacity: .85; }
}
.essai .chat-flottant.replie { height: auto !important; min-height: 0; resize: none; }
.chat-flottant.replie .chat-messages, .chat-flottant.replie .chat-form, .chat-flottant.replie .chat-pied { display: none; }

/* Les 11 combinaisons de dés pendant la course */
.combis { list-style: none; padding: 0; margin: 0; font-size: .8rem; display: grid; grid-template-columns: 1fr 1fr; gap: .15rem .4rem; }
.combis li { display: flex; align-items: center; gap: .35rem; padding: .1rem .3rem; border-radius: 4px; border: 2px solid transparent; }
.combis li b { font-family: 'Alfa Slab One', serif; min-width: 1.3rem; text-align: right; }
.combis li.mal { color: var(--red-dark); } .combis li.bon { color: var(--teal-dark); }
.combis li.fait { background: #fff3c4; border-color: var(--ink); color: var(--ink); font-weight: 800; }
.combis li.fait.nouveau { animation: surligne .6s ease 3; }
.combis li.fait.mal { background: #ffe0dc; } .combis li.fait.bon { background: #d9f2ee; }
@keyframes surligne { 50% { transform: scale(1.06); } }
/* Gains à l'arrivée dans le classement */
.classement.avec-gains li { grid-template-columns: 22px 1fr auto auto; }
.classement .gn { display: flex; align-items: center; gap: 1px; white-space: nowrap; font-size: .72rem; font-weight: 800; }
.classement .gn .pts { color: var(--teal-dark); margin-right: .2rem; } .classement .gn .pts.moins { color: var(--red-dark); }
.classement .gn img { width: 12px; height: 12px; }
.classement li.arr .ec { color: var(--ink); }
.essai-note { font-size: .82rem; color: var(--ink-2); }

/* Nom et type de l'étape */
.etape-nom { font-weight: 700; color: var(--ink-2); margin-top: .2rem; }
/* Mon Tour (carnet de route) dans la carte du joueur */
.mon-tour { margin-top: .6rem; padding-top: .5rem; border-top: 1px dashed rgba(34,26,18,.25); font-size: .8rem; }
.mon-tour a { font-weight: 700; color: var(--ink); text-decoration: none; display: block; }
.mon-tour a:hover { color: var(--red); }
.mon-tour span { color: var(--ink-2); }
.changer-equipe { font-family: 'DM Sans', sans-serif; font-size: .72rem; font-weight: 600; color: var(--ink-2); margin-left: .3rem; }
.lien-boutique { display: block; margin-top: .55rem; font-size: .78rem; font-weight: 700; color: var(--ink-2); text-decoration: none; text-align: right; }
.lien-boutique:hover { color: var(--red); }
