/* MathsHorizon — langage commun du Village des nombres */
:root{--ink:#173e5a;--gold:#c59a46;--paper:#fff8e7;--wood:#684322;--village-scene:url('assets/bibliotheque.png')}
body[data-view]{background:#e9d5af var(--village-scene) center center/cover fixed no-repeat;color:var(--ink);font-family:system-ui,sans-serif}
body[data-view='mastery']{--village-scene:url('assets/cour-entrainement.png')}
body[data-view]::before{content:'';position:fixed;inset:0;background:linear-gradient(90deg,#163a4a12,transparent 25%,transparent 75%,#163a4a12);pointer-events:none;z-index:-1}
body[data-view] header,.village-bar{height:62px!important;padding:10px 24px!important;background:linear-gradient(#285775,#13344d)!important;border-bottom:3px solid var(--gold)!important;box-shadow:0 4px 13px #342a2540;display:flex;align-items:center;justify-content:space-between;gap:16px;color:#fff0c7}
body[data-view] header a{color:#fff0c7!important;text-decoration:none;font-size:14px}body[data-view] header h1{font-size:20px;font-family:Georgia,serif;color:#fff0c7}
.village-brand{font-family:Georgia,serif;font-weight:700;font-size:25px;color:#ffe3a0;text-shadow:0 2px 1px #071c30;letter-spacing:.025em}.village-place{color:#efe3c7;font-size:13px}
body[data-view] h1,body[data-view] h2,body[data-view] h3{font-family:Georgia,serif}
body[data-view] button,body[data-view] nav a,body[data-view] .mini-quiz{border:1px solid #c8a359!important;background:linear-gradient(#2c6080,#133b58)!important;color:#fff0c7!important;box-shadow:0 3px 0 #0b263c,0 4px 9px #23344620;border-radius:11px;text-decoration:none;transition:transform .15s,filter .15s}
body[data-view] button:hover:not(:disabled),body[data-view] nav a:hover,body[data-view] .mini-quiz:hover{filter:brightness(1.12);transform:translateY(-1px)}
body[data-view] button:active:not(:disabled),body[data-view] nav a:active,body[data-view] .mini-quiz:active{transform:translateY(1px)}
body[data-view] a:focus-visible,body[data-view] button:focus-visible{outline:3px solid #f1c858;outline-offset:4px}
body[data-view] .example{background:#e7eee9;border:1px solid #ccd8cf;box-shadow:inset 0 1px 2px #173e5a08;border-radius:8px}
/* Les quatre panneaux de cours, sur un seul écran de bureau. */
body[data-view='course'] main{max-width:1280px;height:calc(100dvh - 62px);padding:12px 28px;margin:0 auto;gap:6px}
body[data-view='course'] main>.intro{color:#fff2cc;background:#183f5be8;align-self:flex-start;padding:3px 12px;border:1px solid #c8a359;border-radius:20px;font-size:12px}
body[data-view='course'] main>h1{align-self:flex-start;margin:0;padding:5px 18px;font-size:27px;background:#fff7e6f2;border:1px solid #c5a05a;border-radius:10px;text-shadow:0 1px #fff}
body[data-view='course'] main>p:not(.intro){display:none}
body[data-view='course'] .lessons{gap:16px}
body[data-view='course'] article{position:relative;background:linear-gradient(115deg,#fffcef,#f6e7c7);border:2px solid #b98e42;border-radius:15px;padding:13px 20px;box-shadow:inset 0 0 0 4px #fffbef,0 5px 0 #856438,0 10px 20px #30261b28}
body[data-view='course'] article h2{font-size:21px;padding-bottom:7px;border-bottom:1px solid #d9c393;margin-bottom:4px}
body[data-view='course'] article p{font-size:14px;line-height:1.45;margin:6px 0}
body[data-view='course'] .mini-quiz{font-size:13px;padding:8px 13px;margin-top:7px}
body[data-view='course'] nav{margin-top:4px;gap:12px}
/* Tableau du savoir : contenus HTML nets devant le décor de bibliothèque. */
body[data-view='mindmap'] .map{height:calc(100dvh - 96px);margin-top:12px;min-height:0}
body[data-view='mindmap'] .branch{background:linear-gradient(110deg,#fffbed,#f6e8c9);border:2px solid #c39c58;border-top:4px solid var(--accent);box-shadow:inset 0 0 0 3px #fffaf0,0 5px 0 #795937,0 8px 16px #342b2630}
body[data-view='mindmap'] .central{box-shadow:0 0 0 5px #edce87,0 8px 0 #725231,0 12px 20px #342b2630}
body[data-view='mindmap'] .links path{stroke-width:3;opacity:1}
/* Quiz : table d'étude et cour d'entraînement. */
body[data-view='study'] main,body[data-view='mastery'] main{max-width:1000px;margin:0 auto;padding:16px 25px 24px;min-height:calc(100dvh - 62px)}
body[data-view='study'] .eyebrow,body[data-view='mastery'] .eyebrow{color:#fff0c7;background:#183f5bf2;border:1px solid #c8a359;border-radius:20px;display:inline-block;padding:5px 13px;font-size:11px}
body[data-view='study'] main>h1,body[data-view='mastery'] main>h1{font-size:28px;margin:9px 0 5px;background:#fff8e8f5;border:1px solid #d4b26c;border-radius:12px;padding:8px 18px;display:table;max-width:100%}
body[data-view='study'] .intro,body[data-view='mastery'] .intro{color:#1d4057;background:#fff8e8ed;padding:7px 14px;border-radius:9px;display:table;margin:5px 0 13px;font-size:13px;line-height:1.5}
body[data-view] .card{background:linear-gradient(110deg,#fffced,#f6e8cb);border:3px solid #b88e45;border-radius:20px;box-shadow:inset 0 0 0 4px #fffbef,0 6px 0 #765231,0 14px 30px #172c3a35;padding:24px 28px}
body[data-view='study'] #quiz{border-radius:10px 25px 25px 10px;box-shadow:inset 13px 0 0 #ddcba7,inset 16px 0 0 #ac8a55,inset 19px 0 0 #fff9e9,0 7px 0 #684322,0 14px 30px #172c3a35;padding-left:38px}
body[data-view] .meta{color:#426076;font-size:13px}.bar{margin:12px 0 20px!important;background:#d6c6a7!important}.bar span{background:linear-gradient(90deg,#357c9d,#55b9ce)!important}
.crystals{display:flex;gap:7px;flex-wrap:wrap;margin:0 0 15px}.crystal{display:block;width:10px;height:14px;background:#d3c9b6;clip-path:polygon(50% 0,100% 40%,72% 100%,28% 100%,0 40%)}.crystal.completed{background:#258da6}.crystal.current{background:#d7a332}
body[data-view] legend{font-size:23px;line-height:1.45;margin-bottom:17px}
body[data-view] .answers{grid-template-columns:1fr 1fr;gap:13px}
body[data-view] label.answer{border:2px solid #c5a66a;background:linear-gradient(#fffdf4,#f2e5ca);box-shadow:0 3px 0 #b99a65;border-radius:12px;padding:14px;align-items:center;line-height:1.5;min-height:75px;font-size:15px}
body[data-view] label.answer:hover{border-color:#437c9b;background:#fffbee}
body[data-view] label.answer:has(input:checked){border-color:#247797;background:#dceff1;box-shadow:0 3px 0 #28657e}
body[data-view] .letter{background:#1c4965;border:1px solid #d2ad60;color:#ffedb9;border-radius:50%;width:28px;height:28px;flex-shrink:0;display:grid;place-items:center;font-family:Georgia,serif}
body[data-view] input{accent-color:#245e7c;margin-top:0}
body[data-view] .navigation{margin-top:15px}
body[data-view] #notice{font-size:13px;min-height:20px;margin:9px 0 0}
body[data-view] .score{color:#215773;font-family:Georgia,serif}body[data-view] .review article{background:#fff8e9;border:1px solid #c9ac73;border-left:5px solid #30836e;box-shadow:0 4px 12px #172c3a20}body[data-view] .review article.wrong{border-left-color:#bd643e}
body[data-view] #results>h2{display:table;background:#fff8e9;padding:9px 18px;border-radius:10px;border:1px solid #c9ac73}
@media(min-width:761px) and (max-height:800px){body[data-view='course'] article{padding:10px 16px}body[data-view='course'] article h2{font-size:18px}body[data-view='course'] article p{font-size:13px;line-height:1.38;margin:4px 0}body[data-view='course'] .mini-quiz{padding:6px 11px;margin-top:5px}body[data-view='course'] main>h1{font-size:24px}body[data-view='mindmap'] .branch{padding:10px 14px}body[data-view='mindmap'] .branch p{font-size:13px;line-height:1.4}body[data-view='mindmap'] .branch h2{font-size:18px}body[data-view='study'] main,body[data-view='mastery'] main{padding-top:10px}body[data-view] .card{padding:18px 24px}body[data-view] legend{font-size:21px}body[data-view] label.answer{min-height:64px;padding:11px;font-size:14px}body[data-view] .intro{margin-bottom:10px!important}}
@media(max-width:760px){body[data-view] header{height:auto!important;min-height:58px;padding:12px!important;flex-wrap:wrap;gap:7px}.village-brand{font-size:22px}.village-place{display:none}body[data-view] header h1{font-size:16px}.actions{gap:10px}body[data-view='course'] main{height:auto;padding:14px}body[data-view='course'] .lessons{grid-template-columns:1fr;grid-template-rows:auto}body[data-view='course'] article{padding:18px}body[data-view='course'] article p{font-size:16px}body[data-view='mindmap'] .map{height:auto;margin:16px 12px;width:calc(100% - 24px)}body[data-view='study'] main,body[data-view='mastery'] main{padding:16px 12px}body[data-view] .answers{grid-template-columns:1fr}body[data-view] .card{padding:20px}body[data-view='study'] #quiz{padding-left:30px}body[data-view] legend{font-size:20px}body[data-view] label.answer{font-size:16px}body[data-view='study'] main>h1,body[data-view='mastery'] main>h1{font-size:25px}}
@media(prefers-reduced-motion:reduce){body[data-view] button,body[data-view] nav a,body[data-view] .mini-quiz{transition:none}}
@media print{body[data-view]{background:white!important}body[data-view]::before{display:none}body[data-view='mindmap'] header{height:12mm!important;background:white!important;box-shadow:none;padding:0 2mm!important;color:#173e5a}body[data-view='mindmap'] header h1{color:#173e5a;font-size:16pt}body[data-view='mindmap'] .map{height:177mm;margin:3mm auto 0}body[data-view='mindmap'] .branch{box-shadow:none;background:#fffaf0;border-width:1px;border-top-width:3px;padding:3mm 4mm}body[data-view='mindmap'] .central{box-shadow:none}body[data-view='mindmap'] .branch p{font-size:10pt}body[data-view='mindmap'] .branch h2{font-size:12pt}.village-place{display:none}}

@media screen and (min-width:761px) and (max-height:800px){body[data-view="mindmap"] .central{padding:8px}.central h2{font-size:23px;margin:5px 0}.central:before{font-size:12px;margin-bottom:3px}.central:after{font-size:9px;margin-top:3px}}

/* Résultats : une correction par écran, sans liste verticale. */
body[data-view] main.results-mode>.eyebrow,body[data-view] main.results-mode>h1,body[data-view] main.results-mode>.intro{display:none}
body[data-view] main.results-mode #results>.card{padding:18px 26px}
body[data-view] main.results-mode #resultTitle{display:inline-block;margin:8px 20px 8px 0;font-size:25px}
body[data-view] main.results-mode .score{display:inline-block;font-size:38px;margin:5px 0}
body[data-view] main.results-mode #summary{margin:5px 0 12px;font-size:14px}
body[data-view] main.results-mode #results>h2{font-size:21px;margin:16px 0 12px;padding:7px 15px}
body[data-view] main.results-mode .review{margin-top:0;display:block}
body[data-view] main.results-mode .review article{padding:18px 24px}
body[data-view] main.results-mode .review h3{font-size:19px;line-height:1.4}
body[data-view] main.results-mode .review p{font-size:15px;line-height:1.5;margin:7px 0}
.review-pager{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-top:16px;background:#fff8e9f5;padding:10px 14px;border:1px solid #c9ac73;border-radius:12px}
#reviewCounter{font-size:14px;color:#173e5a;text-align:center}
@media(min-width:761px) and (max-height:800px){body[data-view] main.results-mode #results>.card{padding:12px 22px}body[data-view] main.results-mode .review article{padding:13px 20px}body[data-view] main.results-mode .review p{font-size:14px;margin:5px 0}.review-pager{margin-top:10px;padding:8px 12px}body[data-view] main.results-mode #results>h2{margin:12px 0 8px}}
@media(max-width:760px){.review-pager{gap:6px;padding:8px}.review-pager button{padding:10px 8px;font-size:13px}#reviewCounter{font-size:12px}}

body[data-view] #questionForm .navigation{justify-content:flex-end}
body[data-view] label.answer{display:grid;grid-template-columns:16px 28px minmax(0,1fr);column-gap:12px;row-gap:5px}
body[data-view] label.answer.answer-wrong{border-color:#b66b38;background:#fff1dd;box-shadow:0 3px 0 #a8754b}
body[data-view] label.answer.answer-correct{border-color:#438576;background:#e7f2e9;box-shadow:0 3px 0 #438576}
.answer-feedback{grid-column:3;display:grid;gap:5px;border-top:1px solid #d1af85;padding-top:8px;margin-top:4px;color:#713d22;font-size:13px;line-height:1.4}
body[data-view] label.answer:has(input:disabled){cursor:default}body[data-view] input:disabled{opacity:1}
body[data-view] main.feedback-open>.intro{display:none}
@media(min-width:761px) and (max-height:800px){.answer-feedback{font-size:12px;gap:3px;padding-top:5px}body[data-view] main.feedback-open .card{padding-top:14px;padding-bottom:14px}body[data-view] main.feedback-open label.answer{min-height:55px;padding:9px}body[data-view] main.feedback-open legend{margin-bottom:10px;font-size:20px}}

/* Alignements stables des cadres de la bibliothèque. */
body[data-view='course'] article{justify-content:flex-start}
body[data-view='course'] article h2{margin-top:0}
body[data-view='course'] article .mini-result{margin-top:auto;padding-top:8px}
body[data-view='course'] article .mini-quiz{margin-top:8px;flex-shrink:0}
/* Six panneaux de même taille, avec davantage d’espace intérieur. */
@media screen and (min-width:761px){
body.retention-page[data-view='mindmap'] .map{height:calc(100dvh - 86px);margin-bottom:8px}
body.retention-page[data-view='mindmap'] .branch{width:35.5%;height:31%;padding:18px 24px}
body.retention-page .branch.top{top:0}
body.retention-page .branch.middle{top:34.5%}
body.retention-page .branch.bottom{top:69%}
body.retention-page .branch h2{margin-top:0;margin-bottom:10px}
}
@media screen and (min-width:761px) and (max-height:800px){
body.retention-page[data-view='mindmap'] .branch{padding:13px 18px}
body.retention-page .branch h2{margin-bottom:6px}
body.retention-page .branch p{line-height:1.35;margin:2px 0}
body[data-view='course'] article .mini-result{padding-top:4px}
body[data-view='course'] article .mini-quiz{margin-top:5px}
}

/* Titres à la même distance du bord supérieur dans les six cadres. */
body.retention-page[data-view='mindmap'] .branch{justify-content:flex-start!important}
body.retention-page[data-view='mindmap'] .branch h2{flex-shrink:0;margin-top:0}
body.retention-page[data-view='mindmap'] .central::before{display:none!important;content:none!important}

@media screen and (min-width:761px){body.retention-page[data-view='mindmap'] .branch p{line-height:1.4;margin:2px 0}body.retention-page[data-view='mindmap'] .branch h2{margin-bottom:8px}}
@media screen and (min-width:761px) and (max-height:800px){body.retention-page[data-view='mindmap'] .branch p{line-height:1.3;margin:2px 0}body.retention-page[data-view='mindmap'] .branch h2{margin-bottom:6px}}

body[data-view='course'] header .village-return{padding:8px 15px;border:1px solid #c8a359;border-radius:9px;background:linear-gradient(#2c6080,#133b58);color:#fff0c7;font:12px system-ui,sans-serif;white-space:nowrap}

body.retention-page[data-view]{--village-scene:url("assets/tableau-je-retiens-affiches-v2.png")}

/* Panneaux de cours inspirés des enseignes du village. */
body[data-view='course'] .lessons article{position:relative;border:6px solid #936431;border-radius:15px;padding:14px 16px;background:linear-gradient(115deg,#fff9e9,#f0dfb9);box-shadow:inset 0 0 0 2px #e2bd71,0 4px 0 #543b24,0 8px 15px #382b2438;overflow:visible}
body[data-view='course'] .lessons article::before{content:'';position:absolute;inset:0;pointer-events:none;border-radius:15px;background:radial-gradient(circle at 9px 9px,#f2d58e 0 2px,#674522 3px,transparent 4px),radial-gradient(circle at calc(100% - 9px) 9px,#f2d58e 0 2px,#674522 3px,transparent 4px),radial-gradient(circle at 9px calc(100% - 9px),#f2d58e 0 2px,#674522 3px,transparent 4px),radial-gradient(circle at calc(100% - 9px) calc(100% - 9px),#f2d58e 0 2px,#674522 3px,transparent 4px)}
body[data-view='course'] .lessons article h2{background:linear-gradient(#2c6080,#173e5a);color:#fff0c7;border:1px solid #d0aa5b;box-shadow:inset 0 0 0 2px #224b65,0 3px 0 #b18c48;border-radius:9px;padding:8px 11px;margin:0 0 10px;min-height:42px;font-size:20px;line-height:1.25}
body[data-view='course'] .lessons article.lesson-completed{background:linear-gradient(115deg,#f3f8e6,#deebce);border-color:#936431;box-shadow:inset 0 0 0 2px #c5d6a6,0 4px 0 #543b24,0 8px 15px #382b2438}
body[data-view='course'] .lessons article.lesson-completed h2{background:linear-gradient(#3f735d,#285141);color:#fff0c7;border-color:#d0aa5b;box-shadow:inset 0 0 0 2px #365f4f,0 3px 0 #b18c48}
body[data-view='course'] .lessons .example{background:#fffdf4a8;border:1px solid #c6b183;border-left:3px solid #b68b45;box-shadow:inset 0 1px 4px #9c733812}
@media(min-width:761px) and (max-height:800px){body[data-view='course'] .lessons article{padding:10px 12px}body[data-view='course'] .lessons article h2{font-size:17px;min-height:35px;padding:6px 9px;margin-bottom:6px}}
@media(max-width:760px){body[data-view='course'] .lessons article{padding:16px}body[data-view='course'] .lessons article h2{font-size:20px}}

/* Liaisons contrastées de la carte mentale sur le tableau illustré. */
body.retention-page[data-view='mindmap'] .links path{stroke-width:6;stroke-linecap:round;opacity:1;filter:drop-shadow(1px 0 0 #fff5d6) drop-shadow(-1px 0 0 #fff5d6) drop-shadow(0 1px 0 #fff5d6) drop-shadow(0 -1px 0 #fff5d6) drop-shadow(0 2px 1px #38241099)}


/* Bibliothèque aux étagères remplies de livres pour Je comprends. */
body[data-view='course']{--village-scene:url('assets/bibliotheque-livres.png')}

/* Carte mentale : enseignes colorées, bois et parchemin. */
@media screen{
body.retention-page[data-view='mindmap'] .branch{border:5px solid #936431;border-radius:15px;background:linear-gradient(115deg,#fff9e9,#f0dfb9);box-shadow:inset 0 0 0 2px #e2bd71,0 4px 0 #543b24,0 8px 15px #382b2438;padding:12px 16px}
body.retention-page[data-view='mindmap'] .branch h2{color:#fff4d7;background:var(--accent);border:1px solid #d0aa5b;border-radius:8px;box-shadow:inset 0 0 0 2px #ffffff18,0 2px 0 #b18c48;padding:6px 9px;margin:0 0 7px;font-size:clamp(16px,1.5vw,20px);line-height:1.2;min-height:38px;display:flex;align-items:center}
body.retention-page[data-view='mindmap'] .branch::after{content:'';position:absolute;inset:2px;pointer-events:none;border-radius:10px;background:radial-gradient(circle at 3px 3px,#f2d58e 0 2px,transparent 3px),radial-gradient(circle at calc(100% - 3px) 3px,#f2d58e 0 2px,transparent 3px),radial-gradient(circle at 3px calc(100% - 3px),#f2d58e 0 2px,transparent 3px),radial-gradient(circle at calc(100% - 3px) calc(100% - 3px),#f2d58e 0 2px,transparent 3px)}
}
@media screen and (min-width:761px) and (max-height:800px){body.retention-page[data-view='mindmap'] .branch{padding:8px 12px}body.retention-page[data-view='mindmap'] .branch h2{min-height:32px;padding:4px 7px;font-size:17px;margin-bottom:4px}body.retention-page[data-view='mindmap'] .branch p{font-size:13px;line-height:1.25}}

@media screen{body.retention-page[data-view='mindmap'] .links path:nth-child(2),body.retention-page[data-view='mindmap'] .links path:nth-child(5){stroke-width:11}}

