/* -------------------- Typo et blocks -------------------- */
.course-heading {
    color: #111827;
    margin: 1.4rem 0 0.85rem;
}
/* Espace avant chaque titre (h2/h3/h4) dans le contenu de leçon : sélecteur ciblé pour primer sur les resets */
.course-lesson-content .course-heading,
.course-lesson-content h3.course-heading,
.course-lesson-content h4.course-heading,
.course-lesson-content h5.course-heading {
    margin-top: 2.25rem;
    margin-bottom: 0.85rem;
}
.course-lesson-content .course-heading:first-child {
    margin-top: 0.5rem;
}
.course-heading--h2 {
    font-size: 1.25rem;
}
.course-heading--h3 {
    font-size: 1.1rem;
}
.course-heading--h4 {
    font-size: 1rem;
}
.lesson-marker::before {
    margin-right: 3px;
    margin-left: 3px;
    font-weight: 700;
}
.lesson-marker--right::before {
    content: "✓";
    color: #16a34a;
}
.lesson-marker--wrong::before {
    content: "×";
    color: #dc2626;
}
.course-paragraph {
    color: #374151;
    font-size: 0.98rem;
    line-height: 1.7;
}
/* Passage à la ligne = deux <p> consécutifs : espace minimal (proche du mode édition) */
.course-paragraph p {
    margin-top: 0;
    margin-bottom: 0.02em;
}
.course-paragraph p:last-child {
    margin-bottom: 0;
}
/* <br> seul dans un paragraphe = pas d’espace ajouté (l’interligne suffit) */
.course-paragraph br {
    display: block;
    margin: 0;
    line-height: 0.4;
}
/* Saut de ligne = <p><br></p> : espace visible (padding pour éviter tout collapse), bien distinct du passage à la ligne */
.course-paragraph p:has(> br:only-child) {
    margin: 0;
    padding: 0.6em 0;
    line-height: 0;
    min-height: 0;
}
.course-paragraph p:has(> br:only-child) br {
    display: block;
    height: 0;
    margin: 0;
    padding: 0;
    line-height: 0;
    overflow: hidden;
}
/* Listes (ul/ol et listes Quill .bulleted-list dans .indented) : espacement serré, cohérent avec les paragraphes */
.course-paragraph ol,
.course-paragraph ul,
.course-paragraph .indented ul,
.course-paragraph .bulleted-list {
    margin: 0.15em 0;
    padding-left: 1.5em;
}
.course-paragraph li {
    margin-bottom: 0.12em;
}
.course-paragraph ol ol,
.course-paragraph ul ul,
.course-paragraph ol ul,
.course-paragraph ul ol,
.course-paragraph .indented ul ul,
.course-paragraph .bulleted-list .bulleted-list {
    margin: 0.12em 0;
}
/* Listes ordonnées imbriquées (HTML standard) */
.course-paragraph ol { list-style-type: decimal; }
.course-paragraph ol ol { list-style-type: upper-alpha; }
.course-paragraph ol ol ol { list-style-type: lower-alpha; }
.course-paragraph ol ol ol ol { list-style-type: lower-roman; }
/* Indentation Quill */
.course-paragraph .ql-indent-1 { padding-left: 2em; }
.course-paragraph .ql-indent-2 { padding-left: 4em; }
.course-paragraph .ql-indent-3 { padding-left: 6em; }
.course-paragraph .ql-indent-4 { padding-left: 8em; }
.course-paragraph .ql-indent-5 { padding-left: 10em; }
.course-paragraph li[data-list="bullet"].ql-indent-1,
.course-paragraph ul > li.ql-indent-1 {
    margin-left: 2em;
    padding-left: 0;
}
.course-paragraph li[data-list="bullet"].ql-indent-2,
.course-paragraph ul > li.ql-indent-2 {
    margin-left: 4em;
    padding-left: 0;
}
.course-paragraph li[data-list="bullet"].ql-indent-3,
.course-paragraph ul > li.ql-indent-3 {
    margin-left: 6em;
    padding-left: 0;
}
.course-paragraph li[data-list="bullet"].ql-indent-4,
.course-paragraph ul > li.ql-indent-4 {
    margin-left: 8em;
    padding-left: 0;
}
.course-paragraph li[data-list="bullet"].ql-indent-5,
.course-paragraph ul > li.ql-indent-5 {
    margin-left: 10em;
    padding-left: 0;
}

/* Listes ordonnées multi-niveaux (1 → A → a → i) */
.course-paragraph ol:has(> li[class*="ql-indent-"]):is(:has(> li[data-list="ordered"]), :not(:has(> li[data-list]))) {
    counter-reset: ko-l0 ko-l1 ko-l2 ko-l3;
    list-style: none;
    padding-left: 0;
}
.course-paragraph ol:has(> li[class*="ql-indent-"]):is(:has(> li[data-list="ordered"]), :not(:has(> li[data-list]))) > li > .ql-ui {
    display: none;
}
.course-paragraph ol:has(> li[class*="ql-indent-"]):is(:has(> li[data-list="ordered"]), :not(:has(> li[data-list]))) > li[data-list="ordered"],
.course-paragraph ol:has(> li[class*="ql-indent-"]):is(:has(> li[data-list="ordered"]), :not(:has(> li[data-list]))) > li:not([data-list]) {
    padding-left: 2.2em;
}
.course-paragraph ol:has(> li[class*="ql-indent-"]):is(:has(> li[data-list="ordered"]), :not(:has(> li[data-list]))) > li.ql-indent-1 {
    margin-left: 2em;
    padding-left: 2.2em;
}
.course-paragraph ol:has(> li[class*="ql-indent-"]):is(:has(> li[data-list="ordered"]), :not(:has(> li[data-list]))) > li.ql-indent-2 {
    margin-left: 4em;
    padding-left: 2.2em;
}
.course-paragraph ol:has(> li[class*="ql-indent-"]):is(:has(> li[data-list="ordered"]), :not(:has(> li[data-list]))) > li.ql-indent-3 {
    margin-left: 6em;
    padding-left: 2.2em;
}
.course-paragraph ol:has(> li[class*="ql-indent-"]):is(:has(> li[data-list="ordered"]), :not(:has(> li[data-list]))) > li[data-list="ordered"]::before,
.course-paragraph ol:has(> li[class*="ql-indent-"]):is(:has(> li[data-list="ordered"]), :not(:has(> li[data-list]))) > li:not([data-list])::before {
    display: inline-block;
    width: 1.8em;
    margin-left: -2.2em;
    margin-right: 0.4em;
    text-align: right;
    font-variant-numeric: tabular-nums;
    color: #6b7280;
    font-weight: 700;
}
.course-paragraph ol:has(> li[class*="ql-indent-"]):is(:has(> li[data-list="ordered"]), :not(:has(> li[data-list])))
  > li[data-list="ordered"]:not([class*="ql-indent-"]),
.course-paragraph ol:has(> li[class*="ql-indent-"]):is(:has(> li[data-list="ordered"]), :not(:has(> li[data-list])))
  > li:not([data-list]):not([class*="ql-indent-"]) {
    counter-increment: ko-l0;
    counter-reset: ko-l1 ko-l2 ko-l3;
}
.course-paragraph ol:has(> li[class*="ql-indent-"]):is(:has(> li[data-list="ordered"]), :not(:has(> li[data-list])))
  > li[data-list="ordered"].ql-indent-1,
.course-paragraph ol:has(> li[class*="ql-indent-"]):is(:has(> li[data-list="ordered"]), :not(:has(> li[data-list])))
  > li:not([data-list]).ql-indent-1 {
    counter-increment: ko-l1;
    counter-reset: ko-l2 ko-l3;
}
.course-paragraph ol:has(> li[class*="ql-indent-"]):is(:has(> li[data-list="ordered"]), :not(:has(> li[data-list])))
  > li[data-list="ordered"].ql-indent-2,
.course-paragraph ol:has(> li[class*="ql-indent-"]):is(:has(> li[data-list="ordered"]), :not(:has(> li[data-list])))
  > li:not([data-list]).ql-indent-2 {
    counter-increment: ko-l2;
    counter-reset: ko-l3;
}
.course-paragraph ol:has(> li[class*="ql-indent-"]):is(:has(> li[data-list="ordered"]), :not(:has(> li[data-list])))
  > li[data-list="ordered"].ql-indent-3,
