/* ==========================================================================
   Feuille d'examen — reproduction du PDF « Modalités et Exemple Examen »
   Toutes les cotes sont en pt, mesurées sur le PDF original (A4 595.276 × 841.89 pt).
   Polices : TeX Gyre Pagella (= URW Palladio du sujet) et t1xtt / t1xbtt (txfonts).
   ========================================================================== */
@font-face { font-family: "Pagella"; src: url("fonts/texgyrepagella-regular.otf") format("opentype"); font-weight: 400; font-style: normal; }
@font-face { font-family: "Pagella"; src: url("fonts/texgyrepagella-bold.otf") format("opentype"); font-weight: 700; font-style: normal; }
@font-face { font-family: "Pagella"; src: url("fonts/texgyrepagella-italic.otf") format("opentype"); font-weight: 400; font-style: italic; }
@font-face { font-family: "Pagella"; src: url("fonts/texgyrepagella-bolditalic.otf") format("opentype"); font-weight: 700; font-style: italic; }
@font-face { font-family: "PagellaSl"; src: url("fonts/pagella-slanted.otf") format("opentype"); font-weight: 400; font-style: normal; }
@font-face { font-family: "HugotTT"; src: url("fonts/hugot-tt.otf") format("opentype"); font-weight: 400; }
@font-face { font-family: "HugotTT"; src: url("fonts/hugot-tt-bold.otf") format("opentype"); font-weight: 700; }

:root {
  --kw: #730000;          /* red!45!black   */
  --str: #007300;         /* green!45!black */
  --codebg: #FFFAF5;
  --codeframe: #FFF2F2;   /* red!5          */
  --serif: "Pagella", "Palatino", "Palatino Linotype", "Book Antiqua", serif;
  --tt: "HugotTT", "Menlo", monospace;
  --ui: -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
}

