/* ✅ STOP unwanted global horizontal scrollbar */
  html, body { max-width:100%; overflow-x:hidden; }

  /* Shared chapter hero aligned with cours reference style */
  .lx-chapter-hero{
    border:1px solid rgba(2,6,23,.08);
    border-radius:16px;
    background:rgba(37,99,235,.06);
    padding:14px 16px;
    box-shadow:0 1px 0 rgba(2,6,23,.03);
    margin-bottom:14px;
  }
  .lx-chapter-hero .lx-title{
    font-size:inherit;
    font-weight:900;
    color:#0f172a;
    margin:0 0 .35rem;
    line-height:1.18;
  }
  .lx-chapter-hero .lx-sub{
    max-width:76ch;
    color:#64748b;
    font-size:.95rem;
    margin-top:-2px;
    line-height:1.4;
  }
  .lx-chapter-hero .lx-row{
    display:flex;
    flex-wrap:wrap;
    align-items:center;
    min-width:0;
  }
  .lx-chapter-hero .lx-gap{gap:.5rem}
  .lx-chapter-hero .lx-btn{
    display:inline-flex;
    align-items:center;
    gap:.45rem;
    padding:.45rem .7rem;
    border-radius:999px;
    border:1px solid rgba(2,6,23,.12);
    background:#fff;
    color:#0f172a;
    text-decoration:none;
    font-weight:700;
    font-size:.92rem;
    line-height:1.2;
    box-shadow:none;
  }
  .lx-chapter-hero .lx-btn:hover{border-color:rgba(37,99,235,.45);color:#0f172a}

  /* Tabs style */
  .lx-tabrow{display:flex;flex-wrap:wrap;gap:.5rem}
  .lx-tabbtn{
    display:inline-flex;align-items:center;gap:.55rem;
    padding:.45rem .7rem;border-radius:999px;
    border:1px solid rgba(2,6,23,.14);
    background:#fff;color:#0f172a;text-decoration:none;
    font-weight:700;
    font-size:.92rem;
    line-height:1.2;
    transition:.15s ease;
  }
  .lx-tabbtn:hover{border-color:rgba(37,99,235,.45);transform:translateY(-1px)}
  .lx-tabbtn.is-active{
    border-color:rgba(37,99,235,.60);
    box-shadow:0 0 0 .22rem rgba(37,99,235,.10);
  }
  .lx-ico{width:1.2rem;display:inline-flex;justify-content:center}
  .lx-breadcrumbs{
    display:flex;flex-wrap:wrap;gap:.45rem;align-items:center;
    margin-bottom:.8rem;font-size:.9rem;color:#64748b
  }
  .lx-breadcrumbs a{color:#2563eb;text-decoration:none}
  .lx-breadcrumbs a:hover{text-decoration:underline}
  .lx-linkrow{display:flex;flex-wrap:wrap;gap:.7rem}
  .lx-linkpill{
    display:inline-flex;align-items:center;gap:.5rem;
    padding:.45rem .7rem;border-radius:999px;
    border:1px solid rgba(2,6,23,.12);background:#fff;
    color:#0f172a;text-decoration:none;font-weight:700;font-size:.92rem
  }
  .lx-linkpill:hover{border-color:rgba(37,99,235,.45);color:#0f172a}

  /* ✅ NO repeated title:
     Your partials (like _cours) start with:
       <div class="lx-wrap"> <div class="lx-box lx-soft"> ...title...
     We keep them unchanged but hide THAT first header only inside this shell.
  */
  .lx-partial-scope > .lx-wrap > .lx-box:first-of-type{
    display:none !important;
  }

  /* Mobile-safe rich content from chapter partials */
  .lx-partial-scope,
  .lx-partial-scope *{
    box-sizing:border-box;
  }
  .lx-partial-scope{
    max-width:100%;
    overflow-x:clip;
  }
  .lx-partial-scope .lx-wrap,
  .lx-partial-scope .container,
  .lx-partial-scope .container-fluid,
  .lx-partial-scope .mx-auto,
  .lx-partial-scope .lx-box,
  .lx-partial-scope .lx-card,
  .lx-partial-scope .lx-soft,
  .lx-partial-scope .lx-callout,
  .lx-partial-scope .lx-good,
  .lx-partial-scope .lx-warn,
  .lx-partial-scope .card,
  .lx-partial-scope .card-body,
  .lx-partial-scope .bg-light,
  .lx-partial-scope .bg-success,
  .lx-partial-scope .lx-grid,
  .lx-partial-scope .grid,
  .lx-partial-scope .row,
  .lx-partial-scope [class*="col-"],
  .lx-partial-scope .lx-figure,
  .lx-partial-scope .lx-graph,
  .lx-partial-scope details{
    max-width:100%;
    min-width:0;
  }
  .lx-partial-scope .lx-card,
  .lx-partial-scope .lx-callout,
  .lx-partial-scope .lx-good,
  .lx-partial-scope .lx-warn,
  .lx-partial-scope .card,
  .lx-partial-scope .card-body,
  .lx-partial-scope li,
  .lx-partial-scope p{
    overflow-wrap:break-word;
  }
  .lx-partial-scope .lx-table-wrap,
  .lx-partial-scope .table-responsive,
  .lx-partial-scope .lx-table-scroll{
    max-width:100%;
    overflow-x:auto;
    -webkit-overflow-scrolling:touch;
  }
  .lx-partial-scope .lx-table,
  .lx-partial-scope .table,
  .lx-partial-scope .tbl,
  .lx-partial-scope .sign-table,
  .lx-partial-scope .var-table,
  .lx-partial-scope .tv-table,
  .lx-partial-scope table{
    max-width:100%;
  }
  .lx-partial-scope img,
  .lx-partial-scope svg,
  .lx-partial-scope canvas,
  .lx-partial-scope iframe{
    max-width:100%;
    height:auto;
  }

  @media (max-width: 900px){
    .lx-chapter-hero{
      grid-template-columns:1fr;
    }
    .lx-chapter-hero-side{
      justify-self:stretch;
    }
  }
  @media (max-width: 576px){
    .lx-chapter-hero{
      padding:.85rem;
    }
    .lx-chapter-hero .lx-title{
      font-size:1.28rem;
    }
    .lx-chapter-hero .lx-seo-intro{
      font-size:.95rem;
    }
    .lx-chapter-hero-side .lx-tabrow,
    .lx-chapter-hero-side .lx-linkrow{
      grid-template-columns:1fr 1fr;
    }
    .lx-tabbtn,
    .lx-linkpill{
      padding:.5rem .65rem;
      font-size:.92rem;
    }
    .lx-partial-scope .lx-wrap{
      width:100%;
      max-width:100%;
      padding-left:0;
      padding-right:0;
    }
    .lx-partial-scope .container,
    .lx-partial-scope .container-fluid,
    .lx-partial-scope .mx-auto{
      width:100%;
      max-width:100%;
      padding-left:0;
      padding-right:0;
    }
    .lx-partial-scope .lx-box{
      padding:12px;
    }
    .lx-partial-scope .lx-card,
    .lx-partial-scope .card-body{
      padding:10px 12px;
    }
    .lx-partial-scope .d-flex{
      min-width:0;
    }
    .lx-partial-scope .d-flex.justify-content-between,
    .lx-partial-scope .lx-exo-head,
    .lx-partial-scope .lx-actions{
      flex-wrap:wrap;
    }
    .lx-partial-scope .lx-grid,
    .lx-partial-scope .grid{
      grid-template-columns:1fr !important;
      max-width:100%;
      min-width:0;
    }
    .lx-partial-scope .lx-grid > *,
    .lx-partial-scope .grid > *,
    .lx-partial-scope .row > *,
    .lx-partial-scope [class*="col-"]{
      min-width:0 !important;
      max-width:100%;
    }
    .lx-partial-scope .badge{
      white-space:normal;
      text-align:center;
    }
    .lx-partial-scope ol,
    .lx-partial-scope ul{
      padding-left:1.15rem;
    }
    .lx-partial-scope .lx-table-wrap,
    .lx-partial-scope .table-responsive,
    .lx-partial-scope .lx-table-scroll,
    .lx-partial-scope .lx-figure,
    .lx-partial-scope .lx-graph{
      max-width:100%;
      overflow-x:auto !important;
      overflow-y:hidden;
      -webkit-overflow-scrolling:touch;
    }
    .lx-partial-scope .lx-table,
    .lx-partial-scope .table,
    .lx-partial-scope .tbl,
    .lx-partial-scope .sign-table,
    .lx-partial-scope .var-table,
    .lx-partial-scope .tv-table,
    .lx-partial-scope table{
      display:block;
      width:100%;
      max-width:100%;
      min-width:0 !important;
      overflow-x:auto !important;
      overflow-y:hidden;
      -webkit-overflow-scrolling:touch;
      white-space:nowrap;
    }
    .lx-partial-scope .lx-table th,
    .lx-partial-scope .lx-table td,
    .lx-partial-scope .table th,
    .lx-partial-scope .table td,
    .lx-partial-scope .tbl th,
    .lx-partial-scope .tbl td,
    .lx-partial-scope .sign-table th,
    .lx-partial-scope .sign-table td,
    .lx-partial-scope .var-table th,
    .lx-partial-scope .var-table td,
    .lx-partial-scope .tv-table th,
    .lx-partial-scope .tv-table td,
    .lx-partial-scope table th,
    .lx-partial-scope table td{
      white-space:nowrap;
    }
    .lx-partial-scope mjx-container{
      max-width:100%;
      overflow-x:auto;
      overflow-y:hidden;
      -webkit-overflow-scrolling:touch;
    }
    .lx-partial-scope img,
    .lx-partial-scope svg,
    .lx-partial-scope canvas,
    .lx-partial-scope iframe{
      max-width:100% !important;
      min-width:0 !important;
      height:auto;
    }
    .lx-partial-scope [style*="min-width"]{
      min-width:0 !important;
    }
    .lx-partial-scope [style*="max-width"]{
      max-width:100% !important;
    }
  }

  /* ✅ MathJax overflow: only DISPLAY math scrolls if needed (no ugly bar) */
  .lx-partial-scope mjx-container[display="true"]{
    display:block;
    max-width:100%;
    overflow-x:auto;
    overflow-y:hidden;
    -webkit-overflow-scrolling:touch;
    scrollbar-width:none;
  }
  .lx-partial-scope mjx-container[display="true"]::-webkit-scrollbar{ height:0; }

  /* ✅ Code blocks can overflow => contain them */
  .lx-partial-scope .lx-code,
  .lx-partial-scope pre{ max-width:100%; overflow:auto; }

  .lx-cb{display:inline-flex;gap:.5rem;align-items:center;margin-right:1rem}
  .lx-row{display:flex;gap:.6rem;flex-wrap:wrap;align-items:center}
  .lx-progress-status{min-height:1.25rem;margin-top:.45rem}
  .lx-progress-status.is-saving{color:#b45309 !important}
  .lx-progress-status.is-saved{color:#15803d !important;font-weight:700}
  .lx-progress-status.is-error{color:#b91c1c !important;font-weight:700}
  .lx-input{
    padding:.4rem .6rem;border-radius:.5rem;border:1px solid rgba(2,6,23,.12);min-width:120px
  }
  .lx-btn{
    padding:.45rem .9rem;border-radius:999px;border:1px solid rgba(2,6,23,.2);
    background:#fff;color:#0f172a;font-weight:700;text-decoration:none
  }
  .lx-btn:hover{border-color:rgba(37,99,235,.45)}
  .lx-btn-outline{background:transparent}