.course-paragraph ol:has(> li[class*="ql-indent-"]):is(:has(> li[data-list="ordered"]), :not(:has(> li[data-list])))
  > li:not([data-list]).ql-indent-3 {
    counter-increment: ko-l3;
}
.course-paragraph ol:has(> li[class*="ql-indent-"]):is(:has(> li[data-list="ordered"]), :not(:has(> li[data-list])))
  > li[data-list="ordered"]:not([class*="ql-indent-"])::before,
.course-paragraph ol:has(> li[class*="ql-indent-"]):is(:has(> li[data-list="ordered"]), :not(:has(> li[data-list])))
  > li:not([data-list]):not([class*="ql-indent-"])::before {
    content: counter(ko-l0, decimal) ".";
}
.course-paragraph ol:has(> li[class*="ql-indent-"]):is(:has(> li[data-list="ordered"]), :not(:has(> li[data-list])))
  > li[data-list="ordered"].ql-indent-1::before,
.course-paragraph ol:has(> li[class*="ql-indent-"]):is(:has(> li[data-list="ordered"]), :not(:has(> li[data-list])))
  > li:not([data-list]).ql-indent-1::before {
    content: counter(ko-l1, upper-alpha) ".";
}
.course-paragraph ol:has(> li[class*="ql-indent-"]):is(:has(> li[data-list="ordered"]), :not(:has(> li[data-list])))
  > li[data-list="ordered"].ql-indent-2::before,
.course-paragraph ol:has(> li[class*="ql-indent-"]):is(:has(> li[data-list="ordered"]), :not(:has(> li[data-list])))
  > li:not([data-list]).ql-indent-2::before {
    content: counter(ko-l2, lower-alpha) ".";
}
.course-paragraph ol:has(> li[class*="ql-indent-"]):is(:has(> li[data-list="ordered"]), :not(:has(> li[data-list])))
  > li[data-list="ordered"].ql-indent-3::before,
.course-paragraph ol:has(> li[class*="ql-indent-"]):is(:has(> li[data-list="ordered"]), :not(:has(> li[data-list])))
  > li:not([data-list]).ql-indent-3::before {
    content: counter(ko-l3, lower-roman) ".";
}

/* Lignes "Coréen" / "Traduction" (Quill: line_role) */
:is(.course-paragraph, .lesson-builder .ql-editor) .course-line-korean {
    font-weight: 800;
    color: #111827;
    margin-bottom: 0.15em;
}
:is(.course-paragraph, .lesson-builder .ql-editor) .course-line-translation {
    color: #6b7280;
    font-style: italic;
}

/* Petit séparateur inline (Quill: divider) */
:is(.course-paragraph, .lesson-builder .ql-editor) .course-inline-divider {
    border: 0;
    height: 2px;
    width: 42%;
    margin: 0.9em auto;
    border-radius: 999px;
    background: linear-gradient(90deg, rgba(0, 71, 160, 0), rgba(0, 71, 160, 0.4), rgba(205, 46, 58, 0.4), rgba(205, 46, 58, 0));
}
.lesson-builder .ql-toolbar button.ql-divider {
    width: 28px;
}
.lesson-builder .ql-toolbar button.ql-divider::before {
    content: "";
    display: block;
    height: 2px;
    width: 16px;
    margin: 0 auto;
    border-radius: 999px;
    background: currentColor;
    opacity: 0.8;
}
/* Blockquote dans paragraphe */
.course-paragraph blockquote {
    border-left: 4px solid rgba(0, 71, 160, 0.5);
    padding-left: 1em;
    margin: 0.75em 0;
    color: #4b5563;
    font-style: italic;
}
/* Tailles de texte Quill */
.course-lesson-content .ql-size-small { font-size: 0.85em; }
.course-lesson-content .ql-size-large { font-size: 1.15em; }
.course-lesson-content .ql-size-huge { font-size: 1.4em; }

/* Couleurs importées depuis l'éditeur Notion/Quill.
   Les styles inline sont retirés par le sanitizer ; les classes sont conservées. */
.course-lesson-content .highlight-default {
    color: rgba(44, 44, 43, 1);
}
.course-lesson-content .highlight-blue {
    color: rgba(56, 125, 201, 1);
}
.course-lesson-content .highlight-blue-strong {
    color: rgb(0, 102, 204);
}
.course-lesson-content .highlight-red {
    color: rgba(207, 81, 72, 1);
}
.course-lesson-content .highlight-red-strong {
    color: rgb(230, 0, 0);
}
.course-lesson-content .highlight-green {
    color: rgb(0, 138, 0);
}
.course-lesson-content .highlight-purple {
    color: rgb(153, 51, 255);
}
.course-lesson-content .highlight-orange {
    color: rgb(255, 153, 0);
}
.course-lesson-content .highlight-code-pink {
    color: rgb(214, 51, 132);
    background-color: rgb(240, 240, 240);
}
.course-lesson-content .highlight-red-soft {
    color: rgb(207, 81, 72);
    background-color: rgba(42, 28, 0, 0.07);
}
.course-lesson-content .highlight-red-blue-bg {
    color: rgb(230, 0, 0);
    background-color: rgb(204, 224, 245);
}
.course-lesson-content .highlight-red-gray-bg {
    color: rgb(230, 0, 0);
    background-color: rgb(187, 187, 187);
}
.course-lesson-content .highlight-coral-muted {
    color: rgb(235, 87, 87);
    background-color: rgba(135, 131, 120, 0.15);
}
.course-lesson-content .highlight-coral-blue-bg {
    color: rgb(235, 87, 87);
    background-color: rgb(204, 224, 245);
}
.course-quote {
    margin: 1.1rem 0;
    padding: 1rem 1.1rem;
    border-left: 4px solid rgba(0, 71, 160, 0.75);
    background: rgba(239, 246, 255, 0.85);
    border-radius: 14px;
    font-style: italic;
    color: #1f2937;
}
.course-separator {
    border: 0;
    height: 1px;
    background: rgba(15, 23, 42, 0.12);
    margin: 1.4rem 0;
}
/* Variantes de séparateurs */
.course-separator--light {
    height: 1px;
    background: rgba(15, 23, 42, 0.08);
    margin: 1rem 0;
}
.course-separator--medium {
    height: 2px;
    background: rgba(15, 23, 42, 0.18);
    margin: 1rem 0;
}
.course-separator--heavy {
    height: 3px;
    background: rgba(15, 23, 42, 0.28);
    margin: 1rem 0;
}
.course-separator--light-spaced {
    height: 1px;
    background: rgba(15, 23, 42, 0.08);
    margin: 2.5rem 0;
}
.course-separator--medium-spaced {
    height: 2px;
    background: rgba(15, 23, 42, 0.18);
    margin: 2.5rem 0;
}
.course-separator--heavy-spaced {
    height: 3px;
    background: rgba(15, 23, 42, 0.28);
    margin: 2.5rem 0;
}
.course-note-inline {
    padding: 0.9rem 1rem;
    border-radius: 14px;
    background: rgba(17, 24, 39, 0.04);
    border: 1px dashed rgba(17, 24, 39, 0.18);
    color: #374151;
    font-size: 0.95rem;
}

/* -------------------- Callouts (tip/info/warning/note) -------------------- */
.course-callout {
    padding: 1.1rem 1.15rem;
    margin: 1.1rem 0;
    border-radius: 14px;
    border: 1px solid transparent;
    font-size: 0.95rem;
}
.course-callout__title {
    font-weight: 800;
    margin-bottom: 0.35rem;
    font-size: 0.98rem;
}
.course-callout__content {
    line-height: 1.7;
}
.course-callout__content p {
    margin-top: 0;
    margin-bottom: 0.5em;
}
.course-callout__content p:last-child {
    margin-bottom: 0;
}
.course-callout--info {
    background: #eff6ff;
    border-left: 4px solid #3b82f6;
}
.course-callout--warning {
    background: #fef2f2;
    border-left: 4px solid var(--red);
}
.course-callout--tips {
    background: #fffbeb;
    border-left: 4px solid #facc15;
}
.course-callout--note {
    background: #ecfeff;
    border-left: 4px solid #06b6d4;
}
.course-callout--remarque {
    background: #faf5ff;
    border-left: 4px solid #a855f7;
}
.course-callout--structure {
    background: #f0fdf4;
    border-left: 4px solid #22c55e;
}

