/* Espace élève Pipsia. Palette et principes : identite/identite-marque.md
   (« beaucoup d'air : le premium vient de l'espace, pas des effets »). */

:root {
  /* Fait adopter aux contrôles natifs (cases, radios, ascenseurs, sélecteurs de
     date) le rendu sombre : sans cela ils restent blancs sur fond sombre. */
  color-scheme: dark;
  --bg: #0A0E14; --surface: #121826; --surface-2: #161D2E; --border: #232B3B;
  --text: #E9ECF2; --text-2: #98A2B3; --text-lecture: #CBD3E1;
  --accent: #6C8CFF; --accent-hover: #8AA4FF; --accent-faible: rgba(108,140,255,0.10);
  --green: #3ECF8E; --amber: #E8B450; --red: #E5484D;
  --radius: 12px; --radius-s: 9px;
  --lecture: 68ch;          /* largeur de lecture confortable pour le texte long */
  --champ-h: 46px;          /* hauteur unique de tous les champs et boutons */
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --font-mono: "SF Mono", "JetBrains Mono", Consolas, monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  background: var(--bg); color: var(--text);
  font-family: var(--font-sans); font-size: 16.5px; line-height: 1.6;
  min-height: 100vh; display: flex; flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

.container { max-width: 1120px; margin: 0 auto; padding: 0 28px; width: 100%; }

header { border-bottom: 1px solid var(--border); background: rgba(10,14,20,0.92); backdrop-filter: blur(6px); position: sticky; top: 0; z-index: 20; }
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 64px; gap: 20px; }
.logo { font-size: 1.3rem; font-weight: 650; color: var(--text); text-decoration: none; }
.logo::after { content: "."; color: var(--accent); }
nav { display: flex; gap: 6px; flex-wrap: wrap; }
nav a {
  color: var(--text-2); text-decoration: none; font-size: 0.92rem;
  padding: 7px 12px; border-radius: var(--radius-s);
}
nav a:hover { color: var(--text); background: var(--surface); }

main { flex: 1; padding: 44px 0 80px; }

.vue { display: none; }
.vue.actif { display: block; animation: app 0.2s ease; }
@keyframes app { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .vue.actif { animation: none; } }

/* Typographie */

h1 { font-size: clamp(1.55rem, 3.4vw, 2.05rem); line-height: 1.22; letter-spacing: -0.015em; margin-bottom: 10px; }
h2 { font-size: 1.22rem; line-height: 1.3; margin-bottom: 14px; }
h3 { font-size: 1.04rem; line-height: 1.35; }
.lede { color: var(--text-2); margin-bottom: 30px; max-width: var(--lecture); }
.note { color: var(--text-2); font-size: 0.88rem; margin: 10px 0; max-width: var(--lecture); }
.note a, .encart a { color: var(--accent); text-decoration: none; }
.note a:hover, .encart a:hover { color: var(--accent-hover); text-decoration: underline; }

/* Barre de retour : même gabarit partout, détachée du titre. */
.lien-retour {
  display: inline-block; margin-bottom: 20px;
  background: none; border: none; padding: 0; cursor: pointer;
  font-family: var(--font-sans); font-size: 0.9rem;
  color: var(--text-2); text-decoration: none;
}
.lien-retour:hover { color: var(--text); }

/* Boutons */

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: var(--champ-h); border: 1px solid transparent; cursor: pointer; text-decoration: none;
  font-family: var(--font-sans); font-weight: 600; font-size: 0.97rem;
  padding: 0 24px; border-radius: var(--radius-s);
}
.btn-primary { background: var(--accent); color: var(--bg); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:disabled { opacity: 0.55; cursor: wait; }
.btn-ghost { background: transparent; border-color: var(--border); color: var(--text); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }

/* Champs : une seule hauteur, un seul rayon, un seul état de focus. */

input[type="email"], input[type="text"], input[type="number"], textarea {
  background: var(--surface); border: 1px solid var(--border); color: var(--text);
  font-family: var(--font-sans); font-size: 0.97rem; line-height: 1.5;
  padding: 11px 15px; border-radius: var(--radius-s); width: 100%;
}
input[type="email"], input[type="text"], input[type="number"] { height: var(--champ-h); }
input::placeholder, textarea::placeholder { color: #6B7686; }
input:focus, textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-faible);
}
/* Les zones de saisie longue suivent la largeur de lecture, jamais la largeur
   de l'application : une ligne de 1100 px est illisible. */
