/* Module explication de texte — styles complémentaires */
.explication-app {
  max-width: 1060px;
}

.explication-hero {
  margin-bottom: 24px;
}

.explication-hero h1 {
  font-family: var(--font-d);
  font-size: 1.65rem;
  margin-bottom: 6px;
}

.explication-hero .lead {
  color: var(--ink-2);
  max-width: 62ch;
}

.explication-toolbar {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 18px;
}

.explication-search-row {
  display: flex;
  gap: 8px;
  width: 100%;
  align-items: stretch;
}

.explication-search-row input[type="search"] {
  flex: 1;
  min-width: 0;
  width: 100%;
  font: inherit;
  padding: 10px 12px;
  border: 1px solid var(--paper-3);
  border-radius: var(--r);
  background: var(--white);
}

.explication-search-row .btn {
  flex-shrink: 0;
  white-space: nowrap;
}

.explication-filters {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

@media (max-width: 720px) {
  .explication-filters {
    grid-template-columns: 1fr;
  }
}

.explication-filters select {
  font: inherit;
  padding: 8px 10px;
  border: 1px solid var(--paper-3);
  border-radius: var(--r);
  background: var(--white);
  color: var(--ink);
  width: 100%;
  appearance: auto;
}

.texte-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.catalog-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
  margin: 8px 0 28px;
}

.catalog-page-numbers {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.catalog-page-btn {
  min-width: 2.2em;
}

.catalog-page-btn.is-active {
  background: var(--accent);
  color: var(--white);
}

.catalog-page-btn:disabled {
  opacity: 0.4;
  cursor: default;
}

.catalog-page-ellipsis {
  color: var(--ink-2);
  padding: 0 2px;
}

.texte-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px 16px;
  background: var(--white);
  border: 1px solid var(--paper-3);
  border-radius: var(--r);
  box-shadow: var(--sh);
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.texte-card:hover,
.texte-card:focus-visible {
  border-color: var(--accent-2);
  box-shadow: 0 4px 14px rgba(45, 106, 79, 0.12);
  outline: none;
}

.texte-card h3 {
  font-size: 0.98rem;
  line-height: 1.35;
  color: var(--ink);
}

.texte-card-meta {
  font-size: 0.8rem;
  color: var(--ink-3);
}

.texte-card-extrait {
  font-size: 0.86rem;
  color: var(--ink-2);
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.explication-parcours {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
}

@media (min-width: 900px) {
  .explication-parcours {
    grid-template-columns: 1fr 1fr;
    align-items: start;
  }
}

.texte-panel {
  background: var(--white);
  border: 1px solid var(--paper-3);
  border-radius: var(--r);
  padding: 16px 18px;
  box-shadow: var(--sh);
}

.texte-panel h2 {
  font-family: var(--font-d);
  font-size: 1.15rem;
  margin-bottom: 4px;
}

.texte-panel-header {
  margin-bottom: 12px;
}

.texte-oeuvre {
  display: block;
  margin-top: 6px;
  font-family: var(--font-b, "Source Sans 3", system-ui, sans-serif);
  font-size: 0.84rem;
  font-style: normal;
  font-weight: 600;
  line-height: 1.4;
  color: var(--ink-2);
  max-width: 68ch;
}

.texte-citation-footer {
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px solid color-mix(in srgb, var(--paper-3) 75%, transparent);
}

.texte-citation-footer cite {
  display: block;
  font-family: var(--font-b, "Source Sans 3", system-ui, sans-serif);
  font-size: 0.78rem;
  font-style: normal;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--ink-3);
  text-align: right;
}

.texte-panel .meta {
  font-size: 0.82rem;
  color: var(--ink-3);
  margin-bottom: 12px;
}

.texte-panel .corpus {
  font-family: var(--font-d);
  font-size: 1rem;
  line-height: 1.75;
  max-height: 52vh;
  overflow-y: auto;
  padding-right: 6px;
  user-select: text;
  -webkit-user-select: text;
  color: var(--ink);
}

.texte-corpus-p {
  margin: 0 0 1.05em;
  text-align: justify;
  hyphens: auto;
}

.texte-corpus-p:last-child {
  margin-bottom: 0;
}

.texte-corpus-p--dialogue {
  margin-left: 0.5rem;
  padding-left: 0.75rem;
  border-left: 3px solid var(--accent-soft-2);
}

.texte-partie-phrases .texte-corpus-p {
  margin-bottom: 0.95em;
}

.phrase-em {
  font-style: italic;
  color: var(--ink);
}

.phrase-dialogue {
  font-weight: 500;
}

.corpus-philosophe {
  position: relative;
  user-select: text;
  -webkit-user-select: text;
}

/* Texte philosophe — fond ocre (manuel Le Robert) */
.texte-philosophe,
.rubrique-philosophe,
.corpus-philosophe .corpus {
  background: #faf8f4;
  border-radius: var(--r);
  padding: 16px 18px 14px;
  font-family: var(--font-d);
  font-style: italic;
  line-height: 1.78;
  color: var(--ink);
  max-width: 68ch;
}

.texte-philosophe .texte-corpus-p,
.corpus-philosophe .texte-corpus-p {
  font-style: inherit;
}

/* Rubriques pédagogiques du manuel (hors corpus) */
.rubrique-glose,
.texte-glose {
  background: var(--paper);
  border-left: 3px solid var(--paper-3);
  padding: 10px 14px;
  font-style: normal;
  font-size: 0.92rem;
  color: var(--ink-2);
  margin-bottom: 12px;
}

.rubrique-dit-aussi {
  background: #faf6ed;
  border-radius: var(--r);
  padding: 12px 14px;
  font-size: 0.9rem;
}

.rubrique-reperes {
  background: color-mix(in srgb, var(--accent-soft) 45%, var(--white));
  border-radius: var(--r);
  padding: 12px 14px;
  font-size: 0.88rem;
}

.rubrique-frontieres {
  background: #f0f4f8;
  border-radius: var(--r);
  padding: 12px 14px;
  font-size: 0.9rem;
}

.rubrique-matiere {
  background: var(--warn-soft);
  border-radius: var(--r);
  padding: 12px 14px;
}

.rubrique-mots {
  background: #f3eef8;
  border-radius: var(--r);
  padding: 12px 14px;
}

.rubrique-cinephilo {
  background: #e8eaf6;
  border-radius: var(--r);
  padding: 12px 14px;
}

.rubrique-dit-aussi-label,
.rubrique-reperes-label,
.rubrique-frontieres-label,
.rubrique-matiere-label,
.rubrique-mots-label,
.rubrique-cinephilo-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 6px;
}