/* -------------------- Mots-clés -------------------- */
.course-keywords {
    background: #f8fafc;
    border-radius: 14px;
    padding: 1.1rem 1.25rem;
    margin: 1.1rem 0;
    border: 1px solid rgba(15, 23, 42, 0.08);
}
.course-keywords__title {
    font-weight: 800;
    font-size: 0.98rem;
    margin-bottom: 0.75rem;
    color: #111827;
}
.course-keywords__list {
    list-style: none;
    margin: 0;
    padding: 0;
}
.course-keywords__item {
    padding: 0.5rem 0;
    border-bottom: 1px dashed rgba(15, 23, 42, 0.1);
    font-size: 0.95rem;
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.4rem;
}
.course-keywords__item:last-child {
    border-bottom: none;
}
.course-keywords__korean {
    font-weight: 700;
    color: var(--blue);
    font-family: "Noto Sans KR", sans-serif;
}
.course-keywords__arrow {
    color: #9ca3af;
    font-size: 0.85rem;
}
.course-keywords__translation {
    color: #374151;
}
.course-keywords__note {
    font-size: 0.85rem;
    color: #6b7280;
    font-style: italic;
}
.course-callout__chips {
    margin-top: 0.6rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

/* -------------------- Tables -------------------- */
.course-table-wrapper {
    margin: 1.2rem 0;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 10px 26px rgba(15, 23, 42, 0.08);
    border: 1px solid rgba(209, 213, 219, 0.8);
    background: #fff;
}
.course-table-wrapper--conjugation { /* Wrapper spécifique aux tableaux de conjugaison sur desktop : sert de conteneur pour les indices visuels de scroll horizontal. */
    position: relative;
    --conjugation-scroll-hint-top: 0; /* Décale verticalement le fondu si on veut un jour l'aligner sous un header ou un titre. */
    --conjugation-scroll-hint-width: 18px; /* Largeur du voile latéral qui suggère qu'il y a encore du contenu hors écran. */
    --conjugation-scroll-hint-color: rgba(248, 250, 252, 0.72); /* Couleur douce pour ne pas "salir" la lecture du tableau. */
}
.course-table-wrapper--conjugation::before,
.course-table-wrapper--conjugation::after { /* Deux pseudo-éléments utilisés comme dégradés latéraux gauche/droite pour signaler le scroll. */
    content: "";
    position: absolute;
    top: var(--conjugation-scroll-hint-top);
    bottom: 0;
    width: var(--conjugation-scroll-hint-width);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease;
    z-index: 1;
}
.course-table-wrapper--conjugation::before { /* Fondu côté gauche : visible quand on n'est plus au tout début du scroll. */
    left: 0;
    background: linear-gradient(90deg, var(--conjugation-scroll-hint-color) 0%, rgba(248, 250, 252, 0) 100%);
}
.course-table-wrapper--conjugation::after { /* Fondu côté droit : visible tant qu'il reste du tableau à découvrir. */
    right: 0;
    background: linear-gradient(270deg, var(--conjugation-scroll-hint-color) 0%, rgba(248, 250, 252, 0) 100%);
}
.course-table-wrapper--conjugation.is-scrollable:not(.is-scroll-start)::before { /* Active le fondu gauche uniquement si le tableau déborde et qu'on a déjà scrollé. */
    opacity: 1;
}
.course-table-wrapper--conjugation.is-scrollable:not(.is-scroll-end)::after { /* Active le fondu droit uniquement si le tableau déborde encore vers la droite. */
    opacity: 1;
}
.course-table-title {
    padding: 0.85rem 1rem 0;
    font-weight: 800;
    color: #111827;
}
.course-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.92rem;
}
.course-table thead {
    background: #111827;
    color: #e5e7eb;
}
.course-table th {
    padding: 0.85rem 1rem;
    text-align: left;
    font-weight: 700;
}
.course-table td {
    padding: 0.75rem 1rem;
    border-top: 1px solid #e5e7eb;
    vertical-align: top;
}
/* Support formatage riche dans les cellules */
.course-table td p,
.course-table th p {
    margin: 0;
}
.course-table td p:last-child,
.course-table th p:last-child {
    margin-bottom: 0;
}
.course-table-cell-lines { /* Petit conteneur vertical commun à toutes les cellules découpées ligne par ligne. */
    display: flex;
    flex-direction: column;
    gap: 0.18rem;
    min-width: 0;
}
.course-table--conjugation td[data-desktop-strong="1"] { /* Mise en avant desktop des cellules "clés" : temps, participe ou terminaison selon le tableau. */
    font-weight: 700;
    color: #111827;
}
.course-table--conjugation td[data-desktop-list="1"] .course-table-cell-line { /* Prépare un retrait pour afficher une puce devant chaque ligne utile sur desktop. */
    position: relative;
    padding-left: 0.85rem;
}
.course-table--conjugation td[data-desktop-list="1"] .course-table-cell-line::before { /* Puce desktop générique utilisée pour les colonnes multi-lignes. */
    content: "•";
    position: absolute;
    left: 0;
    top: 0;
    color: #64748b;
    font-weight: 800;
}
.course-table--conjugation[data-conjugation-kind="participial"] td[data-column-key="terminaison"][data-desktop-list="1"] .course-table-cell-line:nth-child(1)::before,
.course-table--conjugation[data-conjugation-kind="participial"] td[data-column-key*="conjugaison"][data-desktop-list="1"] .course-table-cell-line:nth-child(1)::before,
.course-table--conjugation[data-conjugation-kind="participial"] td[data-column-key*="conjugation"][data-desktop-list="1"] .course-table-cell-line:nth-child(1)::before { /* Couleur de correspondance n°1 pour faire le lien entre Terminaison et Conjugaison. */
    color: #0f766e;
}
.course-table--conjugation[data-conjugation-kind="participial"] td[data-column-key="terminaison"][data-desktop-list="1"] .course-table-cell-line:nth-child(2)::before,
.course-table--conjugation[data-conjugation-kind="participial"] td[data-column-key*="conjugaison"][data-desktop-list="1"] .course-table-cell-line:nth-child(2)::before,
.course-table--conjugation[data-conjugation-kind="participial"] td[data-column-key*="conjugation"][data-desktop-list="1"] .course-table-cell-line:nth-child(2)::before { /* Couleur de correspondance n°2. */
    color: #1d4ed8;
}
.course-table--conjugation[data-conjugation-kind="participial"] td[data-column-key="terminaison"][data-desktop-list="1"] .course-table-cell-line:nth-child(3)::before,
.course-table--conjugation[data-conjugation-kind="participial"] td[data-column-key*="conjugaison"][data-desktop-list="1"] .course-table-cell-line:nth-child(3)::before,
.course-table--conjugation[data-conjugation-kind="participial"] td[data-column-key*="conjugation"][data-desktop-list="1"] .course-table-cell-line:nth-child(3)::before { /* Couleur de correspondance n°3. */
    color: #d97706;
}
.course-table--conjugation[data-conjugation-kind="participial"] td[data-column-key="terminaison"][data-desktop-list="1"] .course-table-cell-line:nth-child(4)::before,
.course-table--conjugation[data-conjugation-kind="participial"] td[data-column-key*="conjugaison"][data-desktop-list="1"] .course-table-cell-line:nth-child(4)::before,
.course-table--conjugation[data-conjugation-kind="participial"] td[data-column-key*="conjugation"][data-desktop-list="1"] .course-table-cell-line:nth-child(4)::before { /* Couleur de correspondance n°4. */
    color: #7c3aed;
}
.course-table-cell-line { /* Chaque ligne interne est un bloc indépendant pour gérer puces, espacements et retours à la ligne proprement. */
    display: block;
}

/* Éditeur Quill inline pour les tableaux (mode bubble) */
.table-cell-editor {
    min-height: 32px;
}
.table-cell-editor .ql-editor {
    padding: 0.25rem;
    min-height: 32px;
    font-size: 0.92rem;
}
.table-cell-editor .ql-editor p {
    margin: 0;
}
.table-cell-editor .ql-editor.ql-blank::before {
    font-style: normal;
    color: #9ca3af;
    left: 0.25rem;
}
.course-table tbody tr:nth-child(even) {
    background: #f9fafb;
}
.course-table tbody tr:hover {
    background: #eef2ff;
}
.course-table--vocab .course-korean {
    font-weight: 700;
    color: #111827;
}
.course-table--conjugation td {
    vertical-align: middle;
    min-height: 70px;
    height: 70px;
}
.course-table--conjugation td > * {
    margin-top: 0;
    margin-bottom: 0;
}
.course-conjugation-table__value {
    min-height: 56px;
    display: flex;
    align-items: center;
}
.course-romanization {
    color: #6b7280;
    font-style: italic;
}

