/* ===== La rampe de billes : palette du site =====
   Turquoise : 85ECE4 · 55E0D6 · 30D5C9 · 0CC9BB · 00A094
   Bleu      : 91B0EE · 6590E4 · 4275DB · 205BD0 · 0C42AC
   Vert      : 95F68B · 6AF05C · 46EB35 · 22E50E · 14D200
*/
:root {
    --tq1: #85ECE4; --tq2: #55E0D6; --tq3: #30D5C9; --tq4: #0CC9BB; --tq5: #00A094;
    --bl1: #91B0EE; --bl2: #6590E4; --bl3: #4275DB; --bl4: #205BD0; --bl5: #0C42AC;
    --vt1: #95F68B; --vt2: #6AF05C; --vt3: #46EB35; --vt4: #22E50E; --vt5: #14D200;
    --rouge1: #F58A6B; --rouge2: #D9553A; --rouge3: #A83A25;
    /* couleurs utilisées par le pied de page (legal.css) */
    --colorBackLogo: rgb(149, 246, 139);
    --colorTextP: rgb(12, 66, 172);
}
* { margin: 0; padding: 0; box-sizing: border-box; font-family: "Roboto", Arial, sans-serif; }
[hidden] { display: none !important; }

body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background-color: var(--bl1);
}
.jeuRB {
    width: 100%;
    max-width: 1034px;
    margin: 0 auto;
    padding: 20px 20px 30px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
}
.titreRB {
    font-size: clamp(1.6rem, 5vw, 2.2rem);
    font-weight: 900;
    letter-spacing: 2px;
    text-align: center;
    color: var(--bl5);
    text-shadow: 0 2px 0 var(--tq1);
}

/* ----- Carte de réglages ----- */
.carteRB {
    width: 100%;
    max-width: 640px;
    padding: 26px 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
    text-align: center;
    background-image: linear-gradient(160deg, var(--tq1), var(--tq2)), linear-gradient(135deg, var(--bl4), var(--vt3));
    background-origin: border-box;
    background-clip: padding-box, border-box;
    border: 4px solid transparent;
    border-radius: 28px;
    box-shadow: 0 10px 30px rgba(12, 66, 172, 0.35);
}
.consigneRB { font-size: 1.2rem; color: var(--bl5); }
.reglageRB, .groupeRB { width: 100%; border: none; }
.reglageRB legend, .groupeRB legend {
    width: 100%; margin-bottom: 10px; font-size: 1.2rem; font-weight: 700; text-align: center; color: var(--bl5);
}
.puces { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.puceRB { position: relative; cursor: pointer; }
.puceRB input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.puceRB span {
    display: block; padding: 9px 15px; font-size: 1.05rem; font-weight: 700; color: var(--bl5);
    background-color: rgba(255, 255, 255, 0.7); border: 3px solid var(--bl3); border-radius: 30px;
    transition: background-color 0.2s, color 0.2s, border-color 0.2s;
}
.puceRB small { font-size: 0.8em; font-weight: 400; }
.puceRB input:checked + span { color: #fff; background: linear-gradient(135deg, var(--bl4), var(--bl3)); border-color: var(--bl5); }
.puceRB input:focus-visible + span { outline: 4px solid var(--vt4); outline-offset: 2px; }
.puceRB input:disabled + span { opacity: 0.55; cursor: not-allowed; }
.erreurChoix { min-height: 1.4em; font-weight: 700; color: var(--rouge3); }

/* ----- Boutons ----- */
.boutonRB {
    display: inline-block; padding: 12px 30px; font-size: 1.2rem; font-weight: 900; letter-spacing: 1px; text-align: center;
    color: #fff; background: linear-gradient(135deg, var(--bl4), var(--bl3)); border: none; border-radius: 34px; cursor: pointer;
    box-shadow: 0 5px 0 var(--bl5); transition: transform 0.15s, box-shadow 0.15s, background 0.3s;
}
.boutonRB:hover:not(:disabled) { background: linear-gradient(135deg, var(--vt5), var(--vt3)); color: var(--bl5); box-shadow: 0 5px 0 var(--tq5); }
.boutonRB:active:not(:disabled) { transform: translateY(4px); box-shadow: 0 1px 0 var(--tq5); }
.boutonRB:disabled { opacity: 0.5; cursor: not-allowed; }
.boutonRB:focus-visible, .lienRB:focus-visible { outline: 4px solid var(--vt4); outline-offset: 3px; }
.boutonRB.secondaire { background: linear-gradient(135deg, var(--tq5), var(--tq4)); box-shadow: 0 5px 0 var(--bl5); }
.lienRB { font-size: 1rem; font-weight: 700; color: var(--bl5); background: none; border: none; text-decoration: underline; cursor: pointer; }

/* ----- Écran de jeu ----- */
#ecranJeu { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.infosRB {
    width: 100%; display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px 16px;
    padding: 8px 20px; font-size: 1.1rem; font-weight: 700; color: var(--bl5);
    background-color: rgba(255, 255, 255, 0.55); border: 3px solid var(--tq3); border-radius: 30px;
}
.epreuveRB {
    width: 100%; padding: 10px 18px; font-size: 1.25rem; font-weight: 700; text-align: center; color: var(--bl5);
    background-color: var(--vt1); border: 3px solid var(--vt5); border-radius: 24px;
}
#choixPrediction .puceRB span { cursor: pointer; }
canvas#canvasRB {
    display: block; width: 100%; height: auto; touch-action: none; cursor: default;
    border: 5px solid var(--bl4); border-radius: 20px; box-shadow: 0 10px 30px rgba(12, 66, 172, 0.4);
}
.actionsRB { display: flex; flex-wrap: wrap; justify-content: center; gap: 14px; }
#messageRB {
    width: 100%; min-height: 60px; display: flex; align-items: center; justify-content: center; padding: 10px 18px;
    font-size: 1.2rem; font-weight: 700; line-height: 1.3; text-align: center; color: var(--bl5);
    background-color: rgba(255, 255, 255, 0.55); border: 3px dashed var(--tq5); border-radius: 24px;
}
#messageRB.ok { background-color: var(--vt1); border: 3px solid var(--vt5); }
#messageRB.ko { color: #fff; background-color: var(--rouge2); border: 3px solid var(--rouge3); }