.corpus-philosophe .corpus,
.corpus-philosophe .texte-philosophe,
#passage-text,
#texte-corpus {
  user-select: text;
  -webkit-user-select: text;
}

.corpus-philosophe [contenteditable],
.texte-philosophe[contenteditable],
#texte-corpus[contenteditable],
#passage-text[contenteditable] {
  -webkit-user-modify: read-only;
  user-modify: read-only;
}

.phrase.phrase-editable[contenteditable] {
  -webkit-user-modify: read-write-plaintext-only;
  user-modify: read-write-plaintext-only;
  cursor: text;
  outline: none;
  border-radius: 3px;
  transition: background 0.15s ease;
}

.phrase.phrase-editable[contenteditable]:hover {
  background: rgba(26, 95, 74, 0.06);
}

.phrase.phrase-editable[contenteditable]:focus {
  background: rgba(26, 95, 74, 0.1);
  box-shadow: 0 0 0 1px var(--accent-soft-2);
}

.phrase-bubbles {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  overflow: visible;
  z-index: 2;
}

.phrase-bubble {
  position: absolute;
  pointer-events: auto;
  background: var(--white);
  border: 1px solid var(--paper-3);
  border-radius: 8px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.1);
  padding: 8px 10px;
  font-size: 0.82rem;
  line-height: 1.45;
  color: var(--ink-2);
  z-index: 3;
}

.phrase-bubble-comment {
  margin: 0;
  white-space: pre-wrap;
}

.phrase-bubble-transition {
  margin: 6px 0 0;
  font-size: 0.78rem;
  color: var(--ink-3);
}

.phrase-bubble-transition em {
  font-style: normal;
  font-weight: 600;
  color: var(--accent);
}

.texte-partie {
  margin-bottom: 14px;
}

.texte-partie-titre {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.texte-partie-phrases {
  line-height: 1.7;
}

.phrase {
  display: inline;
  transition: color 0.2s, background 0.2s;
  border-radius: 2px;
  padding: 0 1px;
}

.phrase-active {
  color: #c62828;
  background: rgba(198, 40, 40, 0.08);
  font-weight: 600;
}

.badge-corrected {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 1px 6px;
  border-radius: 99px;
  vertical-align: middle;
}

.chat-panel {
  background: var(--white);
  border: 1px solid var(--paper-3);
  border-radius: var(--r);
  box-shadow: var(--sh);
  display: flex;
  flex-direction: column;
  min-height: 420px;
}

.chat-head {
  padding: 12px 16px;
  border-bottom: 1px solid var(--paper-3);
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
}

.chat-etape {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--accent);
}