/* -------------------- Dialogue -------------------- */
.course-dialogue {
    background: linear-gradient(135deg, #f3f4ff, #f9fafb);
    border-radius: 16px;
    border: 1px solid rgba(199, 210, 254, 0.9);
    padding: 1.2rem 1.2rem 1rem;
    margin: 1rem 0 1.2rem;
    position: relative;
    overflow: hidden;
}
.course-dialogue::before {
    content: "DIALOGUE";
    position: absolute;
    top: 10px;
    right: 14px;
    font-size: 0.7rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: #6366f1;
    background: rgba(255, 255, 255, 0.7);
    padding: 3px 7px;
    border-radius: 999px;
}
.course-dialogue__title {
    font-weight: 800;
    margin-bottom: 0.6rem;
    color: #111827;
}
.course-dialogue__line {
    padding: 0.65rem 0;
    border-bottom: 1px dashed rgba(99, 102, 241, 0.22);
}
.course-dialogue__line:last-child {
    border-bottom: 0;
    padding-bottom: 0;
}
.course-dialogue__speaker {
    font-weight: 800;
    color: #4338ca;
    margin-bottom: 0.2rem;
}
.course-dialogue__korean {
    font-size: 1.05rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
    color: #111827;
}
.course-dialogue__translation {
    color: #6b7280;
    font-style: italic;
    font-size: 0.95rem;
}

/* -------------------- Media (audio/video) -------------------- */
.course-media {
    margin: 0.6rem 0 0.8rem;
}
.course-audio {
    width: 100%;
}
.course-video {
    width: 100%;
    border-radius: 14px;
    border: 1px solid rgba(209, 213, 219, 0.8);
    background: #111827;
}
.course-video-embed {
    position: relative;
    width: 100%;
    padding-top: 56.25%;
    border-radius: 14px;
    overflow: hidden;
    border: 1px solid rgba(209, 213, 219, 0.8);
    background: #111827;
}
.course-video-embed iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
}
.course-media-caption {
    margin-top: 0.4rem;
    font-size: 0.9rem;
    color: #6b7280;
}

/* -------------------- Construction / Prononciation / Cartes -------------------- */
.course-construction {
    border: 1px solid rgba(148, 163, 184, 0.5);
    border-radius: 16px;
    background: #ffffff;
    padding: 1rem 1rem 1.1rem;
    margin: 1.1rem 0;
    box-shadow: 0 10px 26px rgba(15, 23, 42, 0.06);
}
.course-construction__title {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: #6b7280;
    font-weight: 800;
}
.course-construction__example {
    font-weight: 800;
    color: #111827;
    margin-top: 0.25rem;
}
.course-construction__grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
    margin-top: 0.9rem;
}
.course-construction__part {
    background: rgba(0, 71, 160, 0.05);
    border: 1px solid rgba(0, 71, 160, 0.12);
    border-radius: 14px;
    padding: 0.75rem 0.8rem;
}
.course-construction__label {
    font-size: 0.8rem;
    font-weight: 700;
    color: #6b7280;
    margin-bottom: 0.25rem;
}
.course-construction__value {
    font-weight: 800;
    color: #111827;
}

.course-pronunciation {
    border: 1px solid rgba(0, 71, 160, 0.14);
    background: rgba(239, 246, 255, 0.6);
    border-radius: 16px;
    padding: 1rem 1rem 1.1rem;
    margin: 1.1rem 0;
}
.course-pronunciation__korean {
    font-weight: 900;
    font-size: 1.35rem;
    color: #111827;
}
.course-pronunciation__romanization {
    color: #6b7280;
    font-style: italic;
}
.course-pronunciation__ipa {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    color: #374151;
    margin-top: 0.3rem;
}
.course-pronunciation__tips {
    margin-top: 0.6rem;
    color: #374151;
}

.course-chip {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.6rem;
    border-radius: 999px;
    border: 1px solid rgba(15, 23, 42, 0.14);
    background: rgba(15, 23, 42, 0.04);
    font-weight: 700;
    font-size: 1rem;
    color: #111827;
}

.course-example {
    border: 1px solid rgba(99, 102, 241, 0.18);
    background: rgba(99, 102, 241, 0.06);
    border-radius: 16px;
    padding: 0.9rem 1rem;
    margin: 1rem 0;
}
.course-example__korean {
    font-weight: 800;
    color: #111827;
    margin-bottom: 0.25rem;
}
.course-example__translation {
    color: #6b7280;
    font-style: italic;
}
.course-example-block__title {
    font-weight: 900;
    color: #111827;
    margin-bottom: 0.6rem;
}

/* -------------------- Gestionnaire particule -------------------- */
.course-particle-card {
    --particle-border: #e4e6ed;
    --particle-muted: #6b7280;
    --particle-n: var(--red);
    --particle-pt: var(--blue);
    --particle-ps: #16a34a;
    --particle-v: #f59e0b;
    --particle-s: var(--purple);
    --particle-c: #6b7280;
    --particle-vc: #8b5cf6;
    --particle-cd: #ef4444;
    --particle-cf: #10b981;
    --particle-s-shift: 2px;
    background: #fff;
    border: 1px solid var(--particle-border);
    border-radius: 16px;
    padding: 18px;
    box-shadow: 0 10px 30px rgba(31, 56, 93, 0.06);
    color: #1f2937;
    max-width: 100%;
    box-sizing: border-box;
}
.course-particle-list {
    display: grid;
    gap: 12px;
}
.course-particle-empty {
    padding: 12px;
    border: 1px dashed var(--particle-border);
    border-radius: 12px;
    font-size: 0.9rem;
    color: var(--particle-muted);
}
.course-particle-example {
    border: 1px solid var(--particle-border);
    border-radius: 14px;
    padding: 12px 14px;
    background: linear-gradient(180deg, #ffffff, #f8fafc);
    display: grid;
    gap: 10px;
}
.course-particle-example--warn {
    border-color: rgba(205, 46, 58, 0.35);
    background: linear-gradient(180deg, rgba(205, 46, 58, 0.08), #ffffff);
}
.course-particle-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    color: var(--particle-muted);
    font-size: 0.82rem;
    font-weight: 700;
}
.course-particle-status {
    display: inline-flex;
    align-items: center;
    padding: 4px 8px;
    border-radius: 999px;
    border: 1px solid var(--particle-border);
    background: #fff;
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--particle-muted);
}
.course-particle-status--bad {
    border-color: rgba(205, 46, 58, 0.4);
    color: #b91c1c;
}
.course-particle-status--ok {
    border-color: rgba(22, 163, 74, 0.35);
    color: #15803d;
}
.course-particle-parse {
    display: grid;
    justify-content: center;
    align-items: end;
    margin: 0 auto;
    row-gap: 6px;
}
.course-particle-parse--2 { grid-template-columns: repeat(2, max-content); }
.course-particle-parse--3 { grid-template-columns: repeat(3, max-content); }
.course-particle-parse--compact { column-gap: 12px; }
.course-particle-parse--tight { column-gap: 6px; }
.course-particle-parse--3.course-particle-parse--compact {
    column-gap: 0;
    --particle-token-gap: 12px;
}
.course-particle-parse--3.course-particle-parse--tight {
    column-gap: 0;
    --particle-token-gap: 6px;
}
.course-particle-parse--3 .course-particle-token:nth-child(3) {
    padding-left: var(--particle-token-gap, 0);
}
.course-particle-token {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}
.course-particle-syl {
    font-size: 1.6rem;
    font-weight: 800;
    letter-spacing: 0;
    line-height: 1.1;
    text-align: center;
    font-family: "Noto Sans KR", "Montserrat", sans-serif;
}
.course-particle-syl.n, .course-particle-lbl.n { color: var(--particle-n); }
.course-particle-syl.pt, .course-particle-lbl.pt { color: var(--particle-pt); }
.course-particle-syl.ps, .course-particle-lbl.ps { color: var(--particle-ps); }
.course-particle-syl.v, .course-particle-lbl.v { color: var(--particle-v); }
.course-particle-lbl {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "JetBrains Mono", monospace;
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: uppercase;
}
.course-particle-sline {
    grid-column: 1 / span 2;
    height: 2px;
    width: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, rgba(124, 45, 140, 0.8) 0%, rgba(124, 45, 140, 0.4) 70%, transparent 100%);
    transform: translateX(var(--particle-s-shift));
}
.course-particle-slabel {
    grid-column: 1 / span 2;
    justify-self: center;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "JetBrains Mono", monospace;
    font-size: 0.72rem;
    font-weight: 900;
    letter-spacing: 0;
    color: var(--particle-s);
}
.course-particle-note {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #4b5563;
}
.course-particle-note-arrow {
    color: var(--particle-pt);
    font-weight: 900;
}
.course-particle-legend {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid var(--particle-border);
    display: flex;
    flex-wrap: wrap;
    gap: 12px 18px;
    align-items: center;
    justify-content: space-between;
}
.course-particle-legend-items {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 14px;
    align-items: center;
}
.course-particle-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--particle-muted);
}
.course-particle-legend-item::before {
    content: "";
    width: 10px;
    height: 10px;
    border-radius: 3px;
    background: var(--c);
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.04);
}