html, body { margin: 0; padding: 0; }
body { background: #d0d0d0; color: #000; }
[hidden] { display: none !important; }

/* ------------------------------------------------------------- la page A4 */
#pages { padding: 44px 0 30px; }
.page {
  position: relative; width: 595.276pt; height: 841.89pt; margin: 0 auto 14px;
  background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.35); overflow: hidden;
  font-family: var(--serif); font-size: 10pt; line-height: 13.15pt; color: #000;
  -webkit-font-smoothing: antialiased; font-kerning: normal; font-variant-ligatures: common-ligatures;
}
.dot { position: absolute; width: 9.84pt; height: 9.84pt; border-radius: 50%; background: #000; }
.bars { position: absolute; left: 170.76pt; }
.bars .row { display: flex; height: 9.6pt; }
.bars i { display: block; width: 9.93pt; height: 9.6pt; box-sizing: border-box; border: .45pt solid #000; margin-right: -.45pt; }
.bars i.f { background: #000; }
.amc { position: absolute; left: 384pt; top: 72.5pt; font: 10pt/10pt var(--tt); white-space: nowrap; }
.name { position: absolute; left: 42.52pt; width: 510.24pt; top: 99pt; text-align: center;
        font-size: 24.6pt; line-height: 24.6pt; font-weight: 700; white-space: nowrap; }
.consigne { position: absolute; left: 42.52pt; width: 510.24pt; top: 145.47pt; text-align: justify;
            hyphens: auto; -webkit-hyphens: auto; }
.consigne em { font-style: normal; font-family: "PagellaSl", var(--serif); }   /* \slshape (romain penché), pas italique */
.forall { position: absolute; left: 42.52pt; top: 237.18pt; white-space: nowrap; }
.pdef { position: absolute; left: 230.82pt; top: 219.54pt; width: 203.7pt; box-sizing: border-box;
        border-top: 3.1pt solid var(--codeframe); border-bottom: 2.9pt solid var(--codeframe);
        background: var(--codebg); padding: 4.16pt 0 1.56pt; font: 9pt/10.41pt var(--tt); white-space: pre; }
.col { position: absolute; width: 250.14pt; overflow: hidden; }

/* ------------------------------------------------------------- une question */
.q { margin: 0 0 9.8pt; position: relative; }
.st { overflow-wrap: break-word; }
.lab { font-weight: 700; }
/* spans « inline » (pas inline-block) : aucune coupure de ligne possible entre « Qn: », ♣ et le code */
.sp1 { padding-right: 8.8pt; }
.club { padding: 0 4pt 0 2.05pt; }
code.c.nw { white-space: pre; }   /* comme \lstinline : pas de coupure dans un code court */
.nb { white-space: nowrap; }
.post { overflow-wrap: break-word; }
.cbx { background: var(--codebg); border-top: 3pt solid var(--codeframe); border-bottom: 3pt solid var(--codeframe);
       padding: 3.2pt 0 2.5pt; margin: 1.5pt 0 2pt; font: 9pt/10.41pt var(--tt);
       white-space: pre-wrap; overflow-wrap: anywhere; }
.ans { display: flex; flex-wrap: wrap; }
.a { flex: 1 1 auto; box-sizing: border-box; padding: 0 10pt 0 16.7pt; text-indent: -16.7pt;
     min-width: 0; overflow-wrap: anywhere; cursor: pointer; user-select: none; -webkit-user-select: none; }
.bx { display: inline-block; width: 11.3pt; height: 11.3pt; box-sizing: border-box; border: .45pt solid #000;
      margin: -1.2pt 5.4pt -1.2pt 0; vertical-align: -.7pt;   /* cadre : de 9.4 pt au-dessus à 1.9 pt sous la ligne de base, sans agrandir la ligne */
      text-indent: 0; background: #fff; }
.bx.on { background: #000; }
.it { font-style: italic; }
.ro .a { cursor: default; }

/* code coloré (listings : keywordstyle red!45!black, stringstyle green!45!black) */
code.c { font-family: var(--tt); font-size: 1em; line-height: 1; white-space: pre-wrap; overflow-wrap: anywhere; } /* n'agrandit pas la ligne */
.k { color: var(--kw); font-weight: 400; }
b.k { color: var(--kw); font-weight: 700; }
.s { color: var(--str); }
.cm { color: #555; font-style: italic; }

/* correction (copie corrigée / entraînement après validation) */
.bx.good { outline: 1.5pt solid #109010; outline-offset: 1.2pt; }
.bx.bad  { outline: 1.5pt solid #d00000; outline-offset: 1.2pt; }
.pts { color: #d00000; font-weight: 700; font-family: var(--ui); font-size: 8pt; margin-left: 4pt; }
.q.clic { cursor: pointer; }

/* ------------------------------------------------------------- barre d'outils (comme une visionneuse PDF) */
.toolbar { position: fixed; top: 0; left: 0; right: 0; height: 34px; z-index: 10; display: flex; align-items: center; gap: 10px;
           padding: 0 12px; background: #ececec; border-bottom: 1px solid #b8b8b8; font: 13px var(--ui); color: #222; }
.toolbar .grow { flex: 1; }
.toolbar button, .ui button { font: 13px var(--ui); padding: 3px 10px; border: 1px solid #a8a8a8; border-radius: 4px; background: #fafafa; cursor: pointer; }
.toolbar button:hover, .ui button:hover { background: #fff; }
.toolbar button.main, .ui button.main { background: #1d5fbf; color: #fff; border-color: #1d5fbf; }
.timer { font: 600 14px var(--ui); font-variant-numeric: tabular-nums; min-width: 64px; text-align: center; }
.timer.low { color: #c00000; }

/* ------------------------------------------------------------- pages hors feuille (accueil, entraînement, corrigé) */
.ui { font-family: var(--serif); font-size: 17px; line-height: 1.45; }
#home { max-width: 760px; margin: 0 auto; padding: 36px 22px 60px; background: #fff; min-height: 100vh; box-sizing: border-box; }
#home h1 { font-size: 26px; margin: 0 0 4px; }
#home h2 { font-size: 19px; margin: 28px 0 8px; }
#home .sub { color: #444; margin: 0 0 18px; }
#home label { cursor: pointer; }
#home input[type=text] { font: 16px var(--serif); padding: 3px 6px; width: 260px; }
#home table { border-collapse: collapse; width: 100%; font-size: 15px; }
#home td, #home th { padding: 3px 8px; border-bottom: 1px solid #e3e3e3; text-align: left; }
#home th { font-weight: 700; }
#home td.n { text-align: right; font-variant-numeric: tabular-nums; }
.topics { columns: 2; column-gap: 24px; font-size: 15px; }
.topics label { display: block; break-inside: avoid; }
.small { font-size: 14px; color: #555; }

#train { padding: 50px 16px 60px; }
.sheet { background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.35); margin: 0 auto; padding: 16pt 18pt 6pt;
         font-family: var(--serif); font-size: 10pt; line-height: 13.15pt; width: 250.14pt; box-sizing: content-box; }
.sheet .q { margin-bottom: 10pt; }
.trctl { max-width: 760px; margin: 16px auto 0; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.verdict { font-weight: 700; }
.verdict.ok { color: #0b7a0b; }
.verdict.ko { color: #c00000; }
.verdict.mid { color: #b06000; }

.expl { max-width: 760px; margin: 14px auto 0; background: #fff; padding: 16px 22px; box-sizing: border-box; box-shadow: 0 1px 3px rgba(0,0,0,.25); }
.expl p { margin: 0 0 .65em; }
.expl ul, .expl ol { margin: 0 0 .65em; padding-left: 1.4em; }
.expl li { margin: .15em 0; }
.expl code.c { font-size: .95em; }
.expl pre.cb { background: var(--codebg); border-top: 3px solid var(--codeframe); border-bottom: 3px solid var(--codeframe);
               font: 14px/1.4 var(--tt); padding: 6px 4px; margin: .3em 0 .8em; white-space: pre-wrap; }
.expl .meta { font-size: 14px; color: #555; border-top: 1px solid #e4e4e4; margin-top: 10px; padding-top: 8px; }
.expl .meta code.c { font-size: 13px; }
.expl h3 { font-size: 17px; margin: 0 0 8px; }

#corrige { max-width: 800px; margin: 10px auto 60px; }
#corrige .head { background: #fff; padding: 16px 22px; box-shadow: 0 1px 3px rgba(0,0,0,.25); margin-bottom: 14px; }
#corrige .item { margin-bottom: 22px; }
#corrige .item .sheet { margin: 0; }
#corrige .item .expl { margin: 8px 0 0; max-width: none; }
.score-big { font-size: 28px; font-weight: 700; }

/* ------------------------------------------------------------- impression : exactement les pages A4 */
@media print {
  @page { size: A4; margin: 0; }
  body { background: #fff; }
  .toolbar, #home, #train, #corrige { display: none !important; }
  #pages { padding: 0; zoom: 1 !important; }
  .page { margin: 0; box-shadow: none; break-after: page; }
}

#corrige .item .sheet { zoom: 1.35; }

/* ------------------------------------------------------------- explications détaillées */
.expl h4 { font-size: 16px; margin: 18px 0 6px; padding-top: 10px; border-top: 1px solid #e4e4e4; }
.expl .notion { margin: 0 0 8px; }
.expl .notion > p { margin: 0 0 2px; }
.expl details summary { cursor: pointer; color: #1d5fbf; font-size: 14px; }
.expl details .fiche { border-left: 3px solid #d8d8d8; padding: 4px 0 2px 12px; margin: 6px 0 10px; }
.expl ul.cases { list-style: none; padding-left: 0; }
.expl ul.cases li { margin: 0 0 8px; padding: 4px 8px; border-left: 3px solid #ddd; }
.expl ul.cases li.ok { border-left-color: #2a8a2a; }
.expl ul.cases li.on.ko { border-left-color: #c00000; background: #fff4f4; }
.expl .mk { font-weight: 700; }
.expl li.ok .mk { color: #0b7a0b; }
.expl li.ko .mk { color: #c00000; }
.expl .frt { color: #555; }
.expl .you { font-size: 14px; font-weight: 700; margin-left: 6px; }
.expl .you.ok { color: #0b7a0b; }
.expl .you.ko { color: #c00000; }
.expl .why { font-size: 15px; color: #222; margin-top: 2px; }
.expl .ref { margin-top: 14px; padding: 8px 10px; background: #f3f3f3; }
table.ex, table.tb { border-collapse: collapse; margin: .3em 0 .8em; font-size: 14px; }
table.ex th, table.ex td, table.tb th, table.tb td { border: 1px solid #ddd; padding: 3px 7px; text-align: left; vertical-align: top; }
table.ex th, table.tb th { background: #f6f6f6; font-weight: 700; }
table.ex code.c.pre { white-space: pre; }
table.ex .nil { color: #888; font-style: italic; }
table.ex .err { color: #b00000; }
table.ex .msg { color: #777; font-size: 12px; }
table.ex td.note { color: #444; font-style: italic; }
#fiches { padding: 34px 0 60px; }
#fiBody { max-width: 800px; margin: 0 auto; padding: 24px 22px 40px; background: #fff; box-sizing: border-box; }
#fiBody h1 { font-size: 26px; margin: 0 0 4px; }
#fiBody h2 { font-size: 20px; margin: 30px 0 6px; padding-top: 12px; border-top: 1px solid #ddd; }
#fiBody .sub { color: #444; }
#fiBody .court { background: #f3f3f3; padding: 6px 10px; }
#fiBody pre.cb { background: var(--codebg); border-top: 3px solid var(--codeframe); border-bottom: 3px solid var(--codeframe);
                 font: 14px/1.4 var(--tt); padding: 6px 4px; white-space: pre-wrap; }
#fiBody .toc { columns: 2; column-gap: 28px; font-size: 15px; }
#fiBody code.c { font-size: .95em; }

/* ------------------------------------------------------------- téléphone */
@media (max-width: 700px) {
  .toolbar { gap: 6px; padding: 0 6px; font-size: 12px; }
  .toolbar button { padding: 3px 7px; font-size: 12px; }
  #trInfo, #exTitle { flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
  .toolbar .grow { display: none; }
  #train { padding: 44px 8px 40px; }
  .ui { font-size: 16px; }
  .expl { padding: 12px 12px; }
  table.ex { display: block; overflow-x: auto; }
}
@media (hover: none) { #train > .trctl.small { display: none; } }

/* ------------------------------------------------------------- aide-mémoire de la fonction P */
.pmemo, .ppop { background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); font-size: 15px; line-height: 1.4; }
.pmemo { max-width: 760px; margin: 0 auto 14px; padding: 10px 16px; box-sizing: border-box; }
.pmemo ul, .ppop ul { margin: 6px 0; padding-left: 1.2em; }
.pmemo li, .ppop li { margin: 2px 0; }
.pmemo p, .ppop p { margin: 4px 0 0; }
.pcode { display: inline-block; background: var(--codebg); border-top: 3px solid var(--codeframe); border-bottom: 3px solid var(--codeframe);
         font: 14px/1.35 var(--tt); white-space: pre; padding: 4px 10px 4px 4px; }
.ppop { position: fixed; top: 42px; right: 10px; z-index: 11; width: 420px; max-width: calc(100vw - 20px); padding: 10px 14px; box-sizing: border-box; }
.ppop .pclose { float: right; border: none; background: none; font-size: 22px; line-height: 1; cursor: pointer; }
@media print { .ppop { display: none !important; } }
@media (max-width: 700px) { .pmemo, .ppop { font-size: 14px; } .pcode { font-size: 12px; } }