textarea { resize: vertical; min-height: 110px; max-width: 820px; }
/* Cases et radios aux couleurs de la charte (le rendu natif est blanc). */
input[type="checkbox"], input[type="radio"] {
  accent-color: var(--accent); width: 17px; height: 17px; cursor: pointer;
}

/* Ligne de champs (journal) : tout aligné sur la même hauteur. */
.champ-ligne {
  display: flex; gap: 10px 22px; flex-wrap: wrap; align-items: center;
  color: var(--text-2); font-size: 0.9rem;
}
.champ-ligne label { display: inline-flex; align-items: center; gap: 8px; }
.champ-ligne input[type="number"] { width: 92px; }
.champ-ligne input[type="text"] { width: 170px; }

/* Connexion */

.carte-connexion {
  max-width: 460px; margin: 7vh auto 0;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 16px; padding: 34px;
}
.carte-connexion .lede { margin-bottom: 22px; }
#form-connexion { display: flex; flex-direction: column; gap: 10px; }

/* Cartes de liste (modules, leçons) */

.modules, .lecons { display: flex; flex-direction: column; gap: 10px; }
.module-carte, .lecon-carte {
  display: flex; align-items: center; gap: 20px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px 22px;
  cursor: pointer; transition: border-color 0.12s ease, background 0.12s ease;
}
.module-carte:hover, .lecon-carte:hover { border-color: var(--accent); background: var(--surface-2); }
.module-carte.verrouille { opacity: 0.5; cursor: not-allowed; }
.module-carte.verrouille:hover { border-color: var(--border); background: var(--surface); }
.module-num, .lecon-sem {
  font-family: var(--font-mono); font-size: 0.82rem; color: var(--accent);
  min-width: 46px; text-align: center; padding: 8px 0;
  border: 1px solid rgba(108,140,255,0.28); border-radius: var(--radius-s);
  background: var(--accent-faible);
}
.module-infos, .lecon-infos { flex: 1; min-width: 0; }
.module-infos h3, .lecon-infos h3 { margin-bottom: 3px; }
.module-infos p, .lecon-infos p { color: var(--text-2); font-size: 0.85rem; line-height: 1.45; }

/* Pastilles d'état, communes au parcours et à l'Académie */
.pastille {
  font-size: 0.73rem; font-weight: 700; white-space: nowrap;
  padding: 5px 12px; border-radius: 999px;
  border: 1px solid var(--border); color: var(--text-2);
}
.pastille.acquis { border-color: rgba(62,207,142,0.45); color: var(--green); }
.pastille.retravailler { border-color: rgba(232,180,80,0.45); color: var(--amber); }
.pastille.encours { border-color: rgba(108,140,255,0.4); color: var(--accent); }

/* Onglets */

.onglets { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin: 26px 0 28px; flex-wrap: wrap; }
.onglet {
  background: none; border: none; color: var(--text-2); cursor: pointer;
  font-family: var(--font-sans); font-size: 0.95rem; font-weight: 600;
  padding: 11px 16px; border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.onglet:hover { color: var(--text); }
.onglet.actif { color: var(--text); border-bottom-color: var(--accent); }
.panneau { display: none; }
.panneau.actif { display: block; }

/* Vidéos */

#lecteur { width: 100%; border-radius: var(--radius); background: #000; max-height: 520px; }
.liste-videos { list-style: none; margin-top: 20px; display: flex; flex-direction: column; gap: 8px; max-width: 900px; }
.liste-videos li {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 18px; border: 1px solid var(--border); border-radius: var(--radius-s);
  cursor: pointer; background: var(--surface); font-size: 0.95rem;
}
.liste-videos li:hover { border-color: var(--accent); }
.liste-videos li.active { border-color: var(--accent); background: var(--accent-faible); }
.liste-videos .duree { margin-left: auto; font-family: var(--font-mono); font-size: 0.8rem; color: var(--text-2); }
.liste-videos .coche { color: var(--green); }

/* QCM : largeur d'interaction limitée, sinon les options s'étirent dans le vide. */

.qcm-themes { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 26px; }
.theme-badge {
  font-size: 0.8rem; font-weight: 600; padding: 6px 13px; border-radius: 999px;
  border: 1px solid var(--border); color: var(--text-2); background: var(--surface);
}
.theme-badge.valide { border-color: rgba(62,207,142,0.5); color: var(--green); }
.question-competence {
  font-size: 0.74rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.09em; color: var(--accent); margin-bottom: 9px;
}
#qcm-question-bloc h2 { max-width: var(--lecture); }
.options { display: flex; flex-direction: column; gap: 10px; margin-top: 18px; max-width: 660px; }
.option {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-s);
  padding: 14px 18px; color: var(--text); font-family: var(--font-sans);
  font-size: 0.95rem; text-align: left; cursor: pointer; line-height: 1.45;
}
.option:hover:not(:disabled) { border-color: var(--accent); background: var(--surface-2); }
.option:disabled { cursor: default; opacity: 0.7; }
.option.bonne { border-color: var(--green); color: var(--green); opacity: 1; }
.option.mauvaise { border-color: var(--red); color: var(--red); opacity: 1; }