/* Styles pour les syllabes Hangeul (format A+B=C) */
.course-particle-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    min-width: 0;
    max-width: 100%;
}

.course-particle-group-title {
    font-size: 1.1rem;
    font-weight: 800;
    color: #1f2937;
    text-align: center;
    margin-bottom: 4px;
    font-family: "Noto Sans KR", "Montserrat", sans-serif;
}

.course-particle-group > .course-particle-example--syllable:first-of-type {
    margin-top: 0;
}

.course-particle-group-wrapper {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 20px;
    flex-wrap: wrap;
    justify-content: center;
    max-width: 100%;
}

.course-particle-group .course-particle-example--syllable {
    flex: 0 0 auto;
    min-width: 0;
    max-width: 100%;
}

.course-particle-example--syllable {
    display: flex;
    flex-direction: column;
    gap: 8px;
    box-sizing: border-box;
    max-width: 100%;
}

/* Override les styles grid de course-particle-parse pour les syllabes */
.course-particle-syllable {
    display: flex !important;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    justify-content: safe center;
    gap: 8px;
    flex-wrap: nowrap;
    grid-template-columns: none !important;
    row-gap: 0 !important;
    column-gap: 8px !important;
    min-width: 0;
    max-width: 100%;
}

.course-particle-syllable .course-particle-token {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.course-particle-plus,
.course-particle-equals {
    font-size: 1.2rem;
    font-weight: 700;
    color: #6b7280;
    margin: 0 4px;
    line-height: 1;
    flex-shrink: 0;
    display: inline-block;
}

.course-particle-result {
    font-size: 1.6rem;
    font-weight: 800;
    letter-spacing: 0;
    line-height: 1.1;
    text-align: center;
    font-family: "Noto Sans KR", "Montserrat", sans-serif;
    color: #1f2937;
    margin-left: 4px;
    flex-shrink: 0;
}

/* Couleurs pour les nouveaux rôles (C, VC, CD, CF) */
.course-particle-syl.c, .course-particle-lbl.c { 
    color: #6b7280; 
}
.course-particle-syl.vc, .course-particle-lbl.vc { 
    color: #8b5cf6; 
}
.course-particle-syl.cd, .course-particle-lbl.cd { 
    color: #ef4444; 
}
.course-particle-syl.cf, .course-particle-lbl.cf { 
    color: #10b981; 
}

@media (max-width: 575.98px) {
    .course-particle-card {
        padding: 14px 10px;
        border-radius: 14px;
    }

    .course-particle-list {
        gap: 10px;
    }

    .course-particle-group {
        gap: 10px;
        margin-bottom: 10px;
    }

    .course-particle-group-wrapper {
        flex-direction: column;
        align-items: center;
        gap: 10px;
        width: 100%;
    }

    .course-particle-example {
        padding: 10px 12px;
    }

    .course-particle-group .course-particle-example--syllable {
        width: fit-content;
        max-width: 100%;
    }

    .course-particle-syllable {
        gap: 5px;
        column-gap: 5px !important;
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
    }

    .course-particle-syllable .course-particle-token {
        gap: 3px;
    }

    .course-particle-syl,
    .course-particle-result {
        font-size: 1.35rem;
    }

    .course-particle-lbl {
        font-size: 0.62rem;
        letter-spacing: 0;
    }

    .course-particle-plus,
    .course-particle-equals {
        margin: 0 1px;
        font-size: 1.05rem;
    }

    .course-particle-result {
        margin-left: 1px;
    }
}

/* ========================================================================
   Styles pour le bloc "Texte annoté"
   ========================================================================
   Permet d'afficher un texte avec des segments annotés (soulignés en bleu)
   et des lettres/chiffres alignés précisément en dessous de chaque segment.
   ======================================================================== */

/* Conteneur principal des blocs autonomes */
.course-annotated-text,
.course-character-image {
    margin: 1.5rem 0;
    padding: 1.5rem;
    background: #fff;
    border: 1px solid #e4e6ed;
    border-radius: 12px;
}

/* Zone d'affichage du texte annoté */
.annotated-text-display {
    font-size: 1.1rem;
    line-height: 1.8;
    color: #1f2937;
    word-wrap: break-word;
    position: relative;
    font-family: "Montserrat", sans-serif;
    display: inline-block;
    width: 100%;
}

/* Texte non annoté (sans soulignement) */
.annotated-text-plain {
    display: inline;
    white-space: pre-wrap; /* Préserver les espaces et retours à la ligne */
}

/* Wrapper pour un segment annoté + sa lettre
   Permet d'aligner précisément la lettre sous le segment */
.annotated-segment-wrapper {
    display: inline-block;
    position: relative;
    vertical-align: top; /* Alignement en haut pour éviter les décalages */
}

/* Segment de texte annoté (souligné en bleu) */
.annotated-segment {
    display: inline-block;
    text-decoration: underline;
    text-decoration-style: solid; /* Soulignement droit (pas ondulé) */
    text-decoration-color: #0047a0; /* Bleu */
    text-decoration-thickness: 2px;
    text-underline-offset: 4px;
    color: #1f2937;
    white-space: pre-wrap; /* Préserver les espaces et retours à la ligne */
}

/* Badge avec la lettre/chiffre aligné sous le segment annoté */
.annotated-label {
    display: block;
    width: 100%;
    text-align: center;
    margin-top: 0.5rem;
    min-width: 1.5rem;
    height: 1.5rem;
    line-height: 1.5rem;
    font-size: 0.85rem;
    font-weight: 800;
    color: #0047a0; /* Bleu pour correspondre au soulignement */
    background: rgba(0, 71, 160, 0.1); /* Fond bleu clair */
    border-radius: 4px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "JetBrains Mono", monospace;
}

/* ========================================================================
   Styles pour le bloc "Caractères (img)"
   ========================================================================
   Bloc permettant d'afficher une image de caractère(s) coréen(s) centrée,
   avec un texte formaté en dessous (couleur, gras, souligné, etc.).
   ======================================================================== */

/* Wrapper pour l'image (centrage) */
.character-image-wrapper,
.character-image-preview-img-wrapper {
    text-align: center;
    margin-bottom: 1rem;
}

/* Image du caractère(s)
   - Hauteur max : 300px (pour éviter les images trop grandes)
   - Largeur : auto (s'adapte au ratio, peut être carrée ou large)
   - Centrée horizontalement
   - Border-radius pour un rendu plus doux
   - Bordure noire pour délimiter l'image
*/
.character-image-img {
    max-height: 300px;
    width: auto;
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    border: 2px solid #000;
    display: inline-block;
}

/* Texte formaté en dessous de l'image */
.character-image-text {
    margin-top: 1rem;
    font-size: 1rem;
    line-height: 1.6;
    color: #1f2937;
    word-wrap: break-word;
}

.character-image-preview-text {
    margin-top: 1rem;
    font-size: 0.95rem;
    line-height: 1.5;
}

.course-word-card {
    border: 1px solid rgba(205, 46, 58, 0.18);
    background: rgba(205, 46, 58, 0.06);
    border-radius: 16px;
    padding: 1rem 1rem 1.1rem;
    margin: 1rem 0;
}
.course-word-card__korean {
    font-weight: 900;
    font-size: 1.25rem;
    color: #111827;
}
.course-word-card__romanization {
    color: #6b7280;
    font-style: italic;
}
.course-word-card__french {
    margin-top: 0.25rem;
    color: #374151;
}

.course-image {
    width: var(--course-image-width, 100%);
    max-width: 100%;
    margin: 1.1rem auto;
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid rgba(209, 213, 219, 0.8);
    box-shadow: 0 10px 26px rgba(15, 23, 42, 0.08);
    background: #fff;
}
.course-image img {
    width: 100%;
    height: auto;
    display: block;
}
.course-image figcaption {
    padding: 0.8rem 1rem;
    color: #6b7280;
    font-size: 0.92rem;
}

.course-cultural {
    border-radius: 16px;
    border: 1px solid rgba(245, 158, 11, 0.2);
    background: rgba(255, 251, 235, 0.75);
    padding: 1rem 1rem 1.1rem;
    margin: 1.1rem 0;
}
.course-cultural__title {
    font-weight: 900;
    color: #111827;
    margin-bottom: 0.4rem;
}
.course-cultural__icon {
    display: inline-flex;
    margin-right: 0.35rem;
    color: #f59e0b;
}
.course-cultural__content {
    color: #374151;
}

.course-character {
    border-radius: 16px;
    border: 1px solid rgba(17, 24, 39, 0.12);
    background: #fff;
    padding: 1rem 1rem 1.1rem;
    margin: 1.1rem 0;
    box-shadow: 0 10px 26px rgba(15, 23, 42, 0.06);
}
.course-character__top {
    display: flex;
    gap: 1rem;
    align-items: center;
}
.course-character__glyph {
    width: 72px;
    height: 72px;
    border-radius: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 2.4rem;
    font-weight: 900;
    color: #111827;
    background: rgba(0, 71, 160, 0.06);
    border: 1px solid rgba(0, 71, 160, 0.12);
}
.course-character__name {
    font-weight: 900;
    color: #111827;
}
.course-character__sound {
    color: #6b7280;
    font-style: italic;
}
.course-character__stroke img {
    width: 100%;
    max-width: 340px;
    border-radius: 14px;
    border: 1px solid rgba(209, 213, 219, 0.8);
    margin-top: 0.9rem;
}
.course-character__examples {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin-top: 0.9rem;
}

.course-definition {
    border-radius: 16px;
    border: 1px solid rgba(148, 163, 184, 0.5);
    background: rgba(248, 250, 252, 0.9);
    padding: 1rem 1rem 1.1rem;
    margin: 1.1rem 0;
}
.course-definition__term {
    font-weight: 900;
    color: #111827;
    margin-bottom: 0.35rem;
}
.course-definition__meaning {
    color: #374151;
}
.course-definition__example {
    margin-top: 0.8rem;
}

.course-hangul {
    border-radius: 16px;
    border: 1px solid rgba(0, 71, 160, 0.14);
    background: rgba(239, 246, 255, 0.55);
    padding: 1rem 1rem 1.1rem;
    margin: 1.1rem 0;
}
.course-hangul__parts {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.course-hangul__piece {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}
.course-hangul__piece-label {
    font-size: 0.85rem;
    color: #6b7280;
    font-style: italic;
}
.course-hangul__plus {
    font-weight: 900;
    color: #000000;
    opacity: 0.85;
}
.course-hangul__equals {
    font-weight: 900;
    color: #000000;
}
.course-hangul__result {
    font-size: 1.5rem;
    font-weight: 900;
    color: #111827;
    margin-left: 0.2rem;
}

.course-empty {
    padding: 1rem 1.1rem;
    border-radius: 16px;
    border: 1px dashed rgba(17, 24, 39, 0.18);
    background: rgba(17, 24, 39, 0.04);
}
.course-unknown {
    padding: 0.9rem 1rem;
    border-radius: 14px;
    border: 1px dashed rgba(205, 46, 58, 0.35);
    background: rgba(205, 46, 58, 0.06);
    color: #7f1d1d;
}

/* -------------------- Exercices -------------------- */
.course-exercise {
    border-radius: 18px;
    border: 1px solid rgba(209, 213, 219, 0.8);
    background: #fff;
    padding: 1.1rem 1.1rem 1rem;
    margin: 1.2rem 0;
    box-shadow: 0 10px 26px rgba(15, 23, 42, 0.06);
}
.course-exercise__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.8rem;
    margin-bottom: 0.75rem;
}
.course-exercise__title {
    font-weight: 900;
    color: #111827;
}
.course-exercise__badge {
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    border: 1px solid rgba(0, 71, 160, 0.18);
    background: rgba(0, 71, 160, 0.06);
    color: var(--blue);
}
.course-exercise__instructions {
    color: #374151;
    margin-bottom: 0.8rem;
}
.course-exercise__sentence {
    font-weight: 700;
    color: #111827;
    margin-bottom: 0.7rem;
}
.course-exercise__fields {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.7rem;
    margin: 0.7rem 0 0.4rem;
}
.course-exercise__label {
    font-size: 0.85rem;
    font-weight: 800;
    color: #6b7280;
    margin-bottom: 0.25rem;
}
.course-exercise__translation {
    color: #6b7280;
    font-style: italic;
    margin-top: 0.7rem;
}
.course-exercise__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    align-items: center;
    margin-top: 0.9rem;
}
.course-exercise__result {
    font-weight: 800;
    color: #111827;
}
.course-exercise__select.is-correct,
.course-match__select.is-correct,
.course-translation__select.is-correct,
.course-error-correction__input.is-correct,
.course-conjugation-table__input.is-correct {
    border-color: rgba(34, 197, 94, 0.6);
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.15);
}
.course-exercise__select.is-wrong,
.course-match__select.is-wrong,
.course-translation__select.is-wrong,
.course-error-correction__input.is-wrong,
.course-conjugation-table__input.is-wrong {
    border-color: rgba(239, 68, 68, 0.6);
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.12);
}

