}

/* =========================
   ARLinus - Clean UI (v999)
   Compatible avec:
   - chat_general.html
   - chat_primaire.html
   - chat_college_lycee.html
   - chat_universite.html
   - study.html
   ========================= */

/* ---- Variables ---- */
:root{
  --bg1:#eaf6ff;
  --bg2:#ffffff;
  --text:#0f172a;
  --muted:#64748b;

  --card: rgba(255,255,255,.75);
  --stroke: rgba(0,0,0,.08);

  --shadow: 0 18px 45px rgba(15,23,42,.10);
  --shadow2: 0 10px 22px rgba(15,23,42,.10);

  --blue:#3aa0ff;
  --blue2:#2f95ff;

  --radius: 22px;
}

/* ---- Reset / base ---- */
*{ box-sizing:border-box; }
html,body{ height:100%; }
body{
  margin:0;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Arial, sans-serif;
  color: var(--text);
}
img{ max-width:100%; height:auto; display:block; }

.hidden{ display:none !important; }

/* ✅ IMPORTANT: on neutralise l'ancien layout si tu l'avais encore */
.input-bar,
.input-bar.ios,
.chat-box,
.chat-box.ios{
  /* si un ancien composant existe, il ne doit plus apparaître */
}

/* ---- Background ---- */
body.bg{
  background:
    radial-gradient(900px 450px at 50% 12%, rgba(58,160,255,.28), transparent 55%),
    radial-gradient(900px 500px at 20% 30%, rgba(99,198,173,.14), transparent 55%),
    linear-gradient(var(--bg1), var(--bg2));
  -webkit-font-smoothing: antialiased;
}




body{
  margin:0;
  min-height:100vh;
  display:flex;
  flex-direction:column;
}

.hero{
  flex:1;
  display:flex;
  flex-direction:column;
  justify-content:center;
  align-items:center;
  text-align:center;
}

.home-btn{
  transition: all 0.2s ease;
}

.home-btn:active{
  transform: scale(0.97);
}

/* =========================
   Header iOS
   ========================= */
