:root {
    --bg: #F5F0E4;
    --bg-paper: #FAF6EC;
    --bg-paper-light: #FFFCF4;
    --ink: #1A2845;
    --ink-soft: #44557A;
    --ink-mute: #8A92A6;
    --rule: #A89C7E;
    --rule-soft: #C7BEA8;
    --paper-cream: #FAF6EC;

    --c-sovereign: #1F3A5F;
    --c-institutions: #5C3A7E;
    --c-justice: #6B2C2C;
    --c-immigration: #8B6914;
    --c-economy: #2E5530;
    --c-education: #1E5F60;
    --c-industry: #3D4D6B;
    --c-culture: #8B4513;
    --c-food: #7C5A2A;
    --c-water: #2C5F6F;
    --c-research: #3F2E6B;
    --c-defense: #4A4A2E;
    --c-debt: #5E4A2E;
    --c-equality: #6B3D5C;
    --c-mobility: #2E6B5C;
    --c-democracy: #5C2C6B;
    --c-security: #6B1F2E;
    --c-health: #2C6B5C;
    --c-bioethics: #5C5C2C;
    --c-biodiversity: #3D6B2C;
    --c-infra: #4A5C6B;
    --c-demography: #8B3A5C;
    --c-maritime: #2C4A6B;
    --c-overseas: #B85C3D;
    --c-scandals: #2A2438;
    --c-root: #0F1F3C;
}

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

body {
    font-family: 'EB Garamond', 'Garamond', Georgia, serif;
    background: var(--bg);
    color: var(--ink);
    overflow: hidden;
    height: 100vh;
    font-size: 16px;
    line-height: 1.5;
}

header {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 10;
    padding: 1.5rem 2rem 1rem;
    background: linear-gradient(to bottom, var(--bg) 60%, rgba(245, 240, 228, 0));
    pointer-events: none;
}

.header-inner {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    max-width: 1400px;
    margin: 0 auto;
    pointer-events: auto;
}

.title-block h1 {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.6rem;
    font-weight: 500;
    letter-spacing: 0.02em;
    color: var(--ink);
    line-height: 1.1;
}

.title-block .subtitle {
    font-size: 0.85rem;
    color: var(--ink-soft);
    font-style: italic;
    margin-top: 0.25rem;
    letter-spacing: 0.03em;
}