.chat-progress {
  flex: 1 1 120px;
  height: 6px;
  background: var(--paper-2);
  border-radius: 99px;
  overflow: hidden;
}

.chat-progress > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--accent-2), var(--accent));
  transition: width 0.3s;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 50vh;
}

.chat-msg {
  max-width: 92%;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 0.92rem;
  line-height: 1.5;
}

.chat-msg--tutor {
  align-self: flex-start;
  background: var(--accent-soft);
  border: 1px solid var(--accent-soft-2);
}

.chat-msg--tutor p {
  margin: 0 0 0.5em;
}

.chat-msg--tutor p:last-child {
  margin-bottom: 0;
}

.chat-msg--tutor .ai-list {
  margin: 0.4em 0 0.6em 1.1em;
  padding: 0;
}

.chat-msg--tutor .ai-list li {
  margin-bottom: 0.25em;
}

.chat-msg--user {
  align-self: flex-end;
  background: var(--paper-2);
  border: 1px solid var(--paper-3);
}

.chat-msg--system {
  align-self: center;
  background: var(--warn-soft);
  color: var(--warn);
  font-size: 0.84rem;
  max-width: 100%;
  text-align: center;
}

.chat-hint {
  margin: 0 16px;
  padding: 8px 10px;
  background: var(--warn-soft);
  border-radius: var(--r);
  font-size: 0.84rem;
  color: var(--warn);
}

.chat-form {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--paper-3);
}

.chat-form textarea {
  flex: 1;
  font: inherit;
  padding: 10px 12px;
  border: 1px solid var(--paper-3);
  border-radius: var(--r);
  resize: vertical;
  min-height: 44px;
  max-height: 120px;
}

.synth-panel {
  margin-top: 16px;
  padding: 14px 16px;
  background: var(--white);
  border: 1px dashed var(--accent-soft-2);
  border-radius: var(--r);
}

.synth-panel h3 {
  font-size: 0.95rem;
  margin-bottom: 8px;
}

.synth-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.synth-list li {
  font-size: 0.88rem;
  padding: 6px 8px;
  background: var(--paper);
  border-radius: 6px;
}

.explication-empty {
  text-align: center;
  padding: 32px 16px;
  color: var(--ink-3);
}

.config-banner {
  margin-bottom: 16px;
  padding: 12px 14px;
  background: var(--warn-soft);
  border: 1px solid #e8d4bc;
  border-radius: var(--r);
  font-size: 0.88rem;
  color: var(--warn);
}

.config-banner-steps {
  margin: 8px 0 0;
  padding-left: 1.25rem;
  color: var(--ink-2);
}

.config-banner-steps li {
  margin: 4px 0;
}

.config-banner a {
  color: var(--accent);
  font-weight: 600;
}

.explication-back {
  margin-bottom: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.explication-visites-crumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  margin: 10px 0 0;
  padding: 10px 12px;
  background: #eef5f1;
  border: 1px solid #c5ddd0;
  border-radius: 8px;
}

.explication-visites-ctx {
  font-size: 13px;
  color: var(--ink-2, #4a5560);
  max-width: 48em;
}

.lecture-hero {
  margin-bottom: 18px;
}

.lecture-hero h2 {
  font-family: var(--font-d);
  font-size: 1.35rem;
  margin-bottom: 6px;
}

.lecture-table-wrap {
  overflow-x: auto;
  margin-bottom: 24px;
  border: 1px solid var(--paper-3);
  border-radius: var(--r);
  background: var(--white);
}

.lecture-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
}

.lecture-table th,
.lecture-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--paper-3);
  vertical-align: top;
  text-align: left;
}

.lecture-table th {
  background: var(--paper);
  font-weight: 600;
  font-size: 0.8rem;
}

.lecture-id {
  width: 2.5rem;
  color: var(--ink-3);
  font-weight: 600;
}

.lecture-phrase {
  min-width: 180px;
  font-family: var(--font-d);
}

.lecture-comment,
.lecture-transition {
  width: 100%;
  font: inherit;
  padding: 6px 8px;
  border: 1px solid var(--paper-3);
  border-radius: 6px;
}

.parties-redaction h3 {
  font-size: 1rem;
  margin-bottom: 12px;
}