.mesuresRB {
    width: 100%; display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; padding: 12px;
    background-color: rgba(255, 255, 255, 0.55); border: 3px solid var(--tq3); border-radius: 20px;
}
.mesure { display: flex; flex-direction: column; gap: 4px; color: var(--bl5); }
.mesure span { font-size: 0.9rem; font-weight: 500; }
.mesure b { font-size: 1.5rem; font-weight: 900; }
.barre { height: 22px; background: rgba(255, 255, 255, 0.8); border: 2px solid var(--bl3); border-radius: 12px; overflow: hidden; }
.barre i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--tq4), var(--tq5)); }
#barKe { background: linear-gradient(90deg, var(--vt3), var(--vt5)); }

.reglagesRB {
    width: 100%; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; padding: 14px;
    background-color: rgba(255, 255, 255, 0.55); border: 3px solid var(--tq3); border-radius: 20px; color: var(--bl5);
}
.curseurRB { display: flex; flex-direction: column; gap: 6px; font-size: 1.05rem; font-weight: 700; }
.curseurRB output { font-weight: 900; }
.curseurRB input[type=range] { width: 100%; height: 34px; accent-color: var(--bl4); }
.voixRB { font-size: 1.05rem; font-weight: 700; cursor: pointer; }
.voixRB input { width: 20px; height: 20px; vertical-align: middle; margin-right: 6px; accent-color: var(--bl4); }
#poidsRB { font-weight: 700; }
.comprendreRB {
    width: 100%; padding: 14px 18px; white-space: pre-line; line-height: 1.5; color: var(--bl5);
    background-color: var(--bl1); border: 3px solid var(--bl3); border-radius: 20px; background-color: #fff;
}
.resultatsRB {
    width: 100%; list-style: none; display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 8px;
    padding: 12px; font-weight: 700; color: var(--bl5); background-color: rgba(255, 255, 255, 0.55);
    border: 3px solid var(--tq3); border-radius: 20px;
}
.tableRB { width: 100%; max-height: 220px; overflow: auto; background: rgba(255, 255, 255, 0.55); border: 3px solid var(--tq3); border-radius: 16px; }
.tableRB table { width: 100%; border-collapse: collapse; text-align: center; color: var(--bl5); }
.tableRB th { position: sticky; top: 0; background: var(--tq2); padding: 6px; }
.tableRB td { padding: 5px 6px; border-top: 1px solid rgba(12, 66, 172, 0.2); }

/* niveau découverte : seulement angle, longueur, masse */
.niveau-decouverte .expertSeul { display: none !important; }

@media (max-width: 520px) {
    .jeuRB { padding: 12px 12px 30px; }
    .carteRB { padding: 20px 14px; }
}
@media (pointer: coarse) {
    .curseurRB input[type=range] { height: 46px; }
    .boutonRB { padding: 14px 30px; }
}

/* ===== Téléphone tenu en hauteur : on demande de tourner l'appareil (pendant la partie seulement) ===== */
#tournerEcran { display: none; }
html.tel-portrait.rb-jeu:not(.jeu-force) #tournerEcran {
    position: fixed; inset: 0; z-index: 50; display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 22px; padding: 20px; text-align: center; font-size: 1.3rem; font-weight: 700; color: #fff; background-color: var(--bl5);
}
.telephone { width: 44px; height: 78px; border: 5px solid var(--vt3); border-radius: 10px; animation: tourneTelephone 2.6s ease-in-out infinite; }
#jouerQuandMeme { padding: 10px 24px; font-size: 1rem; font-weight: 700; color: var(--bl5); background: var(--vt2); border: none; border-radius: 24px; }
@keyframes tourneTelephone { 0%, 15% { transform: rotate(0deg); } 50%, 85% { transform: rotate(-90deg); } 100% { transform: rotate(0deg); } }
@media (prefers-reduced-motion: reduce) { .telephone { animation: none; } .puceRB span, .boutonRB { transition: none; } }