.controls {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.search-box {
    position: relative;
}

.search-box input {
    font-family: inherit;
    font-size: 0.95rem;
    color: var(--ink);
    background: var(--bg-paper);
    border: 0.5px solid var(--rule);
    border-radius: 2px;
    padding: 0.5rem 0.85rem 0.5rem 2rem;
    width: 280px;
    outline: none;
    transition: border-color 0.2s, background 0.2s;
}

.search-box input:focus {
    border-color: var(--ink);
    background: var(--bg-paper-light);
}

.search-box::before {
    content: "";
    position: absolute;
    left: 0.7rem;
    top: 50%;
    transform: translateY(-50%);
    width: 12px;
    height: 12px;
    border: 1.2px solid var(--ink-mute);
    border-radius: 50%;
    pointer-events: none;
}

.search-box::after {
    content: "";
    position: absolute;
    left: 1.4rem;
    top: 60%;
    width: 6px;
    height: 1.2px;
    background: var(--ink-mute);
    transform: rotate(45deg);
    pointer-events: none;
}

.btn {
    font-family: inherit;
    font-size: 0.85rem;
    background: transparent;
    border: 0.5px solid var(--rule);
    color: var(--ink);
    padding: 0.5rem 0.9rem;
    cursor: pointer;
    border-radius: 2px;
    transition: background 0.15s, border-color 0.15s;
    letter-spacing: 0.02em;
}

.btn:hover {
    background: var(--bg-paper);
    border-color: var(--ink-soft);
}

.canvas-container {
    width: 100vw;
    height: 100vh;
    cursor: grab;
}

.canvas-container:active {
    cursor: grabbing;
}

svg {
    width: 100%;
    height: 100%;
    display: block;
}

.link {
    stroke: var(--ink-soft);
    stroke-width: 1px;
    fill: none;
    opacity: 0.5;
    transition: opacity 0.3s, stroke 0.3s, stroke-width 0.3s;
}

.link.root-link {
    stroke: var(--ink);
    stroke-width: 1.2px;
    opacity: 0.7;
}

.link.transversal {
    stroke: var(--c-justice);
    stroke-width: 0.8px;
    stroke-dasharray: 4 3;
    opacity: 0.45;
}

.link.highlighted {
    stroke: var(--ink);
    stroke-width: 1.8px;
    opacity: 1;
}

.link.transversal.highlighted {
    stroke: var(--c-justice);
    stroke-width: 1.5px;
    opacity: 1;
}

.link.dimmed {
    opacity: 0.08;
}

.node {
    cursor: pointer;
}

.node .bubble {
    stroke: var(--paper-cream);
    stroke-width: 2px;
    transition: stroke-width 0.2s, opacity 0.3s, stroke 0.2s;
}

.node:hover .bubble {
    stroke-width: 3.5px;
    stroke: var(--ink);
}

.node.selected .bubble {
    stroke: var(--ink);
    stroke-width: 3px;
}

.node.dimmed .bubble,
.node.dimmed text {
    opacity: 0.18;
}

.node text {
    font-family: 'EB Garamond', Georgia, serif;
    pointer-events: none;
    user-select: none;
    transition: opacity 0.3s;
}

.legend {
    position: absolute;
    bottom: 1rem;
    left: 2rem;
    z-index: 5;
    font-size: 0.78rem;
    color: var(--ink-soft);
    font-style: italic;
    letter-spacing: 0.03em;
    max-width: 320px;
    line-height: 1.6;
}

.legend-line {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.legend-swatch {
    width: 26px;
    height: 0;
    border-top: 1px solid var(--ink-soft);
}

.legend-swatch.dashed {
    border-top: 1px dashed var(--c-justice);
}

.footer-note {
    position: absolute;
    bottom: 1rem;
    right: 2rem;
    z-index: 5;
    font-size: 0.75rem;
    color: var(--ink-mute);
    font-style: italic;
    letter-spacing: 0.04em;
}

/* Bouton flottant : revenir au parcours recommandé */
.parcours-fab {
    position: fixed;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%) translateY(24px);
    z-index: 40;
    background: var(--ink);
    color: var(--bg-paper);
    border: 0.5px solid var(--ink);
    padding: 0.65rem 1.3rem;
    font-family: 'EB Garamond', serif;
    font-size: 0.88rem;
    letter-spacing: 0.05em;
    cursor: pointer;
    border-radius: 999px;
    box-shadow: 0 6px 22px rgba(26, 40, 69, 0.22);
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease, background 0.2s ease;
}

.parcours-fab.visible {
    opacity: 1;
    pointer-events: auto;
    transform: translateX(-50%) translateY(0);
}

.parcours-fab:hover {
    background: var(--ink-soft);
    border-color: var(--ink-soft);
}

.parcours-fab .fab-icon {
    font-size: 1rem;
    line-height: 1;
}

.sidebar {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 66.666vw;
    min-width: 680px;
    max-width: 92vw;
    background: var(--bg-paper);
    border-left: 0.5px solid var(--rule);
    transform: translateX(100%);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 20;
    box-shadow: -2px 0 16px rgba(26, 40, 69, 0.06);
    display: flex;
    flex-direction: row;
    overflow: hidden;
}

.sidebar.open {
    transform: translateX(0);
}

/* Colonne principale : contenu textuel + scroll */
.sidebar-main {
    flex: 1 1 auto;
    min-width: 0;
    overflow-y: auto;
    overflow-x: hidden;
    position: relative;
}

.sidebar-inner {
    padding: 2rem 3rem 3rem;
    max-width: 820px;
    width: 100%;
    margin: 0 auto;
}

.chapter-toc {
    position: sticky;
    top: 0;
    border-bottom: 0.5px solid var(--rule-soft);
    padding: 0.75rem 2.5rem;
    z-index: 5;
    backdrop-filter: blur(8px);
    background: rgba(250, 246, 236, 0.94);
}

.chapter-toc-inner {
    max-width: 680px;
    margin: 0 auto;
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
    align-items: center;
}

.chapter-toc-label {
    font-family: 'Cormorant Garamond', serif;
    font-size: 0.7rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--ink-mute);
    margin-right: 0.5rem;
}

