:root {
  --navy: #0A1047; --indigo: #303880; --orange: #FD7119; --orange2: #FFA364; --cream: #F6E9E0; --cream2: #EFDDD0;
  --rouge: #BF2E01; --vert: #1E8A5A; --vert-f: #E6F4EC;
  --fond: #FFFFFF; --fond2: #FBF6F2; --ink: #0A1047; --muted: #5b6085; --line: #EADFD6;
  --head: 'Archivo Black', 'Arial Black', Arial, sans-serif; --body: 'DM Sans', Arial, sans-serif;
  --r: 14px; --ombre: 0 1px 2px rgba(10,16,71,.06), 0 8px 24px rgba(10,16,71,.06);
}
* { box-sizing: border-box; }
html { color-scheme: light; }
body { margin: 0; background: var(--fond2); color: var(--ink); font: 15px/1.6 var(--body); min-height: 100vh; }
a { color: var(--indigo); }
h1, h2, h3, .head { font-family: var(--head); font-weight: 400; text-transform: uppercase; letter-spacing: .2px; line-height: 1.15; margin: 0; text-wrap: balance; color: var(--navy); }
code { font-family: var(--body); font-weight: 700; font-size: .92em; background: var(--cream); color: var(--indigo); padding: 1px 6px; border-radius: 5px; }
pre { margin: 8px 0 14px; background: var(--navy); border-radius: 10px; padding: 14px 16px; overflow-x: auto; position: relative; }
pre code { background: none; padding: 0; color: var(--cream); font-weight: 500; font-size: 13.5px; line-height: 1.6; white-space: pre; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
pre .copier { position: absolute; top: 8px; right: 8px; font: 700 11px var(--body); background: var(--indigo); color: #fff; border: 0; border-radius: 7px; padding: 4px 9px; cursor: pointer; }
button { font: inherit; }
.wrap { max-width: 1180px; margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }

/* barre du haut */
.hud { position: sticky; top: 0; z-index: 20; background: #fff; border-bottom: 1px solid var(--line); }
.hud .wrap { display: flex; align-items: center; gap: 18px; padding-block: 12px; flex-wrap: wrap; }
.hud .logo { height: 26px; display: block; }
.hud nav { display: flex; gap: 4px; flex-wrap: wrap; }
.hud nav a { color: var(--muted); text-decoration: none; font-weight: 700; font-size: 14px; padding: 7px 12px; border-radius: 9px; }
.hud nav a.actif, .hud nav a:hover { color: var(--navy); background: var(--cream); }
.hud .joueur { margin-left: auto; display: flex; align-items: center; gap: 14px; min-width: 0; }
.xpbox { min-width: 210px; }
.xpbox .l1 { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); gap: 10px; }
.xpbox .l1 b { color: var(--navy); font-family: var(--head); font-weight: 400; font-size: 13px; }
.barre { height: 8px; background: var(--cream); border-radius: 99px; overflow: hidden; margin-top: 5px; }
.barre i { display: block; height: 100%; background: linear-gradient(90deg, var(--orange), var(--orange2)); border-radius: 99px; transition: width .8s cubic-bezier(.2,.8,.2,1); }
.avatar { width: 38px; height: 38px; border-radius: 11px; background: var(--navy); color: #fff; display: grid; place-items: center; font-family: var(--head); font-size: 15px; flex: none; }
.btn-sortir { background: #fff; border: 1px solid var(--line); color: var(--muted); border-radius: 9px; padding: 6px 10px; cursor: pointer; font-size: 13px; }

main { padding-block: 28px 80px; }
.bandeau-apercu { background: var(--orange); color: #fff; text-align: center; font-weight: 700; padding: 6px; font-size: 13px; }
.bandeau-apercu a { color: #fff; }

/* accueil */
.hero { display: grid; grid-template-columns: 1.4fr 1fr; gap: 22px; margin-bottom: 28px; }
.hero .carte-h { background: var(--navy); color: var(--cream); border-radius: 20px; padding: 28px; position: relative; overflow: hidden; min-width: 0; }
.hero .carte-h::after { content: ""; position: absolute; right: -60px; top: -60px; width: 220px; height: 220px; border-radius: 50%; border: 28px solid rgba(253,113,25,.22); }
.kicker { font-family: var(--head); font-size: 12px; letter-spacing: 1.6px; text-transform: uppercase; color: var(--orange); }
.hero h1 { font-size: clamp(28px, 4vw, 42px); margin: 10px 0; color: #fff; }
.hero h1 span { color: var(--orange); }
.hero p { color: #d7daf3; max-width: 58ch; margin: 0 0 18px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat { background: var(--indigo); border-radius: 12px; padding: 14px; }
.stat b { display: block; font-family: var(--head); font-size: 24px; font-weight: 400; color: var(--orange); }
.stat span { font-size: 12px; color: var(--cream); }
.prochaine { display: grid; gap: 2px; text-decoration: none; color: #fff; background: var(--orange); border-radius: 14px; padding: 14px 18px; margin: 0 0 16px; position: relative; }
.prochaine:hover { background: #ff8435; }
.prochaine .kicker { color: var(--navy); }
.prochaine b { font-family: var(--head); font-weight: 400; font-size: 17px; text-transform: uppercase; }
.prochaine span:not(.kicker) { font-size: 13px; color: #fff; opacity: .9; }
.prochaine i { position: absolute; right: 18px; top: 50%; transform: translateY(-50%); font-style: normal; font-family: var(--head); color: var(--navy); }
.prochaine.fini { background: var(--vert); }
.fil { background: #fff; border: 1px solid var(--line); border-radius: 20px; padding: 20px; min-width: 0; box-shadow: var(--ombre); }
.fil h3 { font-size: 15px; margin-bottom: 12px; }
.fil ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; max-height: 320px; overflow: auto; }
.fil li { font-size: 13.5px; color: var(--muted); display: flex; gap: 8px; align-items: baseline; border-bottom: 1px solid var(--cream); padding-bottom: 7px; }
.fil li b { color: var(--navy); }
.fil li .pt { color: var(--orange); font-weight: 700; margin-left: auto; white-space: nowrap; }

.section-t { display: flex; align-items: end; justify-content: space-between; gap: 14px; margin: 34px 0 14px; flex-wrap: wrap; }
.section-t h2 { font-size: 22px; }
.section-t p { margin: 4px 0 0; color: var(--muted); font-size: 14px; }

.semaines { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 16px; }
.sem { position: relative; text-decoration: none; color: inherit; background: #fff; border: 1px solid var(--line); border-top: 5px solid var(--orange); border-radius: var(--r); padding: 20px; display: flex; flex-direction: column; gap: 10px; transition: transform .2s, box-shadow .2s; min-width: 0; box-shadow: var(--ombre); }
.sem:hover { transform: translateY(-3px); box-shadow: 0 14px 34px rgba(10,16,71,.12); }
.sem .num { font-family: var(--head); font-size: 12px; color: var(--orange); letter-spacing: 1.4px; }
.sem h3 { font-size: 18px; }
.sem .theme { color: var(--muted); font-size: 13.5px; margin: 0; }
.sem .pied { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--muted); margin-top: auto; }
.sem.fermee { opacity: .55; pointer-events: none; }
.sem .cadenas { position: absolute; top: 16px; right: 16px; font-size: 12px; color: var(--rouge); font-weight: 700; }
.sem.finie { border-top-color: var(--vert); }

.classes { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.cls { text-align: left; cursor: pointer; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 16px; color: inherit; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.cls:hover { border-color: var(--indigo); }
.cls .tag { display: inline-flex; align-self: flex-start; font-family: var(--head); font-size: 11px; letter-spacing: 1px; padding: 3px 9px; border-radius: 99px; }
.cls b { color: var(--navy); }
.cls p { margin: 0; color: var(--muted); font-size: 13px; }
.cls.moi { border: 2px solid var(--orange); }

/* semaine */
.retour { color: var(--muted); text-decoration: none; font-size: 14px; font-weight: 700; }
.bandeau-sem { background: var(--navy); color: var(--cream); border-radius: 14px; padding: 26px 28px 22px; margin: 14px 0 18px; }
.bandeau-sem .kicker { color: var(--orange2); }
.bandeau-sem h1 { font-size: clamp(26px, 4vw, 38px); margin-top: 8px; color: var(--cream); }
.bandeau-sem p { color: #d7daf3; max-width: 78ch; margin: 10px 0 0; }
.pastille-explo { display: inline-block; background: #9CDDF1; color: var(--navy); border-radius: 99px; padding: 3px 10px; font-size: 12px; font-weight: 700; margin-left: 8px; vertical-align: middle; }
.kit { background: var(--cream); border-left: 5px solid var(--indigo); border-radius: 0 10px 10px 0; padding: 12px 16px; font-size: 14px; margin-bottom: 26px; }
.jour { margin-bottom: 30px; }
.jour-t { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; border-bottom: 2px solid var(--orange); padding-bottom: 8px; }
.jour-t .n { font-family: var(--head); font-size: 32px; color: var(--orange); line-height: 1; }
.jour-t h2 { font-size: 19px; }
.jour-t p { margin: 2px 0 0; color: var(--muted); font-size: 13.5px; }
.jour-p { margin-left: auto; font-family: var(--head); font-size: 14px; color: var(--indigo); background: var(--cream); border-radius: 8px; padding: 3px 10px; }
.jour.verrou .quetes { filter: grayscale(.8); opacity: .5; }
.quetes { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.q { cursor: pointer; text-align: left; color: inherit; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 16px; display: flex; flex-direction: column; gap: 8px; position: relative; min-width: 0; transition: box-shadow .2s, transform .2s; box-shadow: var(--ombre); }
.q:hover { transform: translateY(-2px); box-shadow: 0 12px 28px rgba(10,16,71,.12); }
.q .type { font-family: var(--head); font-size: 10.5px; letter-spacing: 1.3px; text-transform: uppercase; }
.q h3 { font-size: 15.5px; }
.q .meta { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--muted); margin-top: auto; gap: 8px; }
.q .meta b { color: var(--orange); }
.q.ok { border-color: #9fd6b9; background: var(--vert-f); }
.q.ok::after { content: "✓"; position: absolute; top: 12px; right: 14px; color: var(--vert); font-weight: 700; }
.q.boss { border: 2px solid var(--orange); background: #FFF6EF; }
.q.defi { border: 2px solid var(--indigo); background: #F4F5FB; }
.q.lock { cursor: not-allowed; }
.t-guidee { color: var(--indigo); } .t-approfondissement { color: var(--orange); } .t-boss { color: var(--rouge); } .t-bonus { color: #7A4FC4; } .t-defi { color: var(--indigo); }
.msg-verrou { font-size: 13px; color: var(--rouge); margin: -2px 0 10px; font-weight: 700; }

/* panneau quête, présenté comme un atelier du cahier de TP */
.voile { position: fixed; inset: 0; background: rgba(10,16,71,.45); z-index: 40; display: flex; justify-content: flex-end; }
.panneau { width: min(820px, 100%); height: 100%; overflow-y: auto; background: #fff; padding: 0 0 60px; animation: entre .25s ease-out; }
@keyframes entre { from { transform: translateX(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.atelier-bandeau { background: var(--navy); color: var(--cream); padding: 24px 30px 20px; position: relative; }
.atelier-bandeau small { display: block; font-weight: 700; color: var(--orange2); font-size: 13px; margin-bottom: 6px; }
.atelier-bandeau h2 { color: var(--cream); font-size: 24px; padding-right: 40px; }
.atelier-bandeau .fermer { position: absolute; top: 18px; right: 18px; background: rgba(255,255,255,.12); border: 0; color: #fff; width: 36px; height: 36px; border-radius: 9px; cursor: pointer; font-size: 18px; }
.atelier-corps { padding: 6px 30px 0; }
.atelier-tete { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; border-bottom: 2px solid var(--orange); padding: 14px 0 8px; margin-bottom: 12px; flex-wrap: wrap; }
.atelier-tete .num { font-family: var(--head); color: var(--orange); font-size: 15px; }
.duree { font-weight: 700; font-size: 13px; color: var(--indigo); white-space: nowrap; background: var(--cream); padding: 3px 10px; border-radius: 7px; }
.panneau .puces { display: flex; gap: 6px; flex-wrap: wrap; margin: 4px 0 12px; }
.panneau .puces span { font-size: 12px; background: var(--fond2); border: 1px solid var(--line); border-radius: 99px; padding: 2px 10px; color: var(--muted); }
.objectif { font-weight: 700; color: var(--indigo); margin: 0 0 14px; }
.savoir { background: var(--cream); border-left: 6px solid var(--indigo); border-radius: 0 10px 10px 0; padding: 12px 16px; margin: 12px 0; }
.savoir b.t { display: block; font-weight: 700; color: var(--indigo); margin-bottom: 2px; }
.panneau h4 { font-family: var(--head); font-weight: 400; font-size: 13.5px; letter-spacing: .6px; text-transform: uppercase; margin: 22px 0 8px; color: var(--navy); }
.fichiers { display: grid; gap: 8px; }
.fichiers a { display: flex; justify-content: space-between; gap: 12px; text-decoration: none; background: var(--fond2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; color: var(--navy); font-weight: 700; font-size: 14px; }
.fichiers a:hover { border-color: var(--indigo); }
.fichiers a span.d { color: var(--muted); font-weight: 400; font-size: 12.5px; }
.encadres { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 18px 0 6px; }
.encadre { border-radius: 10px; padding: 14px 16px; font-size: 14px; min-width: 0; }
.encadre > b.t { display: block; font-weight: 700; margin-bottom: 6px; }
.encadre.aides { background: #fff; border: 1.5px solid var(--orange); grid-column: 1 / -1; }
.encadre.aides > b.t { color: var(--rouge); }
.encadre.livrable { background: var(--cream2); grid-column: 1 / -1; }
.encadre.livrable > b.t { color: var(--navy); }
.aide { border-top: 1px dashed var(--line); padding: 10px 0 2px; display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.aide:first-of-type { border-top: 0; padding-top: 2px; }
.aide .nom { font-weight: 700; color: var(--navy); }
.aide .nom small { display: block; font-weight: 400; color: var(--muted); font-size: 12.5px; }
.aide.ouverte { display: block; }
.aide.ouverte .txt { margin-top: 6px; background: #FFF6EF; border-radius: 8px; padding: 10px 12px; }
.aide button { background: #fff; border: 1.5px solid var(--orange); color: var(--rouge); border-radius: 9px; padding: 6px 12px; cursor: pointer; font-weight: 700; font-size: 13px; white-space: nowrap; }
.aide button:disabled { opacity: .45; cursor: not-allowed; }
.aide button.sur { background: var(--orange); color: #fff; }
.bilan-aides { font-size: 12.5px; color: var(--muted); margin-top: 8px; }
.repondre input, .repondre textarea { width: 100%; background: #fff; border: 1.5px solid #d8cfc6; color: var(--navy); border-radius: 10px; padding: 12px 14px; font: 15px var(--body); }
.repondre textarea { min-height: 180px; font-family: ui-monospace, Menlo, monospace; font-size: 13px; }
.repondre input:focus, .repondre textarea:focus { outline: 2px solid var(--orange); border-color: transparent; }
.btn { background: var(--orange); color: #fff; border: 0; border-radius: 10px; padding: 12px 22px; font-family: var(--head); font-size: 14px; letter-spacing: .4px; text-transform: uppercase; cursor: pointer; margin-top: 12px; }
.btn:hover { background: #ff8435; }
.btn:disabled { opacity: .5; cursor: wait; }
.btn.sec { background: #fff; border: 1px solid var(--line); color: var(--navy); }
.retour-v { margin-top: 10px; font-weight: 700; font-size: 14px; }
.retour-v.ko { color: var(--rouge); } .retour-v.ok { color: var(--vert); }
.qcm-q { margin-bottom: 14px; background: #fff; border-radius: 10px; padding: 10px 12px; }
.qcm-q p { margin: 0 0 6px; color: var(--navy); font-weight: 700; }
.qcm-q label { display: block; padding: 6px 10px; border-radius: 8px; cursor: pointer; color: var(--ink); }
.qcm-q label:hover { background: var(--cream); }
.qcm-q input { margin-right: 8px; accent-color: var(--orange); }
.resolue { background: var(--vert-f); border: 1px solid #9fd6b9; border-radius: 10px; padding: 12px 16px; color: #14583a; }
.avert { font-size: 12.5px; color: var(--rouge); margin: 10px 0 0; font-weight: 700; }
.corrige { margin-top: 18px; background: #fff; border: 1px dashed var(--rouge); border-radius: 10px; padding: 12px 16px; font-size: 13.5px; }

/* classement et badges */
.onglets { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.onglets button { background: #fff; border: 1px solid var(--line); color: var(--muted); border-radius: 99px; padding: 7px 14px; cursor: pointer; font-weight: 700; font-size: 13px; }
.onglets button.actif { background: var(--navy); border-color: var(--navy); color: #fff; }
.tableau { overflow-x: auto; border: 1px solid var(--line); border-radius: 14px; background: #fff; box-shadow: var(--ombre); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--cream); white-space: nowrap; }
th { font-family: var(--head); font-weight: 400; font-size: 11.5px; letter-spacing: .8px; text-transform: uppercase; color: var(--cream); background: var(--navy); }
tr.moi td { background: #FFF1E6; }
td.place { font-family: var(--head); color: var(--orange); }
.podium { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 18px; }
.podium div { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 16px; text-align: center; min-width: 0; box-shadow: var(--ombre); }
.podium div:nth-child(1) { border: 2px solid var(--orange); }
.podium b { display: block; font-family: var(--head); font-weight: 400; font-size: 30px; color: var(--orange); }
.podium span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; }
.guerre { display: grid; gap: 8px; margin-bottom: 26px; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 16px; }
.guerre .l { display: grid; grid-template-columns: 90px 1fr 80px; gap: 10px; align-items: center; font-size: 13px; }
.guerre .l .barre { height: 12px; margin: 0; }
.badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.badge { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 18px; text-align: center; min-width: 0; }
.badge .ico { width: 56px; height: 56px; margin: 0 auto 10px; border-radius: 50%; display: grid; place-items: center; font-family: var(--head); font-size: 20px; background: var(--cream); color: var(--muted); }
.badge.ok .ico { background: var(--orange); color: #fff; box-shadow: 0 0 0 6px #FFE3CF; }
.badge b { display: block; font-family: var(--head); font-weight: 400; font-size: 14px; text-transform: uppercase; }
.badge p { margin: 4px 0 0; font-size: 12.5px; color: var(--muted); }
.badge:not(.ok) { opacity: .6; }
.rangs { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 24px; }
.rangs span { font-size: 12.5px; padding: 6px 12px; border-radius: 99px; border: 1px solid var(--line); color: var(--muted); background: #fff; }
.rangs span.atteint { border-color: var(--orange); color: var(--navy); font-weight: 700; }
.carte-profil { background: var(--navy); color: var(--cream); border-radius: 18px; padding: 22px; margin-bottom: 22px; display: flex; gap: 18px; flex-wrap: wrap; align-items: center; }
.carte-profil h2 { color: #fff; }
.carte-profil .avatar { background: var(--orange); }
.carte-profil form { display: flex; gap: 8px; flex-wrap: wrap; margin-left: auto; }
.carte-profil input { background: #fff; border: 0; color: var(--navy); border-radius: 9px; padding: 9px 12px; font: 14px var(--body); }
.carte-profil .btn { margin: 0; padding: 9px 16px; font-size: 12px; }

/* toasts */
.toasts { position: fixed; bottom: 18px; right: 18px; z-index: 60; display: grid; gap: 10px; max-width: calc(100vw - 36px); }
.toast { background: var(--navy); color: var(--cream); border-radius: 12px; padding: 14px 18px; box-shadow: 0 12px 40px rgba(10,16,71,.3); min-width: 260px; animation: monte .35s cubic-bezier(.2,.8,.2,1); }
.toast b { display: block; font-family: var(--head); font-weight: 400; text-transform: uppercase; font-size: 14px; }
.toast.xp { background: var(--orange); color: #fff; }
@keyframes monte { from { transform: translateY(20px); opacity: 0; } to { transform: none; opacity: 1; } }
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 70; }

/* connexion */
body.login { display: grid; place-items: center; padding: 20px; background: var(--fond2); }
.login-carte { width: min(460px, 100%); background: #fff; border: 1px solid var(--line); border-top: 6px solid var(--orange); border-radius: 20px; padding: 34px; text-align: center; box-shadow: var(--ombre); }
.login-carte img { height: 34px; margin-bottom: 22px; }
.login-carte h1 { font-size: 40px; }
.login-carte h1 span { color: var(--orange); }
.login-carte p { color: var(--muted); }
.login-carte .gbtn { display: flex; justify-content: center; margin: 18px 0; min-height: 44px; }
.alerte { color: var(--rouge) !important; font-weight: 700; }
.signature { font-size: 12.5px; margin-top: 18px; font-weight: 700; color: var(--indigo) !important; }

.vide { color: var(--muted); padding: 30px; text-align: center; border: 1px dashed var(--line); border-radius: 14px; background: #fff; }
:focus-visible { outline: 2px solid var(--orange); outline-offset: 2px; }
@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; }
  .hud .joueur { margin-left: 0; width: 100%; }
  .xpbox { flex: 1; min-width: 0; }
  .encadres { grid-template-columns: 1fr; }
  .atelier-bandeau, .atelier-corps { padding-left: 18px; padding-right: 18px; }
}
@media (max-width: 560px) { .prochaine i { position: static; transform: none; margin-top: 6px; } .stats { grid-template-columns: repeat(3, minmax(0,1fr)); } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