.app-header.ios{
  position: sticky;
  top: 10px;
  z-index: 50;

  display:flex;
  align-items:center;
  justify-content: space-between;
  gap: 10px;

  margin: 10px 12px 0;
  padding: 12px 12px;

  border-radius: var(--radius);
  background: var(--card);
  border: 1px solid var(--stroke);
  box-shadow: var(--shadow2);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.back.ios{
  width: 44px;
  height: 44px;
  border-radius: 14px;
  border: 1px solid var(--stroke);
  background: rgba(255,255,255,.75);
  box-shadow: 0 6px 14px rgba(0,0,0,.08);
  font-size: 20px;
  cursor:pointer;
}
.back.ios:active{ transform: scale(.96); }

.header-center{
  display:flex;
  align-items:center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

.header-logo{
  width: 26px;
  height: 26px;
  object-fit: contain;
}

.header-title{
  font-weight: 800;
  letter-spacing: .2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-pill{
  display:flex;
  align-items:center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 999px;
  border: 1px solid var(--stroke);
  background: rgba(255,255,255,.75);
  color: rgba(0,0,0,.55);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.pill{
  display:inline-flex;
  align-items:center;
  gap: 6px;
}
.pill.soft{
  opacity:.85;
}

/* boutons header (☰ / 🔎) */
.icon{
  width: 44px;
  height: 44px;
  border-radius: 14px;
  border: 1px solid var(--stroke);
  background: rgba(255,255,255,.75);
  box-shadow: 0 6px 14px rgba(0,0,0,.08);
  cursor:pointer;
  font-size: 18px;
}
.icon:active{ transform: scale(.96); }

/* =========================
   Chat zone
   ========================= */

/* wrapper principal */
.chat-wrap{
  padding: 12px;
  padding-bottom: 92px; /* place pour l'inputbar fixe */
}

/* le chat scrollable */
#chat.chat{
  height: calc(100vh - 170px); /* header + input */
  overflow-y: auto;

  border-radius: var(--radius);
  background: rgba(255,255,255,.45);
  border: 1px solid var(--stroke);
  box-shadow: var(--shadow);

  padding: 16px;
}

/* messages (tu utilises .msg-user / .msg-ai dans le JS) */
.msg-user{
  margin: 10px 0;
  padding: 10px 12px;
  border-radius: 16px;
  background: rgba(58,160,255,.18);
  max-width: 82%;
  margin-left: auto;
  font-weight: 700;
}

.msg-ai{
  margin: 10px 0;
  padding: 10px 12px;
  border-radius: 16px;
  background: rgba(255,255,255,.92);
  border: 1px solid rgba(0,0,0,.06);
  max-width: 86%;
  box-shadow: 0 8px 22px rgba(0,0,0,.06);
}

/* typing */
.typing{
  margin-top: 10px;
  opacity: .75;
  font-size: 13px;
  font-weight: 700;
  padding-left: 4px;
}

/* =========================
   Input bar (unique)
   ========================= */
.inputbar{
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: 12px;
  z-index: 60;

  display:flex;
  align-items:center;
  gap: 10px;

  padding: 10px;
  border-radius: var(--radius);
  background: rgba(255,255,255,.80);
  border: 1px solid var(--stroke);
  box-shadow: var(--shadow2);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

/* champ texte */
.inputbar input{
  flex: 1;
  border: 1px solid rgba(0,0,0,.08);
  background: rgba(255,255,255,.90);
  padding: 14px 14px;
  border-radius: 18px;
  outline: none;
  font-size: 15px;
}

/* icones photo */
.iconbtn{
  width: 44px;
  height: 44px;
  border-radius: 16px;
  border: 1px solid rgba(0,0,0,.10);
  background: rgba(255,255,255,.90);
  cursor:pointer;
  font-size: 18px;
}
.iconbtn:active{ transform: scale(.96); }

/* bouton send */
.send{
  width: 48px;
  height: 48px;
  border-radius: 18px;
  border: none;
  background: linear-gradient(180deg, rgba(58,160,255,.98), rgba(58,160,255,.86));
  color: white;
  font-size: 18px;
  cursor: pointer;
  box-shadow: 0 12px 24px rgba(58,160,255,.28);
}
.send:active{ transform: scale(.96); }
.send:disabled{ opacity:.55; }

/* =========================
   Drawer (Historique / Notes)
   -> ton HTML n’a pas de wrapper interne,
      donc on fait un vrai panneau latéral.
   ========================= */
.drawer{
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;

  width: min(92vw, 420px);
  height: 100vh;

  z-index: 9999;
  overflow: auto;

  padding: 14px;
  background: rgba(255,255,255,.92);
  border-left: 1px solid rgba(0,0,0,.08);
  box-shadow: -20px 0 60px rgba(0,0,0,.18);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}
.drawer.hidden{ display:none !important; }

.drawer-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 10px;
  padding: 8px 4px 12px;
}

.drawer-head h3{
  margin:0;
  font-size: 18px;
  font-weight: 900;
}

.drawer-head button{
  width: 40px;
  height: 40px;
  border-radius: 14px;
  border: 1px solid rgba(0,0,0,.10);
  background: rgba(255,255,255,.85);
  cursor:pointer;
}

.drawer-actions{
  display:flex;
  gap: 10px;
  margin-bottom: 12px;
}

.btn{
  flex:1;
  padding: 14px 12px;
  border-radius: 18px;
  border: 1px solid rgba(0,0,0,.08);
  background: rgba(58,160,255,.12);
  box-shadow: 0 10px 22px rgba(0,0,0,.06);
  cursor:pointer;
  font-weight: 900;
}
.btn:active{ transform: scale(.99); }

.drawer-toolbar{
  display:flex;
  gap: 10px;
  align-items:center;
  margin: 10px 0 12px;
}

.drawer-toolbar input{
  flex: 1;
  padding: 12px 12px;
  border-radius: 16px;
  border: 1px solid rgba(0,0,0,.10);
  background: rgba(255,255,255,.92);
  outline:none;
}

.drawer-toolbar select{
  padding: 12px 10px;
  border-radius: 16px;
  border: 1px solid rgba(0,0,0,.10);
  background: rgba(255,255,255,.92);
  outline:none;
}

/* Liste des conversations */
.conv-list{
  display:flex;
  flex-direction:column;
  gap: 10px;
}

/* item conversation */
.conv-item{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  transition: all .15s ease;

  padding:14px 16px;
  border-radius:20px;
  background:#fff;
  border:1px solid #e7edf5;
  box-shadow:0 4px 14px rgba(0,0,0,.05);
  cursor:pointer;
}
.conv-item:hover{
  background:#f5f9ff;
}
.conv-item.active{
  border:2px solid #b9d8ff;
  box-shadow:0 6px 18px rgba(47,128,237,.12);
}

.conv-left{ flex:1; min-width:0; }
.conv-title-text{
  font-weight:600;
  font-size:16px;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;

  border:none;
  background:none;
  padding:0;
}

.conv-date{
  margin-top:4px;
  font-size:12px;
  color:#7a8a9a;
}
/* kebab + menu */
.conv-right{ position: relative; }
.kebab{
  width:42px;
  height:42px;
  border-radius:12px;
  border:1px solid #d7dee8;
  background:#fff;
  cursor:pointer;
  font-size:18px;
}
.conv-menu{
  position: absolute;
  right: 0;
  top: 44px;
  min-width: 180px;

  background: #fff;
  border-radius: 14px;
  border: 1px solid rgba(0,0,0,.08);
  box-shadow: 0 12px 30px rgba(0,0,0,.15);
  padding: 6px;

  display:flex;
  flex-direction:column;
  gap: 4px;
  z-index: 10000;
}
.conv-menu.hidden{ display:none !important; }
.home-btn{
  display:flex;
  justify-content:space-between;
  width:100%;
  padding:16px 16px;
  border-radius:20px;

  background:linear-gradient(135deg,#6ecbff,#4fa9ff);
  color:#fff;

  box-shadow:0 8px 20px rgba(79,169,255,.35);
}

.home-btn span,
.home-btn small{
  color:#fff !important;
}

.home-btn small{
  opacity:.92;
}

.conv-menu button{
  all: unset;
  padding: 12px 12px;
  border-radius: 10px;
  cursor:pointer;
  font-size: 15px;
  font-weight: 800;
}
.conv-menu button:hover{ background: rgba(0,0,0,.06); }
.conv-menu .danger{ color:#e53935; }

/* Notes */
.notes{
  width:100%;
  min-height: 55vh;
  padding: 12px;
  border-radius: 16px;
  border: 1px solid rgba(0,0,0,.10);
  background: rgba(255,255,255,.92);
  outline:none;
  resize: vertical;
  font-size: 15px;
  margin-bottom: 12px;
}

/* =========================
   Modal Find
   ========================= */
.modal{
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0,0,0,.28);
  display:flex;
  align-items:center;
  justify-content:center;
  padding: 16px;
}
.modal.hidden{ display:none !important; }

.modal-card{
  width: min(520px, 96vw);
  background: rgba(255,255,255,.95);
  border-radius: 20px;
  padding: 16px;
  box-shadow: 0 12px 40px rgba(0,0,0,.18);
}

.modal-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 10px;
  margin-bottom: 12px;
}
.modal-head button{
  width: 40px;
  height: 40px;
  border-radius: 14px;
  border: 1px solid rgba(0,0,0,.10);
  background: rgba(255,255,255,.90);
  cursor:pointer;
}

.modal-card input{
  width: 100%;
  padding: 12px 12px;
  border-radius: 16px;
  border: 1px solid rgba(0,0,0,.10);
  background: rgba(255,255,255,.92);
  outline:none;
  margin-bottom: 10px;
}
.modal-row{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 10px;
}
.modal-row button{
  width: 46px;
  height: 46px;
  border-radius: 16px;
  border: 1px solid rgba(0,0,0,.10);
  background: rgba(255,255,255,.90);
  cursor:pointer;
  font-size: 18px;
}
#findCount{
  font-weight: 900;
  opacity:.75;
}

/* highlight find */
mark.hl{
  background: #ffe58f;
  padding: 0 2px;
  border-radius: 4px;
}

/* =========================
   Study.html
   ========================= */
.page{
  padding: 20px 16px 30px;
}
.page h2{
  margin: 14px 12px;
  font-size: 22px;
  font-weight: 900;
}
.grid{
  display:flex;
  flex-direction:column;
  gap: 12px;
  padding: 0 12px;
}
.btn.primary{
  background: rgba(58,160,255,.12);
}

/* Mobile */
@media (max-width: 520px){
  #chat.chat{ height: calc(100vh - 176px); }
  .drawer{ width: 100vw; }
}




/* ===== FIX ARLinus: inputbar (nouveau HTML) ===== */
.inputbar{
  position: fixed;
  left: 14px;
  right: 14px;
  bottom: 14px;
  z-index: 10000;
  display:flex;
  align-items:center;
  gap: 10px;
  padding: 12px;
  border-radius: 22px;
  background: rgba(255,255,255,.85);
  border: 1px solid rgba(0,0,0,.08);
  box-shadow: 0 10px 26px rgba(0,0,0,.12);
}

.inputbar input{
  flex: 1;
  min-width: 0;
  border: none;
  outline: none;
  background: transparent;
  font-size: 16px;
  padding: 10px 8px;
}

.iconbtn{
  width: 46px;
  height: 46px;
  border-radius: 16px;
  border: 1px solid rgba(0,0,0,.10);
  background: rgba(255,255,255,.95);
  cursor: pointer;
}

.send{
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  width: 54px;
  height: 46px;
  border-radius: 16px;
  border: none;
  background: rgba(58,160,255,.95);
  color: #fff;
  font-size: 18px;
  cursor: pointer;
}

.send:disabled{ opacity: .6; }

/* évite que le chat soit caché par la barre du bas */
.chat-wrap{
  padding-bottom: 100px !important;
}





/* =========================
   HOME (index.html) only
   Active quand <body class="bg home">
   ========================= */
body.home{
  padding: 0;              /* évite le décalage */
}

body.home .center{
  min-height: 100vh;
  display: flex;
  align-items: center;      /* centre vertical */
  justify-content: center;  /* centre horizontal */
  padding: 24px 16px;
}

body.home .hero{
  width: min(520px, 92vw);
  text-align: center;
}

body.home .brand{
  display: flex;
  flex-direction: column;
  align-items: center;
}

body.home .logo-big{
  width: 120px;
  height: auto;
  margin: 0 auto 16px auto;
}

body.home h1{
  margin: 0;
  font-size: 44px;
  line-height: 1.05;
}

body.home .subtitle{
  margin: 10px 0 18px;
}

body.home .actions{
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;          /* mobile */
  margin-top: 10px;
}

body.home .actions .btn{
  width: 220px;             /* boutons alignés et centrés */
  max-width: 45vw;
}

@media (max-width: 420px){
  body.home .actions{
    flex-direction: column;
    align-items: stretch;
  }
  body.home .actions .btn{
    width: 100%;
    max-width: 100%;
  }
}




.coachbar{
  display:flex;
  gap:8px;
  padding:6px 0;
  align-items:center;
}
.coachbar .select{
  flex: 1 1 auto;
  padding:10px;
  border-radius:10px;
}
.coachbar .chapter{
  flex: 1.2 1 auto;
  padding:10px;
  border-radius:10px;
}






/* Le message doit occuper la largeur du téléphone */
.bubble {
  width: 100%;
  max-width: 100%;
}

/* Si ton chat a un conteneur interne centré avec une largeur fixe */



.chat-container,
.messages,
.bubble,
.ai-content {
  width: 100% !important;
  max-width: 100% !important;
}


/* =========================
   ARLinus — Mode cours plein écran (SVG)
   Objectif: rendu large, lisible, comme un document
   ========================= */

/* 1) Le layout ne doit pas être "centré" avec une largeur fixe */
html, body {
  width: 100%;
  max-width: 100%;
  margin: 0;
  padding: 0;
  overflow-x: hidden; /* évite le scroll horizontal global */
}

/* 2) Tous les conteneurs principaux prennent 100% */
.chat-container,
.messages,
.message,
.bubble,
.ai-content {
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box;
}

/* 3) La bulle ne doit pas ressembler à une carte étroite */
.bubble {
  padding: 0 !important;        /* important: pas de padding qui rétrécit */
  margin: 0 !important;         /* évite les marges qui “cassent” la largeur */
  border-radius: 0 !important;  /* style document */
  background: transparent !important;
  box-shadow: none !important;
}

/* 4) Le contenu doit être un "viewport" scrollable si besoin */
.ai-content {
  padding: 0 !important;
  margin: 0 !important;
  overflow-x: auto;             /* si un SVG est vraiment trop large */
  -webkit-overflow-scrolling: touch;
}

/* 5) SVG: prend toute la largeur disponible */
.ai-content svg {
  display: block;
  width: 100% !important;       /* plein écran */
  max-width: 100% !important;
  height: auto !important;
}

/* 6) IMPORTANT: si ton SVG a une largeur fixe interne,
      cette règle aide sur certains navigateurs */
.ai-content svg:not([viewBox]) {
  width: 100% !important;
  height: auto !important;
}

/* 7) Si tu utilises <img src="...svg"> au lieu d’injecter le SVG */
.ai-content img {
  display: block;
  width: 100% !important;
  height: auto !important;
}

/* 8) Pour les longs textes: jamais coupés */
.bubble,
.ai-content {
  word-break: break-word;
  overflow-wrap: anywhere;
}

/* 9) Mobile: supprime tout padding “global” qui réduit la page */
@media (max-width: 768px) {
  .chat-container,
  .messages {
    padding-left: 0 !important;
    padding-right: 0 !important;
  }
}


.exam-content {
  white-space: normal;
  line-height: 1.55;
  font-size: 17px;
  color: #111;
}

.exam-content h1,
.exam-content h2,
.exam-content h3 {
  margin: 16px 0 10px;
  line-height: 1.3;
}

.exam-content h1 { font-size: 28px; }
.exam-content h2 { font-size: 24px; }
.exam-content h3 { font-size: 20px; }

.exam-content p {
  margin: 8px 0;
}

.exam-content ul {
  margin: 8px 0 12px 20px;
  padding: 0;
}

.exam-content li {
  margin: 6px 0;
}

.exam-content hr {
  border: 0;
  border-top: 1px solid #ddd;
  margin: 16px 0;
}

.exam-content strong {
  font-weight: 700;
}

.exam-content svg {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 12px auto;
}

.exam-content .block {
  background: #fff;
  border: 1px solid rgba(0,0,0,.08);
  border-radius: 14px;
  padding: 14px;
  margin-top: 10px;
}




.block svg{
  max-width:100%;
  height:auto;
  margin:20px auto;
  display:block;
  border:1px solid #ddd;
  background:#fff;
}




/* bouton conversation (corrige le cadre gris) */
.conv-open{
  background: transparent;
  border: none;
  width: 100%;
  text-align: left;
  padding: 0;
  margin: 0;
  cursor: pointer;
}

/* titre conversation */
.conv-title{
  font-weight: 700;
  font-size: 16px;
  color: #111;
}

/* date conversation */
.conv-sub{
  font-size: 12px;
  color: #7a8a9a;
}


/* conversation épinglée */
.conv-item.pinned{
  border:2px solid #5bbcff;
  background:#f2f8ff;
}

/* icône épingle */
.conv-pin{
  font-size:14px;
  margin-right:6px;
}


.ai-content strong{
  font-weight:700;
}

.ai-content{
  line-height:1.5;
  word-break:break-word;
}

.ai-content br + br{
  display:block;
  content:"";
  margin-top:6px;
}






/* images*/


.msg-user img,
.msg-ai img{
max-width:220px;
max-height:260px;
border-radius:10px;
margin-top:6px;
display:block;
}




<div style="
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: white;
  display:flex;
  justify-content:space-between;
  align-items:center;
  padding:10px;
  border-bottom:1px solid #ddd;
">