.chapter-toc-item {
    font-size: 0.78rem;
    color: var(--ink-soft);
    padding: 0.3rem 0.6rem;
    border: 0.5px solid var(--rule-soft);
    border-radius: 2px;
    cursor: pointer;
    background: transparent;
    font-family: inherit;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    letter-spacing: 0.02em;
}

.chapter-toc-item:hover {
    background: var(--bg-paper-light);
    border-color: var(--ink-soft);
    color: var(--ink);
}

.chapter-toc-item.active {
    background: var(--ink);
    border-color: var(--ink);
    color: var(--bg-paper);
}

.markdown-body {
    font-family: 'EB Garamond', Georgia, serif;
    color: var(--ink);
    line-height: 1.65;
    font-size: 1rem;
}

.markdown-body section.chapter-section {
    scroll-margin-top: 4rem;
    padding-top: 1.5rem;
    border-top: 0.5px solid var(--rule-soft);
    margin-top: 2rem;
}

.markdown-body section.chapter-section:first-of-type {
    border-top: none;
    padding-top: 0;
    margin-top: 0;
}

.markdown-body h2 {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.4rem;
    font-weight: 500;
    color: var(--ink);
    margin-bottom: 1rem;
    letter-spacing: 0.01em;
    line-height: 1.2;
}

.markdown-body h3 {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--ink);
    margin: 1.5rem 0 0.5rem;
    letter-spacing: 0.01em;
}

.markdown-body h6 {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.3rem;
    font-weight: 500;
    color: var(--ink);
    margin: 1.5rem 0 0.5rem;
    letter-spacing: 0.01em;
    text-decoration: underline;
}

.markdown-body p {
    margin-bottom: 1rem;
    text-align: justify;
    hyphens: auto;
}

.markdown-body p em:only-child,
.markdown-body p>em:first-child:last-child {
    display: block;
    font-size: 0.85rem;
    color: var(--ink-soft);
    padding-left: 1rem;
    border-left: 2px solid var(--rule-soft);
    margin: 1rem 0;
    line-height: 1.5;
}

.markdown-body strong {
    font-weight: 600;
    color: var(--ink);
}

.markdown-body ul,
.markdown-body ol {
    margin: 0.5rem 0 1rem 1.5rem;
}

.markdown-body li {
    margin-bottom: 0.3rem;
}

.markdown-body table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
    font-size: 0.9rem;
    background: var(--bg-paper-light);
}

.markdown-body th {
    background: var(--paper-cream);
    border-bottom: 1px solid var(--ink-soft);
    padding: 0.5rem 0.7rem;
    text-align: left;
    font-weight: 600;
    color: var(--ink);
    font-size: 0.85rem;
}

.markdown-body td {
    border-bottom: 0.5px solid var(--rule-soft);
    padding: 0.5rem 0.7rem;
    vertical-align: top;
}

.loading-indicator {
    text-align: center;
    color: var(--ink-mute);
    font-style: italic;
    padding: 3rem 0;
    font-size: 0.9rem;
}

.unavailable-notice {
    background: var(--bg-paper-light);
    border: 0.5px dashed var(--rule);
    border-radius: 2px;
    padding: 1.5rem;
    text-align: center;
    color: var(--ink-soft);
    font-style: italic;
    font-size: 0.92rem;
    line-height: 1.5;
    margin: 1.5rem 0;
}

.search-match-count {
    font-size: 0.75rem;
    color: var(--ink-mute);
    font-style: italic;
    margin-left: 0.5rem;
}

.sidebar-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 32px;
    height: 32px;
    border: 0.5px solid var(--rule);
    background: var(--bg-paper-light);
    color: var(--ink);
    cursor: pointer;
    font-size: 1.2rem;
    line-height: 1;
    border-radius: 50%;
    transition: background 0.2s, border-color 0.2s;
    z-index: 9;
}