.encart {
  border: 1px solid var(--border); background: var(--surface);
  border-radius: var(--radius); padding: 16px 20px; margin: 18px 0;
  font-size: 0.94rem; color: var(--text-2); max-width: var(--lecture);
}
.encart.succes { border-color: rgba(62,207,142,0.5); color: var(--green); }
.encart.echec { border-color: rgba(229,72,77,0.5); }

.vide {
  text-align: center; padding: 48px 26px;
  border: 1px dashed var(--border); border-radius: var(--radius);
  color: var(--text-2); font-size: 0.92rem; line-height: 1.6;
}
.vide strong { display: block; color: var(--text); font-size: 1.02rem; margin-bottom: 6px; }

/* Exercice */

.consigne { color: var(--text-lecture); margin-bottom: 18px; white-space: pre-wrap; font-size: 0.96rem; max-width: var(--lecture); }
.consigne strong { color: var(--text); }
#exercice-reponse, #aca-exercice-reponse { margin-bottom: 12px; max-width: 820px; }

/* Tuteur */

.chat { display: flex; flex-direction: column; gap: 10px; margin: 18px 0; max-height: 440px; overflow-y: auto; max-width: 820px; }
.msg { padding: 13px 17px; border-radius: 13px; font-size: 0.94rem; max-width: 85%; white-space: pre-wrap; line-height: 1.55; }
.msg.user { align-self: flex-end; background: rgba(108,140,255,0.14); border: 1px solid rgba(108,140,255,0.3); }
.msg.assistant { align-self: flex-start; background: var(--surface); border: 1px solid var(--border); color: var(--text-lecture); }
#form-tuteur, #form-tuteur-aca { display: flex; gap: 10px; align-items: flex-end; max-width: 820px; }
#form-tuteur textarea, #form-tuteur-aca textarea { flex: 1; min-height: 0; }

/* Journal */

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 28px; max-width: 820px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 20px; }
.stat .valeur { font-family: var(--font-mono); font-size: 1.35rem; line-height: 1.2; }
.stat .label { color: var(--text-2); font-size: 0.8rem; margin-top: 2px; }
.carte-form {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 24px 26px; margin-bottom: 30px; max-width: 820px;
  display: flex; flex-direction: column; gap: 16px;
}
.carte-form h2 { margin-bottom: 0; }
.carte-form textarea { margin: 0; }
.carte-form p { margin: 0; }
.journal-liste { list-style: none; max-width: 820px; }
.journal-liste li { border-bottom: 1px solid var(--border); padding: 16px 2px; font-size: 0.94rem; }
.journal-liste .meta { font-family: var(--font-mono); font-size: 0.75rem; color: var(--text-2); margin-bottom: 4px; }
.journal-liste .r-pos { color: var(--green); }
.journal-liste .r-neg { color: var(--red); }

/* --- Académie --- */

.aca-hero {
  background:
    radial-gradient(130% 150% at 0% 0%, rgba(108,140,255,0.17), transparent 62%),
    var(--surface);
  border: 1px solid var(--border); border-radius: 16px;
  padding: 32px 34px; margin-bottom: 24px;
}
.badge-aca {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 0.73rem; font-weight: 700; letter-spacing: 0.09em; text-transform: uppercase;
  color: var(--accent); background: var(--accent-faible);
  border: 1px solid rgba(108,140,255,0.35); border-radius: 999px;
  padding: 5px 13px; margin-bottom: 16px;
}
.badge-aca::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--green); }
.aca-hero h1 { margin-bottom: 8px; }
.aca-hero .lede { margin-bottom: 0; }