.course-conjugation-table__input {
    min-width: 140px;
    height: 56px;
    border: 1px solid rgba(17, 24, 39, 0.45);
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 0 0 3px rgba(17, 24, 39, 0.08);
}

.course-conjugation-table__input:focus {
    border-color: rgba(59, 130, 246, 0.7);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}

.course-conjugation-table__input::placeholder {
    color: #6b7280;
    opacity: 1;
}

.course-match {
    display: grid;
    gap: 0.6rem;
}
.course-match__row {
    display: grid;
    grid-template-columns: 1fr minmax(180px, 220px);
    gap: 0.75rem;
    align-items: center;
    padding: 0.65rem 0.75rem;
    border-radius: 14px;
    border: 1px solid rgba(209, 213, 219, 0.7);
    background: rgba(249, 250, 251, 0.8);
}
.course-match__left {
    font-weight: 800;
    color: #111827;
}

.course-translation {
    display: grid;
    gap: 0.6rem;
}
.course-translation__row {
    display: grid;
    grid-template-columns: 1fr minmax(220px, 280px);
    gap: 0.75rem;
    align-items: center;
    padding: 0.65rem 0.75rem;
    border-radius: 14px;
    border: 1px solid rgba(209, 213, 219, 0.7);
    background: rgba(249, 250, 251, 0.8);
}
.course-translation__left {
    font-weight: 800;
    color: #111827;
}

.course-error-correction {
    display: grid;
    gap: 0.7rem;
    margin-top: 0.7rem;
}
.course-exercise .course-error-correction__input.form-control {
    display: block;
    width: 100%;
    min-height: 120px;
    margin: 0;
    padding: 0.95rem 1rem;
    border: 2px solid #cbd5e1;
    border-radius: 14px;
    background: #ffffff;
    color: #111827;
    box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.04);
    resize: vertical;
}
.course-exercise .course-error-correction__input.form-control::placeholder {
    color: #6b7280;
    opacity: 1;
}
.course-exercise .course-error-correction__input.form-control:focus {
    outline: none;
    border-color: #3b82f6;
    background: #ffffff;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.14);
}
.course-error-correction__help {
    border-radius: 14px;
    border: 1px solid rgba(251, 191, 36, 0.35);
    background: rgba(254, 249, 195, 0.65);
    padding: 0.8rem 0.9rem;
}
.course-error-correction__answers {
    margin: 0;
    padding-left: 1.1rem;
}
.course-error-correction__answer-label {
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #92400e;
    margin-bottom: 0.35rem;
}
.course-error-correction__answer {
    font-weight: 800;
    color: #111827;
}
.course-error-correction__explanation {
    margin-top: 0.55rem;
    color: #4b5563;
}
.course-error-correction__explanation p,
.course-error-correction__context p {
    margin-bottom: 0.45rem;
}
.course-error-correction__explanation p:last-child,
.course-error-correction__context p:last-child {
    margin-bottom: 0;
}

.course-word-order {
    display: grid;
    gap: 0.75rem;
    margin-top: 0.65rem;
}
.course-word-order__bank,
.course-word-order__answer {
    min-height: 56px;
    border-radius: 14px;
    border: 1px dashed rgba(148, 163, 184, 0.7);
    background: rgba(249, 250, 251, 0.9);
    padding: 0.6rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}
.course-word-chip {
    cursor: pointer;
    user-select: none;
    padding: 0.35rem 0.7rem;
    border-radius: 999px;
    border: 1px solid rgba(0, 71, 160, 0.18);
    background: rgba(0, 71, 160, 0.06);
    font-weight: 800;
    color: #111827;
    transition: all 0.2s ease;
}
.course-word-chip:hover {
    transform: translateY(-1px);
    background: rgba(0, 71, 160, 0.1);
}