.sidebar-close:hover {
    background: var(--bg);
    border-color: var(--ink);
}

.sidebar .ornament {
    width: 48px;
    height: 2px;
    margin-bottom: 1rem;
}

.sidebar .partie-label {
    font-family: 'Cormorant Garamond', serif;
    font-size: 0.75rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--ink-mute);
    margin-bottom: 0.5rem;
}

.sidebar h2 {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.6rem;
    font-weight: 500;
    line-height: 1.2;
    color: var(--ink);
    margin-bottom: 1rem;
}

.sidebar .summary {
    font-size: 0.95rem;
    color: var(--ink-soft);
    font-style: italic;
    margin-bottom: 1.5rem;
    line-height: 1.55;
}

.sidebar .divider {
    height: 0.5px;
    background: var(--rule-soft);
    margin: 1.5rem 0;
}

.sidebar .section-title {
    font-family: 'Cormorant Garamond', serif;
    font-size: 0.78rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--ink);
    margin-bottom: 0.85rem;
}

.sidebar ol {
    list-style: none;
    counter-reset: section-counter;
}

.sidebar ol li {
    counter-increment: section-counter;
    padding: 0.4rem 0 0.4rem 2rem;
    position: relative;
    font-size: 0.93rem;
    color: var(--ink);
    line-height: 1.45;
    border-bottom: 0.5px solid var(--rule-soft);
}

.sidebar ol li:last-child {
    border-bottom: none;
}

.sidebar ol li::before {
    content: counter(section-counter, decimal-leading-zero);
    position: absolute;
    left: 0;
    top: 0.5rem;
    font-family: 'Cormorant Garamond', serif;
    font-size: 0.85rem;
    color: var(--ink-mute);
    letter-spacing: 0.05em;
}

.sidebar .related {
    margin-top: 1.25rem;
}

.sidebar .related-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.related-item {
    background: var(--bg-paper-light);
    border: 0.5px solid var(--rule-soft);
    border-radius: 2px;
    padding: 0.6rem 0.85rem;
    font-size: 0.9rem;
    color: var(--ink);
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
}

.related-item:hover {
    background: var(--bg);
    border-color: var(--ink-soft);
}

.related-item .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
    margin-top: 6px;
}

.related-item .num {
    font-family: 'Cormorant Garamond', serif;
    font-size: 0.78rem;
    color: var(--ink-mute);
    letter-spacing: 0.05em;
}

.related-item .reason {
    font-size: 0.82rem;
    color: var(--ink-soft);
    font-style: italic;
    margin-top: 0.2rem;
    line-height: 1.4;
}

/* =========================================================
    ONBOARDING — écran d'accueil deux méthodes
    ========================================================= */
.onboarding-overlay {
    position: fixed;
    inset: 0;
    background: var(--bg);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    opacity: 1;
    transition: opacity 0.45s ease;
}

.onboarding-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.onboarding-inner {
    max-width: 980px;
    width: 100%;
    text-align: center;
}

.onboarding-eyebrow {
    font-family: 'EB Garamond', serif;
    font-size: 0.72rem;
    letter-spacing: 0.32em;
    text-transform: uppercase;
    color: var(--ink-mute);
    margin-bottom: 1rem;
}

.onboarding-title {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 500;
    font-size: clamp(2rem, 4.5vw, 3.2rem);
    color: var(--ink);
    line-height: 1.1;
    margin-bottom: 0.5rem;
}

.onboarding-title em {
    font-style: italic;
    color: var(--ink-soft);
}

.onboarding-sub {
    font-family: 'EB Garamond', serif;
    font-style: italic;
    color: var(--ink-soft);
    font-size: 1.05rem;
    margin-bottom: 2.5rem;
}

.onboarding-divider {
    width: 80px;
    height: 1px;
    background: var(--rule);
    margin: 0 auto 2.5rem;
    position: relative;
}