.aca-rdv { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; margin-bottom: 8px; }
.rdv-carte {
  display: flex; flex-direction: column; gap: 8px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px 22px;
}
.rdv-jour {
  font-family: var(--font-mono); font-size: 0.71rem; text-transform: uppercase;
  letter-spacing: 0.09em; color: var(--accent);
}
.rdv-carte h3 { margin: 0; }
.rdv-carte p { color: var(--text-2); font-size: 0.86rem; line-height: 1.5; flex: 1; }
.rdv-carte strong { color: var(--text-lecture); font-weight: 600; }
.rdv-lien {
  background: none; border: none; padding: 0; text-align: left; margin-top: auto;
  font-family: var(--font-sans); font-size: 0.86rem; font-weight: 600; line-height: 1.5;
  color: var(--accent); text-decoration: none; cursor: pointer;
}
.rdv-lien:hover { color: var(--accent-hover); }

/* Leçon */
.lecon-entete { margin-bottom: 26px; padding-bottom: 22px; border-bottom: 1px solid var(--border); }
.lecon-entete .meta {
  font-family: var(--font-mono); font-size: 0.74rem; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--text-2); margin: 0 0 10px;
}
.lecon-entete h1 { max-width: var(--lecture); }
.prose-lecon { font-size: 1.03rem; line-height: 1.78; color: var(--text-lecture); max-width: var(--lecture); }
.prose-lecon h2 { font-size: 1.15rem; color: var(--text); margin: 32px 0 12px; }
.prose-lecon h3 { font-size: 1.02rem; color: var(--text); margin: 26px 0 8px; }
.prose-lecon p { margin-bottom: 16px; }
.prose-lecon ul, .prose-lecon ol { margin: 0 0 18px 22px; }
.prose-lecon li { margin-bottom: 8px; }
.prose-lecon strong { color: var(--text); font-weight: 650; }
.prose-lecon em { color: var(--text); }

.exercice-bloc {
  margin-top: 38px; background: var(--surface);
  border: 1px solid var(--border); border-left: 3px solid var(--accent);
  border-radius: var(--radius); padding: 26px 28px; max-width: 880px;
}
.exercice-bloc h3 { font-size: 1.06rem; margin-bottom: 4px; }
.exercice-bloc .note { margin: 0 0 18px; }

.suggestions { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0 4px; }
.suggestion {
  background: var(--surface); border: 1px solid var(--border); color: var(--text-2);
  border-radius: 999px; padding: 9px 16px; cursor: pointer;
  font-family: var(--font-sans); font-size: 0.85rem; text-align: left;
}
.suggestion:hover { border-color: var(--accent); color: var(--text); }
#aca-tuteur-messages { min-height: 190px; }

.aca-pied {
  display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap;
  margin-top: 38px; padding-top: 20px; border-top: 1px solid var(--border);
  color: var(--text-2); font-size: 0.85rem;
}
.aca-pied a { color: var(--text-2); text-decoration: none; }
.aca-pied a:hover { color: var(--text); }

/* Chargement */

.chargement { text-align: center; padding: 90px 0; color: var(--text-2); }
.spinner {
  width: 34px; height: 34px; margin: 0 auto 18px;
  border: 3px solid var(--border); border-top-color: var(--accent);
  border-radius: 50%; animation: rot 0.8s linear infinite;
}
@keyframes rot { to { transform: rotate(360deg); } }

footer { border-top: 1px solid var(--border); padding: 24px 0; color: var(--text-2); font-size: 0.78rem; }
footer p { max-width: var(--lecture); }
footer a { color: var(--text-2); }
footer a:hover { color: var(--text); }

@media (max-width: 640px) {
  .container { padding: 0 18px; }
  main { padding: 32px 0 60px; }
  .aca-hero { padding: 24px 22px; }
  .module-carte, .lecon-carte { padding: 16px 18px; gap: 14px; }
  .exercice-bloc { padding: 20px 20px; }
  .msg { max-width: 92%; }
}