.course-quiz__question {
    padding: 0.75rem 0.85rem;
    border-radius: 14px;
    border: 1px solid rgba(209, 213, 219, 0.7);
    background: rgba(249, 250, 251, 0.8);
    margin-top: 0.75rem;
}
.course-quiz__text {
    font-weight: 800;
    color: #111827;
    margin-bottom: 0.45rem;
}
.course-quiz__options {
    display: grid;
    gap: 0.4rem;
}
.course-quiz__option {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    cursor: pointer;
    color: #374151;
}
.course-quiz__option input {
    margin-top: 0.2rem;
}
.course-quiz__question.is-correct {
    border-color: rgba(34, 197, 94, 0.45);
    background: rgba(34, 197, 94, 0.06);
}
.course-quiz__question.is-wrong {
    border-color: rgba(239, 68, 68, 0.45);
    background: rgba(239, 68, 68, 0.05);
}

.course-record {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.6rem;
    margin-top: 0.8rem;
}
.course-record__status {
    font-weight: 800;
    color: #6b7280;
}
.course-record__playback {
    width: 100%;
    margin-top: 0.5rem;
}

.course-hangul-series {
    --hangul-blue: #0047a0;
    --hangul-red: #cd2e3a;
    --hangul-gold: #b7791f;
    --hangul-ink: #111827;
    --hangul-line: #e5e7eb;
    display: grid;
    gap: 0.8rem;
}

.course-hangul-series__summary {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
}

.course-hangul-series__summary-item {
    min-width: 0;
    padding: 0.6rem 0.65rem;
    border: 1px solid var(--hangul-line);
    border-radius: 14px;
    background: #f8fafc;
}