.onboarding-divider::before {
    content: "❦";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--bg);
    color: var(--rule);
    padding: 0 0.6rem;
    font-size: 0.9rem;
}

.onboarding-choices {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

@media (max-width: 720px) {
    .onboarding-choices {
        grid-template-columns: 1fr;
    }
}

.onboarding-card {
    background: var(--bg-paper);
    border: 0.5px solid var(--rule);
    padding: 2rem 1.75rem 1.75rem;
    text-align: left;
    cursor: pointer;
    transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
    position: relative;
    overflow: hidden;
}

.onboarding-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--ink);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.35s ease;
}

.onboarding-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 32px rgba(26, 40, 69, 0.10);
    border-color: var(--ink-soft);
}

.onboarding-card:hover::before {
    transform: scaleX(1);
}

.onboarding-card-num {
    font-family: 'Cormorant Garamond', serif;
    font-size: 0.7rem;
    letter-spacing: 0.2em;
    color: var(--ink-mute);
    text-transform: uppercase;
    margin-bottom: 0.5rem;
}

.onboarding-card-title {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.75rem;
    font-weight: 500;
    color: var(--ink);
    margin-bottom: 0.5rem;
    line-height: 1.15;
}

.onboarding-card-desc {
    font-family: 'EB Garamond', serif;
    font-size: 0.98rem;
    color: var(--ink-soft);
    line-height: 1.55;
    margin-bottom: 1.25rem;
}

.onboarding-card-cta {
    font-family: 'EB Garamond', serif;
    font-size: 0.85rem;
    color: var(--ink);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.onboarding-card-cta::after {
    content: "→";
    transition: transform 0.25s ease;
}

.onboarding-card:hover .onboarding-card-cta::after {
    transform: translateX(4px);
}

.onboarding-footer {
    font-family: 'EB Garamond', serif;
    font-size: 0.78rem;
    color: var(--ink-mute);
    font-style: italic;
}

/* Bouton "Changer de méthode" dans le header */
.method-switch {
    font-family: 'EB Garamond', serif;
    font-size: 0.78rem;
    color: var(--ink-soft);
    background: transparent;
    border: 0.5px solid var(--rule-soft);
    border-radius: 2px;
    padding: 0.35rem 0.7rem;
    cursor: pointer;
    letter-spacing: 0.05em;
    transition: background 0.15s, border-color 0.15s;
}

.method-switch:hover {
    background: var(--bg-paper);
    border-color: var(--ink-soft);
    color: var(--ink);
}

/* =========================================================
    PARCOURS DÉCOUVERTE — questions polémiques
    ========================================================= */
.discovery-overlay {
    position: fixed;
    inset: 0;
    background: var(--bg);
    z-index: 999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    overflow-y: auto;
    opacity: 1;
    transition: opacity 0.4s ease;
}

.discovery-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.discovery-inner {
    max-width: 760px;
    width: 100%;
    margin: auto;
}

.discovery-progress {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 2.5rem;
}

.discovery-progress-dot {
    width: 28px;
    height: 2px;
    background: var(--rule-soft);
    transition: background 0.25s ease;
}

.discovery-progress-dot.done {
    background: var(--ink-soft);
}

.discovery-progress-dot.active {
    background: var(--ink);
}

.discovery-progress-label {
    font-family: 'EB Garamond', serif;
    font-size: 0.75rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--ink-mute);
    margin-left: 0.75rem;
}

.discovery-card {
    background: var(--bg-paper);
    border: 0.5px solid var(--rule);
    padding: 3rem 2.5rem 2.5rem;
    text-align: center;
    box-shadow: 0 4px 24px rgba(26, 40, 69, 0.06);
}

.discovery-eyebrow {
    font-family: 'EB Garamond', serif;
    font-size: 0.72rem;
    letter-spacing: 0.28em;
    text-transform: uppercase;
    color: var(--ink-mute);
    margin-bottom: 1.5rem;
}

.discovery-question {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 500;
    font-size: clamp(1.4rem, 2.6vw, 1.9rem);
    color: var(--ink);
    line-height: 1.3;
    margin-bottom: 1rem;
}