.partie-redaction {
  margin-bottom: 16px;
  padding: 12px 14px;
  background: var(--white);
  border: 1px solid var(--paper-3);
  border-radius: var(--r);
}

.partie-redaction h4 {
  font-size: 0.9rem;
  margin-bottom: 8px;
  color: var(--accent);
}

.partie-draft {
  width: 100%;
  font: inherit;
  padding: 10px 12px;
  border: 1px solid var(--paper-3);
  border-radius: var(--r);
  margin-bottom: 8px;
  resize: vertical;
}

.partie-feedback {
  margin-top: 8px;
  padding: 8px 10px;
  background: var(--accent-soft);
  border-radius: var(--r);
  font-size: 0.88rem;
}

.synthese-cours-panel {
  margin-top: 24px;
  padding: 14px 16px;
  background: var(--white);
  border: 1px dashed var(--accent);
  border-radius: var(--r);
}

.synthese-cours-panel h3 {
  font-size: 0.95rem;
  margin-bottom: 8px;
  color: var(--accent);
}

.synthese-defs {
  margin: 6px 0 10px 1.1rem;
  font-size: 0.88rem;
}

.synthese-these,
.synthese-exemple {
  font-size: 0.88rem;
  margin: 0 0 8px;
}

/* ── Phases & persistance ── */
.phase-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-bottom: 14px;
  padding: 10px 14px;
  background: var(--white);
  border: 1px solid var(--paper-3);
  border-radius: var(--r);
}

.phase-step {
  font-size: 0.82rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 99px;
}

.phase-step--done {
  color: var(--accent);
  background: var(--accent-soft);
}

.phase-step--active {
  color: var(--white);
  background: var(--accent);
}

.phase-step--todo {
  color: var(--ink-3);
  background: var(--paper-2);
}

.phase-sep {
  color: var(--ink-3);
  font-size: 0.75rem;
}

.badge-reprise {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  color: #1565c0;
  background: #e3f2fd;
  padding: 1px 7px;
  border-radius: 99px;
  vertical-align: middle;
  margin-left: 4px;
}

.badge-reformulated {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 1px 6px;
  border-radius: 4px;
  margin-right: 4px;
  vertical-align: middle;
}

.answer-validation {
  margin: 0 16px 10px;
  padding: 12px 14px;
  background: var(--paper);
  border: 1px solid var(--accent-soft-2);
  border-radius: var(--r);
}

.answer-validation-title {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--accent);
  margin: 0 0 8px;
}

.answer-preview {
  display: block;
  width: 100%;
  font: inherit;
  font-size: 0.9rem;
  line-height: 1.5;
  padding: 8px 10px;
  background: var(--white);
  border-radius: 6px;
  border: 1px solid var(--paper-3);
  margin-bottom: 6px;
  resize: vertical;
  min-height: 72px;
}

.answer-preview-hint {
  margin: 0 0 10px;
}

.answer-validation-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.decoupage-panel {
  background: var(--white);
  border: 1px solid var(--paper-3);
  border-radius: var(--r);
  box-shadow: var(--sh);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 420px;
}

.decoupage-panel h3 {
  font-size: 1rem;
  margin: 0;
}

.decoupage-partie {
  padding: 10px 12px;
  background: var(--paper);
  border-radius: var(--r);
  border: 1px solid var(--paper-3);
}

.decoupage-titre-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ink-3);
  margin-bottom: 6px;
}

.decoupage-titre {
  width: 100%;
  font: inherit;
  font-weight: 600;
  color: var(--accent);
  padding: 6px 8px;
  border: 1px solid var(--paper-3);
  border-radius: 6px;
  margin-top: 4px;
}

.decoupage-phrases {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.decoupage-phrases li {
  font-size: 0.84rem;
  line-height: 1.45;
  color: var(--ink-2);
}

/* Commentaire du professeur (côté élève) */
.prof-comment {
  margin: 10px 0 14px;
  padding: 10px 14px;
  background: #fdf6ec;
  border: 1px solid #e8d5b5;
  border-left: 4px solid #c8963e;
  border-radius: 8px;
}
.prof-comment-head {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  color: #8a6320;
  margin: 0 0 6px;
  font-size: 0.92rem;
}
.prof-comment-head svg { width: 16px; height: 16px; }
.prof-comment-note {
  margin: 0 0 4px;
  font-weight: 600;
  font-style: italic;
}
.prof-comment-body { line-height: 1.5; }
.badge-prof-comment {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  background: #fdf6ec;
  color: #8a6320;
  border: 1px solid #e8d5b5;
  vertical-align: middle;
}