.course-hangul-series__summary-label {
    display: block;
    margin-bottom: 0.2rem;
    color: #6b7280;
    font-size: 0.68rem;
    font-weight: 900;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.course-hangul-series__summary-value {
    display: block;
    min-height: 2rem;
    color: var(--hangul-ink);
    font-family: "Noto Sans KR", "Montserrat", Arial, sans-serif;
    font-size: 1.65rem;
    font-weight: 900;
    line-height: 1;
}

.course-hangul-series__summary-value--small {
    font-family: "Montserrat", Arial, sans-serif;
    font-size: 1rem;
    line-height: 1.35;
}

.course-hangul-series__builder {
    display: grid;
    grid-template-columns: 244px minmax(0, 1fr);
    gap: 0.9rem;
    align-items: start;
}

.course-hangul-series__board-wrap {
    display: grid;
    place-items: center;
}

.course-hangul-series__board {
    width: 244px;
    aspect-ratio: 1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr 0.72fr;
    grid-template-areas:
        "initial vowelRight"
        "vowelBottom ."
        "final final";
    gap: 7px;
    padding: 9px;
    border: 2px solid var(--hangul-ink);
    border-radius: 16px;
    background: #f8fafc;
}

.course-hangul-slot {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    min-height: 0;
    border: 2px dashed var(--slot-color);
    border-radius: 12px;
    background: #ffffff;
    color: var(--slot-color);
    cursor: pointer;
}

.course-hangul-slot.is-filled {
    border-style: solid;
    background: var(--slot-color);
    color: #ffffff;
}

.course-hangul-slot.is-muted {
    opacity: 0.34;
    filter: grayscale(0.6);
}

.course-hangul-slot--initial {
    --slot-color: var(--hangul-blue);
    grid-area: initial;
}

.course-hangul-slot--vowel-right {
    --slot-color: var(--hangul-red);
    grid-area: vowelRight;
}

.course-hangul-slot--vowel-bottom {
    --slot-color: var(--hangul-red);
    grid-area: vowelBottom;
}

.course-hangul-slot--final {
    --slot-color: var(--hangul-gold);
    grid-area: final;
}

.course-hangul-slot__label {
    position: absolute;
    top: 6px;
    left: 7px;
    right: 7px;
    color: currentColor;
    font-size: 0.56rem;
    font-weight: 900;
    line-height: 1.15;
    opacity: 0.82;
}

.course-hangul-slot__value {
    font-family: "Noto Sans KR", "Montserrat", Arial, sans-serif;
    font-size: 2.5rem;
    font-weight: 900;
    line-height: 1;
}

.course-hangul-series__controls {
    min-width: 0;
}

.course-hangul-series__tabs {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.4rem;
    margin-bottom: 0.55rem;
}

.course-hangul-tab {
    min-height: 36px;
    padding: 0.45rem 0.5rem;
    border: 1px solid var(--hangul-line);
    border-radius: 999px;
    background: #ffffff;
    color: #374151;
    cursor: pointer;
    font-size: 0.82rem;
    font-weight: 900;
}

.course-hangul-tab.is-active {
    border-color: var(--hangul-ink);
    background: var(--hangul-ink);
    color: #ffffff;
}

.course-hangul-series__palette {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 0.4rem;
    min-height: 96px;
    padding: 0.5rem;
    border: 1px solid var(--hangul-line);
    border-radius: 14px;
    background: #f8fafc;
}

.course-hangul-piece {
    display: grid;
    place-items: center;
    min-width: 0;
    min-height: 38px;
    border: 1px solid var(--piece-color);
    border-radius: 10px;
    background: #ffffff;
    color: var(--piece-color);
    cursor: pointer;
    font-family: "Noto Sans KR", "Montserrat", Arial, sans-serif;
    font-size: 1.15rem;
    font-weight: 900;
}

.course-hangul-piece:hover,
.course-hangul-piece:focus-visible {
    outline: none;
    background: #f8fafc;
    box-shadow: 0 0 0 3px rgba(0, 71, 160, 0.08);
}

.course-hangul-piece--initial {
    --piece-color: var(--hangul-blue);
}

.course-hangul-piece--medial {
    --piece-color: var(--hangul-red);
}

.course-hangul-piece--final {
    --piece-color: var(--hangul-gold);
}

.course-hangul-series__series-list,
.course-hangul-series__objectives {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0.65rem;
}

.course-hangul-series-button,
.course-hangul-objective {
    min-height: 34px;
    padding: 0.3rem 0.55rem;
    border: 1px solid var(--hangul-line);
    border-radius: 999px;
    background: #ffffff;
    color: var(--hangul-ink);
    cursor: pointer;
    font-weight: 900;
}

.course-hangul-series-button {
    font-size: 0.82rem;
}

.course-hangul-objective {
    min-width: 36px;
    font-family: "Noto Sans KR", "Montserrat", Arial, sans-serif;
    font-size: 1rem;
}

.course-hangul-series-button.is-active,
.course-hangul-objective.is-active {
    border-color: rgba(0, 71, 160, 0.4);
    background: rgba(0, 71, 160, 0.08);
    color: var(--hangul-blue);
}

.course-hangul-objective.is-done {
    border-color: rgba(22, 163, 74, 0.35);
    background: rgba(240, 253, 244, 0.9);
    color: #15803d;
}

.course-hangul-series__feedback {
    min-height: 1.4rem;
    margin-top: 0.5rem;
    color: #374151;
    font-size: 0.86rem;
    font-weight: 800;
}

.course-hangul-series__feedback.is-error {
    color: #cd2e3a;
}

.course-hangul-series__feedback.is-success {
    color: #15803d;
}

@media (max-width: 768px) {
    .course-hangul-series__builder {
        grid-template-columns: 1fr;
    }

    .course-hangul-series__board {
        width: min(100%, 244px);
    }

    .course-hangul-series__palette {
        grid-template-columns: repeat(6, minmax(0, 1fr));
    }
}

@media (max-width: 420px) {
    .course-hangul-series__summary {
        grid-template-columns: 1fr;
    }

    .course-hangul-series__palette {
        grid-template-columns: repeat(5, minmax(0, 1fr));
    }
}

/* -------------------- Responsive -------------------- */
@media (max-width: 768px) {
    .course-reader-layout {
        flex-direction: column;
    }
    .course-lesson-nav,
    .lesson-nav {
        position: static;
        flex: 0 0 auto;
        width: 100%;
    }
    .course-lesson-main {
        width: 100%;
        overflow: hidden;
    }
    .course-lesson-nav__list {
        flex-direction: row;
        overflow-x: auto;
        padding-bottom: 0.3rem;
    }
    .course-lesson-nav__link {
        width: auto;
        white-space: nowrap;
    }
    /* Responsive lesson-nav */
    .lesson-steps {
        display: flex;
        flex-direction: row;
        overflow-x: auto;
        gap: 8px;
        padding-bottom: 0.5rem;
        max-width: 100%;
        overscroll-behavior-x: contain;
        -webkit-overflow-scrolling: touch;
    }
    .lesson-step {
        display: flex;
        flex-direction: column;
        align-items: center;
        flex: 0 0 auto;
        width: min(76vw, 320px);
        min-width: min(76vw, 320px);
        max-width: min(76vw, 320px);
        padding: 6px;
    }
    .lesson-step::before {
        display: none;
    }
    .lesson-step__card {
        flex-direction: column;
        text-align: center;
        padding: 10px;
        width: 100%;
        min-width: 0;
    }
    .lesson-step__text {
        align-items: center;
        width: 100%;
    }
    .lesson-step__name {
        display: -webkit-box;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 2;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .course-lesson {
        padding: 1.5rem 1.2rem 1.7rem;
    }
    .course-dialogue {
        padding: 1rem 0.9rem 0.9rem;
    }
    .course-table-wrapper {
        border-radius: 10px;
    }
    /* -- Conjugation table → card layout on mobile -- */
    .course-table-wrapper--conjugation { /* En mobile le wrapper n'a plus besoin d'encadrer un scroll horizontal : on passe en cartes verticales. */
        overflow: visible;
        border: none;
        box-shadow: none;
        background: transparent;
        border-radius: 0;
    }
    .course-table-wrapper--conjugation::before,
    .course-table-wrapper--conjugation::after { /* On coupe les fades desktop, car ils n'ont plus de sens une fois le tableau transformé en cartes. */
        display: none;
    }
    .course-table--conjugation { /* Le tableau devient un simple conteneur de cartes mobile, sans contrainte de largeur de table classique. */
        display: block;
        min-width: 0;
        border: none;
        background: transparent;
    }
    .course-table--conjugation thead { /* L'en-tête tabulaire disparaît : les libellés seront réinjectés dans chaque cellule via td::before. */
        display: none;
    }
    .course-table--conjugation tbody { /* Empile les lignes du tableau comme une liste de cartes indépendantes. */
        display: flex;
        flex-direction: column;
        gap: 0.65rem;
    }
    .course-table--conjugation tbody tr { /* Chaque ancienne ligne de tableau devient une carte mobile avec ombre, bordure et badge. */
        display: flex;
        flex-direction: column;
        background: #fff;
        border-radius: 10px;
        box-shadow: 0 1px 4px rgba(0, 0, 0, 0.07);
        border: 1px solid #e2e8f0;
        padding: 0.7rem 0.85rem 0.85rem;
        position: relative;
        --conjugation-group-chip-bg: #eef2ff;
        --conjugation-group-chip-color: #3b5998;
    }
    .course-table--conjugation tbody tr::before { /* Badge en haut de carte : reprend le groupe courant (Présent, Passé, Futur, Participe présent...). */
        content: attr(data-group-label);
        display: inline-block;
        font-size: 0.7rem;
        font-weight: 700;
        letter-spacing: 0.01em;
        color: var(--conjugation-group-chip-color);
        background: var(--conjugation-group-chip-bg);
        padding: 0.15rem 0.55rem;
        border-radius: 4px;
        margin-bottom: 0.45rem;
        align-self: center;
        text-align: center;
    }
    .course-table--conjugation tbody tr[data-group-tone="present"] { /* Couleur dédiée au présent. */
        --conjugation-group-chip-bg: #ecfeff;
        --conjugation-group-chip-color: #0f766e;
    }
    .course-table--conjugation tbody tr[data-group-tone="passe"] { /* Couleur dédiée au passé. */
        --conjugation-group-chip-bg: #fff7ed;
        --conjugation-group-chip-color: #c2410c;
    }
    .course-table--conjugation tbody tr[data-group-tone="futur"] { /* Couleur dédiée au futur. */
        --conjugation-group-chip-bg: #eff6ff;
        --conjugation-group-chip-color: #1d4ed8;
    }
    .course-table--conjugation tbody tr[data-group-label=""]::before { /* Si un groupe n'existe pas, on n'affiche surtout pas de badge vide. */
        display: none;
    }
    .course-table--conjugation tbody tr:hover { /* Neutralise le hover desktop pour éviter un feedback inutile sur mobile. */
        background: #fff;
    }
    .course-table--conjugation td { /* Chaque cellule mobile devient une mini-ligne "label à gauche / valeur à droite". */
        display: flex;
        align-items: flex-start;
        gap: 0.5rem;
        padding: 0.28rem 0;
        border: none;
        min-height: 0;
        height: auto;
        background: transparent !important;
        white-space: normal;
        overflow-wrap: anywhere;
        line-height: 1.4;
        font-size: 0.95rem;
        color: #1f2937;
    }
    .course-table--conjugation td::before { /* Réinjecte le nom de la colonne dans la carte mobile : Terminaison, Conjugaison, Exemple, etc. */
        content: attr(data-label);
        flex: 0 0 6.2rem;
        font-size: 0.74rem;
        font-weight: 800;
        color: black;
        padding-top: 0.05rem;
    }
    .course-table--conjugation .course-table-cell-lines { /* Aère légèrement les lignes internes sur mobile pour garder la lecture confortable. */
        gap: 0.28rem;
    }
    .course-table--conjugation .course-table-cell-line { /* Prépare l'indentation nécessaire pour les puces affichées sur mobile. */
        position: relative;
        padding-left: 0.85rem;
    }
    .course-table--conjugation .course-table-cell-line::before { /* Puce générique mobile : on l'affiche partout pour homogénéiser les listes. */
        content: "•";
        position: absolute;
        left: 0;
        top: 0;
        color: #64748b;
        font-weight: 800;
    }
    .course-table--conjugation[data-conjugation-kind="participial"] td[data-column-key="terminaison"] .course-table-cell-line:nth-child(1)::before,
    .course-table--conjugation[data-conjugation-kind="participial"] td[data-column-key*="conjugaison"] .course-table-cell-line:nth-child(1)::before,
    .course-table--conjugation[data-conjugation-kind="participial"] td[data-column-key*="conjugation"] .course-table-cell-line:nth-child(1)::before { /* Couleur n°1 pour associer visuellement Terminaison et Conjugaison dans les participes. */
        color: #0f766e;
    }
    .course-table--conjugation[data-conjugation-kind="participial"] td[data-column-key="terminaison"] .course-table-cell-line:nth-child(2)::before,
    .course-table--conjugation[data-conjugation-kind="participial"] td[data-column-key*="conjugaison"] .course-table-cell-line:nth-child(2)::before,
    .course-table--conjugation[data-conjugation-kind="participial"] td[data-column-key*="conjugation"] .course-table-cell-line:nth-child(2)::before { /* Couleur n°2 pour la deuxième paire. */
        color: #1d4ed8;
    }
    .course-table--conjugation[data-conjugation-kind="participial"] td[data-column-key="terminaison"] .course-table-cell-line:nth-child(3)::before,
    .course-table--conjugation[data-conjugation-kind="participial"] td[data-column-key*="conjugaison"] .course-table-cell-line:nth-child(3)::before,
    .course-table--conjugation[data-conjugation-kind="participial"] td[data-column-key*="conjugation"] .course-table-cell-line:nth-child(3)::before { /* Couleur n°3 pour la troisième paire. */
        color: #d97706;
    }
    .course-table--conjugation[data-conjugation-kind="participial"] td[data-column-key="terminaison"] .course-table-cell-line:nth-child(4)::before,
    .course-table--conjugation[data-conjugation-kind="participial"] td[data-column-key*="conjugaison"] .course-table-cell-line:nth-child(4)::before,
    .course-table--conjugation[data-conjugation-kind="participial"] td[data-column-key*="conjugation"] .course-table-cell-line:nth-child(4)::before { /* Couleur n°4 pour la quatrième paire. */
        color: #7c3aed;
    }
    .course-table--conjugation td[data-is-group-key="1"] { /* On masque la première colonne en mobile car son contenu est déjà résumé par le badge de carte. */
        display: none;
    }
    .course-table--conjugation td[data-column-key="exemple"] { /* Séparateur léger avant les exemples pour les faire respirer et les rendre secondaires visuellement. */
        border-top: 1px solid #f1f5f9;
        padding-top: 0.4rem;
        margin-top: 0.15rem;
    }
    .conjugation-section__summary {
        flex-direction: column;
        align-items: flex-start;
    }
    .conjugation-section__summary-meta {
        width: 100%;
        justify-content: space-between;
    }
}