.discovery-context {
    font-family: 'EB Garamond', serif;
    font-style: italic;
    font-size: 0.95rem;
    color: var(--ink-soft);
    line-height: 1.55;
    margin: 0 auto 2.25rem;
    max-width: 580px;
}

.discovery-reactions {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
    max-width: 540px;
    margin: 0 auto;
}

@media (max-width: 540px) {
    .discovery-reactions {
        grid-template-columns: 1fr;
    }

    .discovery-card {
        padding: 2rem 1.25rem 1.5rem;
    }
}

.discovery-reaction {
    background: transparent;
    border: 0.5px solid var(--rule);
    padding: 0.85rem 1rem;
    cursor: pointer;
    font-family: 'EB Garamond', serif;
    font-size: 0.95rem;
    color: var(--ink-soft);
    transition: all 0.2s ease;
    text-align: center;
    line-height: 1.3;
}

.discovery-reaction:hover {
    background: var(--bg-paper-light);
    border-color: var(--ink);
    color: var(--ink);
    transform: translateY(-2px);
}

.discovery-skip {
    margin-top: 2rem;
    background: transparent;
    border: none;
    color: var(--ink-mute);
    font-family: 'EB Garamond', serif;
    font-style: italic;
    font-size: 0.85rem;
    cursor: pointer;
    text-decoration: underline;
    text-decoration-color: var(--rule-soft);
    text-underline-offset: 3px;
}

.discovery-skip:hover {
    color: var(--ink-soft);
}

/* Écran final : parcours recommandé */
.discovery-results-title {
    font-family: 'Cormorant Garamond', serif;
    font-size: 2.2rem;
    font-weight: 500;
    color: var(--ink);
    margin-bottom: 0.5rem;
}

.discovery-results-sub {
    font-family: 'EB Garamond', serif;
    font-style: italic;
    color: var(--ink-soft);
    margin-bottom: 2rem;
}

.discovery-path {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    text-align: left;
    margin-bottom: 2rem;
}

.discovery-path-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.9rem 1rem;
    background: var(--bg-paper-light);
    border: 0.5px solid var(--rule-soft);
    cursor: pointer;
    transition: all 0.2s ease;
}

.discovery-path-item:hover {
    border-color: var(--ink-soft);
    transform: translateX(4px);
}

.discovery-path-num {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.4rem;
    color: var(--ink-mute);
    font-weight: 500;
    min-width: 28px;
    text-align: center;
}

.discovery-path-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.discovery-path-content {
    flex: 1;
}

.discovery-path-title {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.05rem;
    color: var(--ink);
    margin-bottom: 0.15rem;
    font-weight: 500;
}

.discovery-path-meta {
    font-family: 'EB Garamond', serif;
    font-size: 0.78rem;
    color: var(--ink-mute);
    letter-spacing: 0.04em;
}

.discovery-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.discovery-actions .btn {
    padding: 0.7rem 1.4rem;
}

.discovery-actions .btn-primary {
    background: var(--ink);
    color: var(--bg-paper);
}

.discovery-actions .btn-primary:hover {
    background: var(--ink-soft);
    color: var(--bg-paper);
}

/* =========================================================
    ÉTOILES DE DIFFICULTÉ
    ========================================================= */
.difficulty-stars {
    display: inline-flex;
    gap: 1px;
    margin-left: 0.5rem;
    vertical-align: middle;
}

.difficulty-star {
    color: var(--rule-soft);
    font-size: 0.85em;
    line-height: 1;
}

.difficulty-star.filled {
    color: #B89647;
}

.difficulty-label {
    font-family: 'EB Garamond', serif;
    font-size: 0.72rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--ink-mute);
    margin-left: 0.5rem;
}

/* Étoiles sur les bulles SVG (chapitres) */
.node-difficulty-star {
    pointer-events: none;
}

/* En-tête de chapitre avec étoiles */
.chapter-difficulty {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 0.5rem;
    font-family: 'EB Garamond', serif;
    font-size: 0.78rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--ink-mute);
}

