/* GoMathy V27 — Exercices refondus : une vraie feuille d'exercices moderne.
   Objectif : hiérarchie immédiate, peu d'éléments visuels, exercices groupés par série. */

.gm27-exercise-page{
  max-width:1040px!important;
  margin:22px auto 64px!important;
  padding:34px 42px 54px!important;
  border:1px solid #e6e8ec!important;
  border-radius:24px!important;
  background:#fff!important;
  box-shadow:0 18px 48px rgba(15,23,42,.07)!important;
}

.gm27-exercise-page .gm-ex76-back{
  margin:0 0 22px!important;
  padding:0!important;
  color:#64748b!important;
  font-size:.82rem!important;
  font-weight:720!important;
}
.gm27-exercise-page .gm-ex76-back:hover{color:#0f172a!important}

.gm27-exercise-head{
  margin:0 0 36px!important;
  padding:0 0 26px!important;
  border-bottom:1px solid #e9edf2!important;
}
.gm27-exercise-head .gm19-exercise-head__title p{
  margin:0 0 7px!important;
  color:#60758d!important;
  font-family:system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif!important;
  font-size:.72rem!important;
  font-weight:850!important;
  letter-spacing:.09em!important;
  text-transform:uppercase!important;
}
.gm27-exercise-head .gm19-exercise-head__title h2{
  max-width:880px!important;
  margin:0!important;
  color:#10213a!important;
  font-family:Georgia,"Times New Roman",serif!important;
  font-size:clamp(2rem,4vw,2.7rem)!important;
  font-weight:800!important;
  line-height:1.08!important;
  letter-spacing:-.025em!important;
}
.gm27-exercise-head .gm19-exercise-head__title>span,
.gm27-exercise-head .gm19-exercise-head__title small,
.gm27-exercise-head .gm19-exercise-head__stats,
.gm27-exercise-page .gm19-path,
.gm27-exercise-page .gm-ex76-filters{display:none!important}

.gm27-stage-list{display:grid!important;gap:34px!important}
.gm27-stage{
  margin:0!important;
  padding:0!important;
  border:0!important;
  background:transparent!important;
  box-shadow:none!important;
}

/* Intertitre de série : repère visuel sans ajouter un gros bandeau. */
.gm27-stage__head,
.gm19-stage--essentiel .gm27-stage__head,
.gm19-stage--application .gm27-stage__head,
.gm19-stage--raisonnement .gm27-stage__head,
.gm19-stage--defi .gm27-stage__head,
.gm19-stage--bilan .gm27-stage__head{
  display:flex!important;
  align-items:center!important;
  margin:0 0 14px!important;
  padding:0!important;
  border:0!important;
  border-left:0!important;
  background:transparent!important;
}
.gm27-stage__head .gm19-stage__identity{
  display:flex!important;
  align-items:center!important;
  gap:10px!important;
}
.gm27-stage__head .gm19-stage__icon{
  display:grid!important;
  place-items:center!important;
  width:34px!important;
  height:34px!important;
  flex:0 0 34px!important;
  border-radius:10px!important;
  background:#eff5f2!important;
  font-size:.95rem!important;
}
.gm19-stage--application .gm27-stage__head .gm19-stage__icon{background:#eef4fb!important}
.gm19-stage--raisonnement .gm27-stage__head .gm19-stage__icon{background:#f3f0fa!important}
.gm19-stage--defi .gm27-stage__head .gm19-stage__icon{background:#fbf3e8!important}
.gm19-stage--bilan .gm27-stage__head .gm19-stage__icon{background:#fbf7df!important}
.gm27-stage__head .gm19-stage__identity>div>p,
.gm27-stage__head .gm19-stage__identity>div>div,
.gm27-stage__head .gm19-stage__stats{display:none!important}
.gm27-stage__head .gm19-stage__identity h3{
  margin:0!important;
  color:#24364d!important;
  font-family:system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif!important;
  font-size:1rem!important;
  font-weight:820!important;
  line-height:1.3!important;
}

.gm27-stage__list{display:grid!important;gap:14px!important}

/* Une série = un exercice. Les sous-questions restent ensemble, comme sur une vraie feuille. */
.gm27-exercise{
  overflow:hidden!important;
  border:1px solid #e2e8f0!important;
  border-radius:16px!important;
  background:#fff!important;
  box-shadow:0 4px 16px rgba(15,23,42,.035)!important;
}
.gm27-exercise__head{
  display:flex!important;
  align-items:center!important;
  gap:12px!important;
  padding:15px 20px 12px!important;
  border-bottom:1px solid #edf0f4!important;
  background:#fbfcfd!important;
}
.gm27-exercise__number{
  flex:0 0 auto!important;
  padding:5px 9px!important;
  border-radius:7px!important;
  background:#eaf5ef!important;
  color:#176447!important;
  font-family:system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif!important;
  font-size:.76rem!important;
  font-weight:850!important;
  line-height:1.2!important;
}
.gm19-stage--application .gm27-exercise__number{background:#edf4fb!important;color:#245b8c!important}
.gm19-stage--raisonnement .gm27-exercise__number{background:#f2eff9!important;color:#5a4a85!important}
.gm19-stage--defi .gm27-exercise__number{background:#fbf2e5!important;color:#8a5a20!important}
.gm19-stage--bilan .gm27-exercise__number{background:#fbf6dd!important;color:#806b13!important}
.gm27-exercise__head h4{
  margin:0!important;
  min-width:0!important;
  color:#2c3d52!important;
  font-family:system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif!important;
  font-size:.9rem!important;
  font-weight:760!important;
  line-height:1.35!important;
}

.gm27-exercise__body{
  padding:22px 22px 20px!important;
  color:#152238!important;
  font-family:system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif!important;
  font-size:1rem!important;
  line-height:1.72!important;
}
.gm27-exercise__statement{min-width:0!important}
.gm27-exercise__statement> :first-child{margin-top:0!important}
.gm27-exercise__statement> :last-child{margin-bottom:0!important}
.gm27-exercise__statement p{margin:.5rem 0!important}

.gm27-exercise__parts{
  display:grid!important;
  gap:13px!important;
  margin:0!important;
  padding:0!important;
  list-style:none!important;
  counter-reset:gm27part!important;
}
.gm27-exercise__parts>li{
  counter-increment:gm27part!important;
  display:grid!important;
  grid-template-columns:28px minmax(0,1fr)!important;
  gap:10px!important;
  align-items:start!important;
  margin:0!important;
  padding:0!important;
}
.gm27-exercise__parts>li::before{
  content:counter(gm27part) "."!important;
  color:#60758d!important;
  font-weight:800!important;
  line-height:1.72!important;
  text-align:right!important;
}

.gm27-exercise__body .katex-display,
.gm27-exercise__body .MathJax_Display,
.gm27-exercise__body mjx-container[display="true"]{
  margin:.95rem 0!important;
  overflow-x:auto!important;
  overflow-y:hidden!important;
}
.gm27-exercise__body img,
.gm27-exercise__body svg{max-width:100%!important;height:auto!important}
.gm27-exercise__body table{max-width:100%!important;margin:.9rem 0!important;border-collapse:collapse!important}

/* Une ligne d'actions très simple : uniquement indice(s) et correction. */
.gm27-exercise__actions{
  display:flex!important;
  align-items:flex-start!important;
  gap:8px!important;
  flex-wrap:wrap!important;
  padding:0 22px 20px!important;
}
.gm27-help,
.gm27-correction{
  margin:0!important;
  padding:0!important;
  border:0!important;
  background:transparent!important;
}
.gm27-help>summary,
.gm27-correction>summary{
  list-style:none!important;
  display:inline-flex!important;
  align-items:center!important;
  justify-content:center!important;
  min-height:32px!important;
  padding:6px 10px!important;
  border-radius:8px!important;
  font-family:system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif!important;
  font-size:.78rem!important;
  font-weight:780!important;
  line-height:1.2!important;
  cursor:pointer!important;
  user-select:none!important;
}
.gm27-help>summary::-webkit-details-marker,
.gm27-correction>summary::-webkit-details-marker{display:none!important}
.gm27-help>summary{
  border:1px solid #d9e1ea!important;
  background:#fff!important;
  color:#5b6b7f!important;
}
.gm27-help>summary::before{content:"💡";margin-right:6px;font-size:.78rem!important}
.gm27-help>summary:hover{background:#f8fafc!important;color:#24364d!important}
.gm27-correction>summary{
  border:1px solid #b9d7c7!important;
  background:#f4faf7!important;
  color:#176447!important;
}
.gm27-correction>summary::before{content:"✓";margin-right:6px;font-weight:900!important}
.gm27-correction>summary:hover{background:#eaf5ef!important}

/* Quand un détail est ouvert, il prend toute la largeur sous les boutons. */
.gm27-help[open],
.gm27-correction[open]{flex:1 0 100%!important;width:100%!important}
.gm27-help[open]>summary,
.gm27-correction[open]>summary{margin-bottom:9px!important}
.gm27-help__body,
.gm27-correction__body{
  display:grid!important;
  gap:9px!important;
  width:100%!important;
  padding:13px 15px!important;
  border-radius:10px!important;
  font-family:system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif!important;
  font-size:.88rem!important;
  line-height:1.62!important;
}
.gm27-help__body{
  border:1px solid #e4eaf0!important;
  background:#f8fafc!important;
  color:#475569!important;
}
.gm27-correction__body{
  border:1px solid #d8e9df!important;
  background:#f7fbf8!important;
  color:#27364a!important;
}
.gm27-help__row,
.gm27-correction__row{
  display:grid!important;
  grid-template-columns:auto minmax(0,1fr)!important;
  gap:9px!important;
  align-items:start!important;
}
.gm27-help__row>span,
.gm27-correction__row>span{
  display:grid!important;
  place-items:center!important;
  width:23px!important;
  height:23px!important;
  border-radius:7px!important;
  background:#fff!important;
  color:#5d7189!important;
  border:1px solid #dbe3eb!important;
  font-size:.72rem!important;
  font-weight:850!important;
}
.gm27-correction__row>span{color:#176447!important;border-color:#cde2d5!important}
.gm27-help__row:only-child,
.gm27-correction__row:only-child{grid-template-columns:1fr!important}
.gm27-help__row:only-child>span,
.gm27-correction__row:only-child>span{display:none!important}

/* Neutraliser les anciennes cartes de correction si elles se trouvent dans une réponse. */
.gm27-correction__body :is(.gm-v104-correction,.gm-v109-correction,.gm19-premium-correction){display:block!important}
.gm27-correction__body :is(.gm-v104-correction__row,.gm-v109-correction>div,.gm19-premium-correction>div){
  display:block!important;
  margin:.35rem 0!important;
  padding:0!important;
  border:0!important;
  border-radius:0!important;
  background:transparent!important;
}

/* Le reste de la page d'exercices ne doit pas réapparaître à cause des anciennes couches CSS. */
.gm27-exercise-page .gm19-question-grid,
.gm27-exercise-page .gm19-question{display:none!important}

@media(max-width:760px){
  .gm27-exercise-page{
    margin:8px auto 38px!important;
    padding:24px 16px 38px!important;
    border-radius:18px!important;
  }
  .gm27-exercise-head{margin-bottom:28px!important;padding-bottom:20px!important}
  .gm27-exercise-head .gm19-exercise-head__title h2{font-size:clamp(1.75rem,8vw,2.2rem)!important}
  .gm27-stage-list{gap:28px!important}
  .gm27-exercise__head{align-items:flex-start!important;flex-direction:column!important;gap:7px!important;padding:13px 15px 11px!important}
  .gm27-exercise__body{padding:18px 16px 16px!important;font-size:.97rem!important;line-height:1.68!important}
  .gm27-exercise__actions{padding:0 16px 17px!important}
  .gm27-exercise__parts>li{grid-template-columns:24px minmax(0,1fr)!important;gap:8px!important}
}

@media(prefers-reduced-motion:reduce){
  .gm27-exercise-page *{scroll-behavior:auto!important}
}
