
:root{
  --ink:#10234f;
  --ink2:#4c5d7b;
  --paper:#ffffff;
  --bg:#f7faff;
  --line:#e2e8f3;
  --blue:#2c7df3;
  --blue-soft:#eaf3ff;
  --orange:#ff7a24;
  --orange-soft:#fff1e6;
  --green:#18a05e;
  --green-soft:#e7f7ee;
  --purple:#7b58db;
  --purple-soft:#f0eaff;
  --pink:#ef5ea8;
  --pink-soft:#ffe8f4;
  --yellow:#f8b933;
  --shadow:0 16px 40px rgba(26,48,89,.10);
  --radius:28px;
}
*{box-sizing:border-box}
body.manga-page{
  margin:0;
  font-family:"Trebuchet MS","Segoe UI",Arial,sans-serif;
  color:var(--ink);
  background:
    radial-gradient(circle at 10% 10%, rgba(255,184,82,.08) 0 90px, transparent 92px),
    radial-gradient(circle at 92% 22%, rgba(71,122,255,.08) 0 120px, transparent 122px),
    var(--bg);
}
a{text-decoration:none;color:inherit}
img{display:block;max-width:100%}
.mg-header{
  position:sticky;top:0;z-index:60;
  background:rgba(255,255,255,.95);
  backdrop-filter:blur(14px);
  border-bottom:1px solid rgba(16,35,79,.08)
}
.mg-header .inner{
  max-width:1480px;margin:auto;padding:12px 22px;
  display:grid;grid-template-columns:auto 1fr auto;gap:22px;align-items:center
}
.brand{
  display:flex;align-items:center;gap:10px;font-size:22px;font-weight:1000
}
.brand .badge{
  width:42px;height:42px;border-radius:15px;background:linear-gradient(145deg,#2f8cff,#165ad8);
  color:#fff;display:grid;place-items:center;box-shadow:0 8px 18px rgba(40,125,242,.25)
}
.topnav{display:flex;justify-content:center;gap:4px;flex-wrap:wrap}
.topnav a{
  padding:10px 13px;border-radius:13px;font-weight:900;color:#41506f
}
.topnav a.active,.topnav a:hover{background:#eef4ff;color:#1769d7}
.header-actions{display:flex;align-items:center;gap:10px}
.search{position:relative;min-width:260px}
.search input{
  width:100%;padding:11px 40px 11px 16px;border-radius:999px;border:1px solid #d9e2f0;background:#fff;
  outline:none;color:var(--ink)
}
.search button{
  position:absolute;right:5px;top:5px;border:0;border-radius:50%;width:32px;height:32px;background:#12274f;color:#fff
}
.mini-btn{
  padding:10px 13px;border-radius:13px;border:1px solid #d9e2f0;background:#fff;color:#1e56ae;font-weight:1000
}
.page{max-width:1480px;margin:auto;padding:24px 22px 56px}
.panel{
  background:#fff;border:1px solid var(--line);border-radius:var(--radius);box-shadow:var(--shadow)
}
.section-title{margin:0 0 10px;font-size:44px;letter-spacing:-2px}
.section-sub{margin:0;color:#5f6d85;font-size:18px;line-height:1.5}
.tag{
  display:inline-flex;align-items:center;gap:8px;padding:9px 15px;border-radius:999px;
  background:#eef0ff;color:#4048b8;font-weight:1000;font-size:14px
}
.page-head{
  padding:28px 30px;margin-bottom:22px;
  background:linear-gradient(135deg,#ffffff 0%,#ffffff 70%,#edf5ff 100%);
  position:relative;overflow:hidden
}
.page-head:after{
  content:"";position:absolute;right:-30px;top:-20px;width:180px;height:180px;border-radius:50%;
  background:radial-gradient(circle,rgba(255,122,36,.12),transparent 66%);
}
.grid-subjects{
  display:grid;grid-template-columns:repeat(6,1fr);gap:16px
}
.subject-card{
  background:#fff;border:1px solid var(--line);border-radius:24px;overflow:hidden;
  box-shadow:0 10px 26px rgba(28,45,78,.07);transition:.18s
}
.subject-card:hover{transform:translateY(-4px);box-shadow:0 18px 36px rgba(28,45,78,.12)}
.subject-card img{width:100%;height:138px;object-fit:cover}
.subject-card .body{padding:12px 14px 16px}
.subject-card h3{margin:0 0 7px;font-size:22px;letter-spacing:-.6px}
.subject-card p{margin:0;color:#66748c;line-height:1.4;font-size:14px}
.quick-grid{display:grid;grid-template-columns:repeat(4,1fr);gap:16px}
.quick-card{
  padding:18px;border-radius:23px;border:1px solid var(--line);background:#fff;box-shadow:0 10px 26px rgba(28,45,78,.07)
}
.quick-card h3{margin:0 0 8px;font-size:22px}
.quick-card p{margin:0;color:#66748c;line-height:1.45}
.quick-card .btn{
  margin-top:14px;display:inline-flex;padding:10px 14px;border-radius:14px;font-weight:1000
}
.btn-blue{background:#eaf3ff;color:#1769d7}
.btn-green{background:#e8f7ee;color:#14874f}
.btn-orange{background:#fff1e6;color:#d66a0d}
.btn-purple{background:#f0eaff;color:#6e41c5}

.list-table{
  width:100%;border-collapse:separate;border-spacing:0;background:#fff;border:1px solid var(--line);
  border-radius:24px;overflow:hidden;box-shadow:0 10px 26px rgba(28,45,78,.07)
}
.list-table th,.list-table td{padding:15px 16px;text-align:left;border-bottom:1px solid var(--line)}
.list-table th{background:#f7faff;font-size:14px;color:#607089}
.list-table tr:last-child td{border-bottom:0}

.lesson-shell{
  display:grid;grid-template-columns:1.15fr .85fr;gap:18px
}
.lesson-panel,.side-panel{
  background:#fff;border:1px solid var(--line);border-radius:26px;box-shadow:0 12px 30px rgba(28,45,78,.08)
}
.lesson-panel{padding:22px}
.side-panel{padding:20px}
.lesson-hero{
  display:grid;grid-template-columns:.95fr 1.05fr;align-items:center;gap:14px;overflow:hidden;border-radius:24px;
  background:linear-gradient(135deg,#fff7fb 0%, #fffdf6 100%);border:1px solid #f0e5ef;padding:14px;margin-bottom:18px
}
.lesson-hero img{width:100%;height:100%;object-fit:cover;border-radius:18px}
.lesson-hero h2{margin:0 0 10px;font-size:34px;letter-spacing:-1px}
.lesson-hero p{margin:0;color:#5e6d86;line-height:1.45}
.strip{display:flex;gap:10px;flex-wrap:wrap;margin-top:12px}
.strip span{padding:8px 11px;border-radius:999px;font-weight:900;font-size:13px}
.strip span:nth-child(1){background:#eaf3ff;color:#1769d7}
.strip span:nth-child(2){background:#e8f7ee;color:#14874f}
.strip span:nth-child(3){background:#fff1e6;color:#d66a0d}
.strip span:nth-child(4){background:#f0eaff;color:#6e41c5}
.media-grid{display:grid;grid-template-columns:1fr 1fr;gap:16px}
.media-card,.tool-card{
  border:1px solid var(--line);border-radius:22px;padding:14px;background:#fff
}
.media-card h3,.tool-card h3{margin:0 0 10px;font-size:22px}
.media-card .thumb{height:220px;border-radius:18px;overflow:hidden;background:#eef3fb}
.media-card .thumb img{width:100%;height:100%;object-fit:cover}
.exercise-box{
  border:1px solid var(--line);border-radius:20px;padding:16px;background:#fbfefb
}
.exercise-answers{display:flex;gap:10px;flex-wrap:wrap;margin-top:14px}
.exercise-answers button{
  border:1px solid #d7e3d7;background:#fff;padding:10px 14px;border-radius:12px;font-weight:1000;color:#174f29
}
.side-tools{display:grid;gap:12px}
.side-tools a{
  display:flex;justify-content:space-between;align-items:center;padding:16px;border-radius:18px;font-weight:1000
}
.side-tools a:nth-child(1){background:#fff0f4;color:#d33f7d}
.side-tools a:nth-child(2){background:#f0eaff;color:#6f42c7}
.side-tools a:nth-child(3){background:#e8f8ef;color:#14874f}
.side-tools a:nth-child(4){background:#fff4df;color:#c87900}
.side-tools a:nth-child(5){background:#eaf3ff;color:#1769d7}
.msg-layout{display:grid;grid-template-columns:320px 1fr;gap:16px}
.threads,.chat{background:#fff;border:1px solid var(--line);border-radius:24px;box-shadow:0 10px 26px rgba(28,45,78,.07)}
.thread{padding:14px 16px;border-bottom:1px solid var(--line)}
.thread:last-child{border-bottom:0}
.thread strong{display:block}
.thread span{color:#66748c;font-size:14px}
.chat-body{height:420px;overflow:auto;padding:18px}
.bubble{max-width:72%;padding:12px 14px;border-radius:16px;margin:10px 0;background:#f4f7fd}
.bubble.me{margin-left:auto;background:#eaf3ff}
.chat-input{display:flex;gap:10px;padding:14px;border-top:1px solid var(--line)}
.chat-input input{flex:1;border:1px solid #d9e2f0;border-radius:14px;padding:12px}
.chat-input button{border:0;border-radius:14px;background:#1769d7;color:#fff;padding:12px 16px;font-weight:1000}
.footer-note{margin-top:28px;color:#7a869b;text-align:center}
@media(max-width:1200px){
  .grid-subjects{grid-template-columns:repeat(4,1fr)}
  .quick-grid{grid-template-columns:repeat(2,1fr)}
}
@media(max-width:980px){
  .mg-header .inner{grid-template-columns:1fr auto}
  .topnav{display:none}
  .header-actions{grid-column:1/-1}
  .lesson-shell,.lesson-hero,.msg-layout{grid-template-columns:1fr}
}
@media(max-width:700px){
  .page{padding:16px 12px 40px}
  .grid-subjects{grid-template-columns:repeat(2,1fr)}
  .quick-grid{grid-template-columns:1fr}
  .section-title{font-size:34px}
  .page-head{padding:22px 18px}
  .search{min-width:0}
  .header-actions{display:grid;grid-template-columns:1fr 1fr}.search{grid-column:1/-1}
}


/* --- V2.2 : matières en style manga plus marqué --- */
.grid-subjects{gap:18px !important}
.subject-card{
  border:2px solid #e6ebf4 !important;
  box-shadow:0 12px 28px rgba(28,45,78,.08) !important;
}
.subject-card img{
  height:165px !important;
  background:linear-gradient(135deg,#edf5ff,#fff4ea);
}
.subject-card .body{padding:14px 14px 16px !important}
.subject-card h3{font-size:21px !important;margin-bottom:4px !important}
.subject-card p{font-size:13px !important;color:#64738c !important}
.subject-card::before{
  content:"";
  position:absolute;
  right:15px; top:16px;
  width:34px;height:10px;border-radius:999px;
  background:rgba(255,255,255,.74);
  box-shadow:0 15px 0 rgba(255,255,255,.54);
}
.subject-card:nth-child(6n+1) img{background:linear-gradient(135deg,#eef4ff,#eaf7ff)}
.subject-card:nth-child(6n+2) img{background:linear-gradient(135deg,#edf8ff,#eef8f2)}
.subject-card:nth-child(6n+3) img{background:linear-gradient(135deg,#fff6e8,#fff1e6)}
.subject-card:nth-child(6n+4) img{background:linear-gradient(135deg,#ecfbff,#eef5ff)}
.subject-card:nth-child(6n+5) img{background:linear-gradient(135deg,#f8f0ff,#fff2f8)}
.subject-card:nth-child(6n+6) img{background:linear-gradient(135deg,#eefdf2,#edf9ff)}


/* V2.3 - matières manga HD et pages de chapitres */
.subject-card{position:relative}
.subject-card img{
  height:175px !important;
  object-fit:cover !important;
  object-position:center !important;
}
.subject-card .body{background:#fff}
.subject-card .body h3{color:var(--ink)}
.subject-card .body p{min-height:38px}

.subject-hero{
  display:grid;
  grid-template-columns:1.05fr .95fr;
  gap:22px;
  align-items:center;
  padding:28px;
  margin-bottom:22px;
  overflow:hidden;
  position:relative;
  background:linear-gradient(135deg,#fff 0%,#fff 60%,#edf5ff 100%);
}
.subject-hero-copy{position:relative;z-index:2}
.subject-hero-image{
  height:310px;border-radius:24px;overflow:hidden;border:1px solid var(--line);
  box-shadow:0 14px 32px rgba(28,45,78,.12);
}
.subject-hero-image img{width:100%;height:100%;object-fit:cover}
.subject-hero h1{margin:12px 0 8px;font-size:48px;letter-spacing:-2px}
.subject-hero p{font-size:18px;color:#5f6d85;line-height:1.5;margin:0}
.breadcrumb{display:flex;gap:8px;flex-wrap:wrap;font-size:14px;font-weight:900;color:#55709d}
.breadcrumb a{color:#1769d7}
.chapter-grid{
  display:grid;grid-template-columns:repeat(2,1fr);gap:18px
}
.chapter-card{
  background:#fff;border:1px solid var(--line);border-radius:25px;padding:20px;
  box-shadow:0 10px 28px rgba(28,45,78,.07)
}
.chapter-card h2{margin:0 0 14px;font-size:25px;letter-spacing:-.8px}
.lesson-list{display:grid;gap:9px}
.lesson-link{
  display:flex;align-items:center;justify-content:space-between;gap:12px;
  padding:12px 14px;border-radius:15px;background:#f7faff;border:1px solid #e8edf5;
  font-weight:800;color:#344968;transition:.17s
}
.lesson-link:hover{background:#eaf3ff;color:#1769d7;transform:translateX(3px)}
.lesson-link.ready{background:#e8f8ef;color:#117c49;border-color:#d2efdf}
.lesson-link small{
  font-weight:800;color:#7b879b;white-space:nowrap
}
.subject-nav{
  display:flex;gap:10px;flex-wrap:wrap;margin:0 0 20px
}
.subject-nav a{
  padding:9px 12px;border-radius:999px;background:#fff;border:1px solid var(--line);
  font-size:13px;font-weight:900;color:#51617d
}
.subject-nav a:hover{background:#eaf3ff;color:#1769d7}
@media(max-width:900px){
  .subject-hero{grid-template-columns:1fr}
  .subject-hero-image{height:260px}
  .chapter-grid{grid-template-columns:1fr}
}


/* ===================== V2.7 fix cartes matières internes ===================== */
.grid-subjects{
  align-items:stretch !important;
}
.subject-card{
  display:flex !important;
  flex-direction:column !important;
  min-width:0 !important;
  overflow:hidden !important;
  isolation:isolate;
  contain:layout paint;
}
.subject-thumb{
  display:block;
  position:relative;
  width:100%;
  height:175px;
  overflow:hidden;
  border-bottom:1px solid #e8edf5;
  background:linear-gradient(135deg,#edf5ff,#fff4ea);
  flex:0 0 auto;
}
.subject-thumb img{
  display:block !important;
  width:100% !important;
  height:100% !important;
  max-width:none !important;
  object-fit:cover !important;
  object-position:center center !important;
  transform:scale(1.01);
}
.subject-card > img{
  display:block !important;
  width:100% !important;
  height:175px !important;
  max-width:none !important;
  object-fit:cover !important;
  object-position:center center !important;
}
.subject-card .body{
  position:relative;
  z-index:3;
  background:#fff;
  flex:1 1 auto;
}
.subject-card h3{
  line-height:1.12;
}
.subject-card p{
  overflow-wrap:anywhere;
}

/* V3.9 — verrouillage du cadrage des visuels matières */
.subject-card img,
.subject-hero-image img,
.subjects-grid img,
.subject-grid img {
  display:block;
  width:100%;
  height:100%;
  object-fit:cover;
  object-position:center;
}
.subject-card,.subject-hero-image,.subjects-grid>* ,.subject-grid>* {overflow:hidden}

/* V4.1 — une discipline = une vraie image séparée */
.subject-card,
.subject-card .subject-img,
.subjects-grid > *,
.subject-grid > *{
  overflow:hidden !important;
}
.subject-card img,
.subject-card .subject-img img,
.subjects-grid img,
.subject-grid img{
  display:block !important;
  width:100% !important;
  height:100% !important;
  object-fit:cover !important;
  object-position:center !important;
}