.chapter-difficulty .stars {
    display: inline-flex;
    gap: 2px;
}

.chapter-difficulty .stars span {
    color: var(--rule-soft);
    font-size: 0.95rem;
}

.chapter-difficulty .stars span.filled {
    color: #B89647;
}

/* =========================================================
    SOMMAIRE — panneau latéral droit rétractable
    ========================================================= */
/* L'ancien chapter-toc sticky reste défini, mais on l'override */
.chapter-toc {
    /* Désactivé : remplacé par le panneau latéral */
    display: none;
}

/* Bouton "Sommaire" : sticky en haut de la colonne main */
.toc-toggle {
    position: sticky;
    top: 0;
    z-index: 6;
    display: flex;
    justify-content: flex-end;
    padding: 0.5rem 3.5rem 0 1rem;
    background: linear-gradient(to bottom, var(--bg-paper) 0%, var(--bg-paper) 75%, transparent 100%);
    pointer-events: none;
}

.toc-toggle-btn {
    pointer-events: auto;
    background: var(--bg-paper);
    border: 0.5px solid var(--rule);
    padding: 0.45rem 0.85rem;
    font-family: 'EB Garamond', serif;
    font-size: 0.8rem;
    letter-spacing: 0.1em;
    color: var(--ink-soft);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s ease;
    text-transform: uppercase;
}

.toc-toggle-btn:hover {
    background: var(--bg-paper-light);
    border-color: var(--ink-soft);
    color: var(--ink);
}

.toc-toggle-btn.open {
    background: var(--ink);
    color: var(--bg-paper);
    border-color: var(--ink);
}

.toc-toggle-icon {
    font-size: 0.7rem;
    transition: transform 0.25s ease;
    display: inline-block;
}

/* Panneau Sommaire : colonne flex qui pousse le contenu vers la gauche */
.toc-side-panel {
    flex: 0 0 0;
    width: 0;
    background: var(--bg-paper-light);
    border-left: 0.5px solid var(--rule);
    transition: width 0.35s cubic-bezier(0.4, 0, 0.2, 1),
        flex-basis 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    position: relative;
}

.toc-side-panel.open {
    flex: 0 0 280px;
    width: 280px;
}

.toc-side-panel-scroll {
    height: 100%;
    overflow-y: auto;
    padding: 1.5rem 1.25rem 2rem;
    width: 280px;
    /* largeur fixe interne pour éviter le reflow de texte pendant l'anim */
}

.toc-side-panel-title {
    font-family: 'Cormorant Garamond', serif;
    font-size: 0.7rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--ink-mute);
    margin-bottom: 0.85rem;
    padding-bottom: 0.5rem;
    border-bottom: 0.5px solid var(--rule-soft);
}

.toc-side-panel-list {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.toc-side-item {
    font-family: 'EB Garamond', serif;
    font-size: 0.85rem;
    color: var(--ink-soft);
    padding: 0.5rem 0.6rem;
    border-left: 2px solid transparent;
    cursor: pointer;
    background: transparent;
    border-top: none;
    border-right: none;
    border-bottom: none;
    text-align: left;
    transition: all 0.15s ease;
    line-height: 1.35;
}

.toc-side-item:hover {
    background: var(--bg-paper);
    color: var(--ink);
}

.toc-side-item.active {
    color: var(--ink);
    border-left-color: var(--ink);
    font-weight: 500;
}

.toc-side-item-num {
    color: var(--ink-mute);
    font-size: 0.75rem;
    margin-right: 0.4rem;
}

/* Sur petit écran : le panneau passe en overlay full-width au-dessus du main */
@media (max-width: 720px) {
    .search-box input {
        width: 180px;
    }

    .sidebar {
        width: 100%;
        min-width: 0;
        max-width: 100%;
    }

    .header-inner {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }

    .legend {
        display: none;
    }

    .toc-side-panel {
        position: absolute;
        top: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        flex: none;
        transform: translateX(100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 30;
    }

    .toc-side-panel.open {
        transform: translateX(0);
        width: 100%;
    }

    .toc-side-panel-scroll {
        width: 100%;
    }
}
