/* Le Secret de Masuku – style commun, aux couleurs de l'USTM (mobile d'abord) */
:root{
  --nuit:#013469;      /* bleu nuit de l'en-tête USTM */
  --nuit2:#10508D;     /* milieu du dégradé */
  --bleu:#2477BD;      /* titres, liens, étape en cours */
  --bleu-clair:#C0D9ED;/* étapes à venir */
  --bleu-pale:#E5ECF4; /* pastilles hexagonales */
  --or:#FBBA00;        /* bande, boutons, accents */
  --fond:#EFF3F6;
  --carte:#FFFFFF;
  --bord:#E4E4E4;
  --texte:#191D26;
  --gris:#63666B;
  --hexa:polygon(50% 0,100% 25%,100% 75%,50% 100%,0 75%,0 25%);
}
*{box-sizing:border-box}
body{margin:0;background:var(--fond);color:var(--texte);font-family:Inter,system-ui,sans-serif;font-size:15px;line-height:1.45}
a{color:var(--bleu)}a:hover{color:var(--nuit)}

/* En-tête de marque : dégradé bleu + bande or, comme ustm.ga */
.entete{background:linear-gradient(135deg,var(--nuit) 0%,var(--nuit2) 55%,#013567 100%);border-bottom:5px solid var(--or);color:#fff}
.entete-in{max-width:480px;margin:0 auto;padding:12px 20px;display:flex;align-items:center;gap:12px;min-height:60px}
.entete a{color:#fff;text-decoration:none;display:flex;align-items:center;gap:10px}
.marque{font-family:Cinzel,serif;font-weight:700;font-size:16px;letter-spacing:1.5px}
.marque small{display:block;font-family:Inter,sans-serif;font-weight:500;font-size:11px;letter-spacing:2px;color:#D6E4F4;text-transform:uppercase}

.page{max-width:480px;margin:0 auto;padding:20px 20px 100px;display:flex;flex-direction:column;gap:16px}
h1,h2{font-family:Cinzel,serif;color:var(--nuit);margin:0}
h1{font-size:26px}h2{font-size:18px}
.sur-titre{margin:0;font-size:11px;color:var(--bleu);text-transform:uppercase;letter-spacing:2px;font-weight:600}
.muted{color:var(--gris);font-size:13px;margin:0}

.carte{background:var(--carte);border:1px solid var(--bord);border-radius:18px;padding:16px;display:flex;flex-direction:column;gap:10px}
.carte-claire{background:var(--bleu-pale);color:var(--nuit);border-radius:18px;padding:16px;display:flex;flex-direction:column;gap:10px}
.hero{position:relative;overflow:hidden;border-radius:22px;padding:20px 18px 22px;color:#fff;
  background:linear-gradient(135deg,var(--nuit) 0%,var(--nuit2) 55%,#013567 100%);border-bottom:5px solid var(--or);
  display:flex;flex-direction:column;align-items:center;text-align:center;gap:6px}
.hero h1{color:#fff;font-size:30px;line-height:1.08}
.hero .sur-titre{color:var(--or)}
.hero p{color:#D6E4F4;margin:0}
.hero .bulle{color:var(--nuit)}
.hero-k{display:flex;align-items:flex-end;justify-content:center;gap:4px;width:100%}
.hero-k img{width:130px;height:auto}
.bulle{background:#FFF8E1;color:var(--nuit);border-radius:16px 16px 16px 4px;padding:10px 12px;max-width:170px;margin-bottom:84px;font-size:13px;font-weight:500;text-align:left}
.titre-k{display:flex;align-items:center;gap:12px}
.titre-k > div{flex:1}
.titre-k img{width:52px;height:auto}

form{display:flex;flex-direction:column;gap:12px;margin:0}
label{font-size:12px;font-weight:600;color:var(--gris);display:flex;flex-direction:column;gap:4px}
input,select,textarea{min-height:46px;border-radius:12px;border:1px solid #C9D3DD;background:#fff;color:var(--texte);padding:0 12px;font:inherit}
input:focus,select:focus,textarea:focus{outline:2px solid var(--bleu);outline-offset:1px;border-color:var(--bleu)}
.case{flex-direction:row;align-items:center;gap:10px;font-weight:400;font-size:13px}
.case input{min-height:20px;width:20px;height:20px;margin:0;accent-color:var(--bleu)}

.bouton{display:flex;align-items:center;justify-content:center;gap:8px;min-height:52px;border-radius:14px;border:none;background:var(--or);color:var(--nuit);font:inherit;font-weight:700;font-size:16px;text-decoration:none;cursor:pointer;padding:0 16px}
.bouton:hover{background:#E5AA00;color:var(--nuit)}
.bouton-contour{background:#fff;border:1.5px solid var(--bleu);color:var(--bleu)}
.bouton-contour:hover{background:var(--bleu-pale);color:var(--nuit)}
.bouton-nuit{background:var(--nuit);color:#fff}
.bouton-nuit:hover{background:var(--nuit2);color:#fff}
.bouton-danger{background:#fff;border:1.5px solid #D9534F;color:#B52B27;min-height:44px;font-size:14px}

.ligne{display:flex;gap:10px;align-items:center}
.code{font-size:28px;font-weight:700;letter-spacing:4px;margin:0;color:var(--nuit)}
.membre{display:flex;align-items:center;gap:12px;background:var(--carte);border:1px solid var(--bord);border-radius:14px;padding:10px 12px}
.avatar{width:38px;height:42px;clip-path:var(--hexa);background:var(--bleu-pale);color:var(--nuit);display:flex;align-items:center;justify-content:center;font-weight:700;font-size:13px;flex-shrink:0}
.avatar.cap{background:var(--or)}
.jauge{height:10px;border-radius:5px;background:var(--bleu-pale);overflow:hidden}
.jauge span{display:block;height:10px;background:var(--or)}
.pastille{display:inline-flex;align-items:center;font-size:12px;font-weight:600;border-radius:20px;padding:4px 10px;background:#FFF3CC;color:#8A5A00}
.pastille.ok{background:#E6F4EC;color:#1E6B3E}

.flash{margin:0;padding:12px 14px;border-radius:12px;font-size:14px}
.flash-ok{background:#E6F4EC;border:1px solid #9FD3B4;color:#1E6B3E}
.flash-erreur{background:#FDECEA;border:1px solid #E8A79C;color:#7A2318}
.flash-info{background:var(--bleu-pale);border:1px solid var(--bleu-clair);color:var(--nuit)}

/* Barre de navigation du bas : même habillage que l'en-tête (dégradé bleu, bande or) */
.barre{position:fixed;left:0;right:0;bottom:0;z-index:30;display:grid;grid-template-columns:repeat(5,1fr);
  background:linear-gradient(135deg,var(--nuit) 0%,var(--nuit2) 55%,#013567 100%);border-top:5px solid var(--or);
  padding-bottom:env(safe-area-inset-bottom);box-shadow:0 -6px 20px rgba(1,52,105,.18)}
.barre a{position:relative;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:3px;min-height:60px;
  color:#C9DBF0;text-decoration:none;font-size:11px;font-weight:500}
.barre a svg{width:22px;height:22px}
.barre a.actif{color:var(--or);font-weight:700}
.barre a.actif::before{content:"";position:absolute;top:0;width:34px;height:3px;border-radius:0 0 3px 3px;background:var(--or)}
.barre a:focus-visible{outline:2px solid var(--or);outline-offset:-4px}

/* Discussion */
.sr{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0)}
.chat{display:flex;flex-direction:column;gap:10px;height:calc(100vh - 220px);min-height:420px}
.salons{display:flex;gap:6px;overflow-x:auto;padding-bottom:2px}
.salons a{flex-shrink:0;display:flex;align-items:center;min-height:40px;padding:0 14px;border-radius:12px;background:#fff;border:1px solid var(--bord);color:var(--gris);text-decoration:none;font-size:14px;font-weight:600}
.salons a.actif{background:var(--or);border-color:var(--or);color:var(--nuit)}
.fil{flex:1;overflow-y:auto;display:flex;flex-direction:column;gap:8px;padding:4px 2px}
.msg{max-width:85%;align-self:flex-start;background:#fff;border:1px solid var(--bord);border-radius:16px 16px 16px 4px;padding:8px 12px;display:flex;flex-direction:column;gap:2px}
.msg.moi{align-self:flex-end;background:var(--or);border-color:var(--or);color:var(--nuit);border-radius:16px 16px 4px 16px}
.msg.orga{max-width:100%;align-self:stretch;background:#FFF8E1;border-color:#EBD9A0;color:var(--nuit)}
.msg .meta{font-size:11px;color:var(--gris);font-weight:600}
.msg.moi .meta,.msg.orga .meta{color:var(--nuit)}
.msg .texte{white-space:pre-wrap;word-break:break-word}
.signaler{align-self:flex-end;background:none;border:none;color:var(--gris);font:inherit;font-size:11px;padding:4px 0;min-height:24px;cursor:pointer}
.saisie{flex-direction:row;align-items:flex-end;gap:8px;background:#fff;border:1px solid var(--bord);border-radius:16px;padding:4px 4px 4px 12px}
.saisie textarea{flex:1;min-height:44px;max-height:120px;border:none;padding:12px 0;resize:none;background:transparent}
.saisie textarea:focus{outline:none}
.saisie .bouton{min-height:44px;font-size:14px;border-radius:12px}

/* Épisode */
.score{flex-shrink:0;background:#fff;border:1px solid var(--bord);border-radius:20px;padding:6px 12px;font-weight:700;color:var(--nuit);font-variant-numeric:tabular-nums}
.etapes{display:flex;align-items:center;gap:0}
.etape{width:34px;height:38px;clip-path:var(--hexa);display:flex;align-items:center;justify-content:center;font-weight:700;font-size:14px;text-decoration:none;background:var(--bleu-clair);color:var(--nuit)}
.etape + .etape{margin-left:18px;position:relative}
.etape.resolue{background:var(--or);color:var(--nuit)}
.etape.debloquee,.etape.qr_valide,.etape.photo_envoyee{background:var(--bleu);color:#fff}
.conseil{display:flex;align-items:center;gap:10px}
.conseil img{width:52px;height:auto;flex-shrink:0}
.conseil p{margin:0;flex:1;background:#fff;border:1px solid var(--bord);border-radius:16px 16px 16px 4px;padding:10px 12px;font-size:14px}
.enigme.verrouillee{opacity:.65}
.enigme.debloquee,.enigme.qr_valide,.enigme.photo_envoyee{border:1.5px solid var(--bleu)}
.enigme h2{font-family:Inter,sans-serif;font-size:18px;color:var(--texte)}
.points{font-weight:700;color:var(--bleu);font-size:13px}
.parchemin{position:relative;background:#FFF8E1;border:1px solid #EBD9A0;border-radius:14px;padding:16px}
.parchemin p{margin:0;font-family:"JetBrains Mono",ui-monospace,monospace;font-size:14px;line-height:1.65;white-space:pre-wrap;word-break:break-word}
.parchemin span{display:block;text-align:right;font-family:Cinzel,serif;font-size:13px;color:#6B5A2E;margin-top:6px}
.parchemin::after{content:"";position:absolute;top:-9px;right:14px;width:18px;height:18px;border-radius:9px;background:#A33A2C;border:2px solid #FFF8E1}
.repondre{flex-direction:row;gap:8px}
.repondre input{flex:1;min-width:0}
.repondre .bouton{min-height:46px;font-size:15px}
.bouton-indice{background:#fff;border:1.5px dashed #C9D3DD;color:var(--gris);min-height:44px;font-size:14px}
.indice{margin:0;background:var(--bleu-pale);border-radius:12px;padding:10px 12px;font-size:14px;color:var(--nuit)}
.resolue-ok{margin:0;color:#1E6B3E;font-weight:600}
.savais-tu{margin:0;font-size:14px;color:var(--gris)}
.conseil-terrain{margin:0;font-size:14px;color:var(--nuit);background:var(--bleu-pale);border-radius:12px;padding:10px 12px}
.lettre-gagnee{font-family:Cinzel,serif;font-size:56px;font-weight:700;line-height:1;color:var(--or) !important}
.mot-secret{display:grid;grid-template-columns:repeat(14,1fr);gap:3px;margin-top:6px}
.mot-secret span{height:32px;border-radius:6px;background:#fff;border:1px solid var(--bord);display:flex;align-items:center;justify-content:center;font-weight:700;color:var(--nuit)}
.mot-secret span.trouvee{background:var(--or);border-color:var(--or)}

/* Classement */
.onglets{display:grid;grid-template-columns:1fr 1fr;background:#fff;border:1px solid var(--bord);border-radius:14px;padding:4px}
.onglets a{display:flex;align-items:center;justify-content:center;min-height:44px;border-radius:10px;text-decoration:none;color:var(--gris);font-weight:600}
.onglets a.actif{background:var(--or);color:var(--nuit)}
.podium{display:grid;grid-template-columns:repeat(3,1fr);gap:8px;align-items:end}
.marche{display:flex;flex-direction:column;align-items:center;gap:4px;text-align:center}
.marche .nom{font-weight:600;font-size:13px;line-height:1.25}
.socle{width:100%;border-radius:14px 14px 6px 6px;display:flex;justify-content:center;padding-top:10px;font-family:Cinzel,serif;font-size:26px;font-weight:700;color:var(--nuit)}
.m1 .socle{height:110px;background:var(--or)}
.m2 .socle{height:84px;background:#C7CEC6}
.m3 .socle{height:68px;background:#D9A46B}
.rang{width:26px;font-weight:700;color:var(--gris)}
.membre.moi{border:1.5px solid var(--bleu);background:var(--bleu-pale)}

.image-enigme{margin:0;display:flex;flex-direction:column;gap:6px}
.image-enigme img{width:100%;height:auto;border-radius:12px;border:1px solid var(--bord);background:#fff}
.image-enigme a{font-size:13px;font-weight:600;align-self:flex-start}
.reglement p{margin:0}
.reglement ul{margin:0;padding-left:20px;display:flex;flex-direction:column;gap:6px}
.installer .ligne{align-items:center}
.installer p{margin:2px 0 0}

/* Chatbot du Professeur K. */
.profk-bulle{position:fixed;z-index:45;width:64px;height:64px;border-radius:50%;padding:0;border:3px solid var(--or);cursor:grab;touch-action:none;
  background:radial-gradient(circle at 50% 35%,#1A5A9A,var(--nuit));box-shadow:0 8px 22px rgba(1,26,52,.35);display:flex;align-items:flex-end;justify-content:center;overflow:visible;user-select:none;-webkit-user-select:none}
.profk-bulle img{width:46px;height:auto;pointer-events:none;margin-bottom:2px}
.profk-bulle.glisse{cursor:grabbing;transform:scale(1.08);box-shadow:0 14px 30px rgba(1,26,52,.45)}
.profk-bulle:focus-visible{outline:3px solid var(--bleu);outline-offset:3px}
.profk-point{position:absolute;top:2px;right:2px;width:14px;height:14px;border-radius:50%;background:#E4572E;border:2px solid #fff}
.profk-fenetre{position:fixed;z-index:46;left:8px;right:8px;bottom:76px;height:min(72vh,560px);background:#fff;border-radius:20px;
  box-shadow:0 18px 50px rgba(1,26,52,.35);display:flex;flex-direction:column;overflow:hidden;border:1px solid var(--bord)}
.profk-fenetre[hidden]{display:none}
.profk-fenetre header{display:flex;align-items:center;gap:10px;padding:10px 12px;color:#fff;
  background:linear-gradient(135deg,var(--nuit) 0%,var(--nuit2) 55%,#013567 100%);border-bottom:4px solid var(--or)}
.profk-fenetre header img{width:38px;height:auto}
.profk-fenetre header div{flex:1;display:flex;flex-direction:column}
.profk-fenetre header strong{font-family:Cinzel,serif}
.profk-contexte{font-size:12px;color:#D6E4F4}
.profk-fermer{width:40px;height:40px;border-radius:10px;border:1px solid rgba(255,255,255,.45);background:none;color:#fff;font-size:22px;line-height:1;cursor:pointer}
.profk-fil{flex:1;overflow-y:auto;padding:12px;display:flex;flex-direction:column;gap:8px;background:var(--fond)}
.profk-msg{max-width:88%;padding:9px 12px;border-radius:16px;font-size:14px;line-height:1.45;white-space:pre-wrap;word-break:break-word}
.profk-msg.k{align-self:flex-start;background:#fff;border:1px solid var(--bord);border-radius:16px 16px 16px 4px;color:var(--texte)}
.profk-msg.moi{align-self:flex-end;background:var(--or);color:var(--nuit);border-radius:16px 16px 4px 16px}
.profk-msg.attente{color:var(--gris);font-style:italic}
.profk-suggestions{display:flex;gap:6px;overflow-x:auto;padding:8px 10px 0;background:#fff}
.profk-suggestions button{flex:none;min-height:36px;padding:0 12px;border-radius:18px;border:1px solid var(--bleu-clair);background:var(--bleu-pale);color:var(--nuit);font:inherit;font-size:13px;cursor:pointer}
.profk-saisie{flex-direction:row;gap:8px;padding:10px;background:#fff;margin:0}
.profk-saisie input{flex:1;min-width:0;min-height:44px}
.profk-saisie button{width:46px;min-height:44px;border-radius:12px;border:none;background:var(--or);color:var(--nuit);display:flex;align-items:center;justify-content:center;cursor:pointer}

.palier{border-color:var(--or);background:#FFF8E1}
.palier-lots{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px;text-align:center}
.palier-lots span{background:#fff;border-radius:12px;padding:8px 4px;display:flex;flex-direction:column;font-size:13px;color:var(--gris)}
.palier-lots strong{font-family:Cinzel,serif;font-size:18px;color:var(--nuit)}

.lancement{border-color:var(--or)}
.rebours{display:grid;grid-template-columns:repeat(4,1fr);gap:8px;width:100%}
.rebours div{background:var(--nuit);color:#fff;border-radius:12px;padding:10px 4px;display:flex;flex-direction:column;align-items:center}
.rebours strong{font-family:Cinzel,serif;font-size:28px;line-height:1.1;color:var(--or);font-variant-numeric:tabular-nums}
.rebours span{font-size:12px;color:#C9D7E8}
.jauge{display:flex;gap:6px;justify-content:center}
.jauge span{width:34px;height:10px;border-radius:5px;background:#D7E1EC}
.jauge span.pleine{background:var(--or)}
