        body {
            font-family: 'Inter', sans-serif;
            user-select: none;
            transition: background-color 0.25s ease, color 0.25s ease;
        }

        .editor-content { user-select: text; }
        .editor-content:focus { outline: none; }
        
        .editor-content p {
            margin-bottom: 1em;
            text-indent: 1.5em;
            line-height: inherit;
        }
        
        .editor-content p:first-of-type,
        .editor-content h1 + p,
        .editor-content h2 + p,
        .editor-content h3 + p {
            text-indent: 0;
        }

        .drop-cap::first-letter {
            float: left;
            font-size: 3.2em;
            line-height: 0.8;
            padding-top: 4px;
            padding-right: 8px;
            padding-left: 3px;
            font-weight: bold;
            color: currentColor;
        }

        /* Paper Textures for Realistic Book View */
        .paper-creme {
            background-color: #fcf8f2 !important;
            color: #2b2621 !important;
        }
        .paper-ivoire {
            background-color: #f7f5ec !important;
            color: #242422 !important;
        }
        .paper-blanc {
            background-color: #ffffff !important;
            color: #111111 !important;
        }

        /* 3D Realistic Book Rendering */
        .book-page-3d {
            box-shadow: 0 15px 35px -5px rgba(0, 0, 0, 0.35), 0 5px 15px rgba(0, 0, 0, 0.2);
            position: relative;
            box-sizing: border-box;
            overflow: hidden;
            transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
            border-radius: 2px 8px 8px 2px;
        }

        .book-spread-3d {
            display: flex;
            box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5), 0 0 20px rgba(0,0,0,0.1);
            background: #d8d3cd;
            padding: 3px;
            border-radius: 4px;
            position: relative;
        }

        /* Spine Gutter Shadow */
        .book-spread-3d::after {
            content: "";
            position: absolute;
            top: 0;
            left: 50%;
            bottom: 0;
            width: 36px;
            transform: translateX(-50%);
            background: linear-gradient(to right, 
                rgba(0,0,0,0) 0%, 
                rgba(0,0,0,0.18) 40%, 
                rgba(0,0,0,0.32) 50%, 
                rgba(0,0,0,0.18) 60%, 
                rgba(0,0,0,0) 100%);
            pointer-events: none;
            z-index: 10;
        }

        /* Page Flip Animation Effect */
        @keyframes pageTurn {
            0% { transform: rotateY(0deg); }
            50% { transform: rotateY(-15deg) scale(0.98); }
            100% { transform: rotateY(0deg); }
        }
        .page-turning {
            animation: pageTurn 0.4s ease-in-out;
        }

        /* Custom Scrollbars */
        ::-webkit-scrollbar { width: 6px; height: 6px; }
        ::-webkit-scrollbar-track { background: transparent; }
        .dark ::-webkit-scrollbar-thumb { background: #334155; border-radius: 3px; }
        html:not(.dark) ::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }

        .editor-content hr.page-break {
            margin: 1.5rem 0;
            border: 0;
            border-top: 2px dashed rgba(217, 119, 6, 0.4);
        }

        /* Aperçu paginé (pages générées par Paged.js) */
        #book-render-container .pagedjs_pages {
            display: flex;
            align-items: flex-start;
        }
        #book-render-container .pagedjs_page {
            flex: none;
            box-shadow: 0 15px 35px -5px rgba(0, 0, 0, 0.35), 0 5px 15px rgba(0, 0, 0, 0.2);
        }

/* ---- Navigation & menus ---- */
.nav-btn { padding: 0.375rem 0.625rem; border-radius: 0.375rem; font-weight: 500; display: flex; align-items: center; gap: 0.375rem; transition: background-color .15s, color .15s; color: #475569; }
.dark .nav-btn { color: #cbd5e1; }
.nav-btn:hover { background: #f1f5f9; }
.dark .nav-btn:hover { background: #1e293b; }
.nav-btn.active { color: #b45309; background: rgba(217, 119, 6, 0.1); font-weight: 700; }
.dark .nav-btn.active { color: #fbbf24; }

.menu-item { width: 100%; text-align: left; padding: 0.5rem 0.75rem; display: flex; align-items: center; gap: 0.625rem; }
.menu-item:hover { background: rgba(217, 119, 6, 0.1); }
.menu-item i { width: 1rem; text-align: center; color: #d97706; }
.menu-item kbd { margin-left: auto; font-size: 10px; opacity: .55; font-family: ui-monospace, monospace; }

.palette-row { display: flex; align-items: center; gap: .75rem; padding: .5rem 1rem; font-size: .8125rem; cursor: pointer; }
.palette-row i { width: 1rem; text-align: center; color: #d97706; }
.palette-row.sel, .palette-row:hover { background: rgba(217, 119, 6, 0.12); }
.palette-row kbd { margin-left: auto; font-size: 10px; opacity: .55; font-family: ui-monospace, monospace; }

/* ---- Mode concentration ---- */
body.focus-mode #sidebar-chapters,
body.focus-mode #preview-panel { display: none !important; }
body.focus-mode #app-header { opacity: .25; transition: opacity .2s; }
body.focus-mode #app-header:hover { opacity: 1; }

/* ---- Liseuse ---- */
#reader-surface { font-size: 19px; }
#reader-surface.theme-light { background: #fff; color: #1a1a1a; }
#reader-surface.theme-sepia { background: #f4ecd8; color: #433422; }
#reader-surface.theme-dark  { background: #16181d; color: #d6d3cc; }
#reader-surface p { margin: 0 0 .9em; text-align: justify; hyphens: auto; }
#reader-surface h1, #reader-surface h2, #reader-surface h3 { font-weight: 700; margin: 1.4em 0 .6em; line-height: 1.25; }
#reader-surface h1 { font-size: 1.7em; text-align: center; }
#reader-surface h2 { font-size: 1.35em; }
#reader-surface img { max-width: 100%; height: auto; margin: 1em auto; display: block; }
#reader-surface blockquote { margin: 1em 1.5em; font-style: italic; opacity: .9; }
#reader-surface a { color: inherit; text-decoration: underline; text-decoration-color: rgba(217,119,6,.6); }
#reader-surface hr.page-break { border: 0; border-top: 1px dashed rgba(127,127,127,.4); margin: 2em 0; }
.reader-row { display: flex; align-items: center; gap: .5rem; padding: .5rem .625rem; border-radius: .5rem; cursor: pointer; border: 1px solid transparent; font-size: .75rem; }
.reader-row:hover { background: rgba(127,127,127,.1); }
.reader-row.active { background: rgba(217,119,6,.1); border-color: rgba(217,119,6,.4); }
.toc-row { display: block; width: 100%; text-align: left; padding: .375rem .5rem; border-radius: .375rem; font-size: .75rem; }
.toc-row:hover { background: rgba(127,127,127,.12); }
.toc-row.active { color: #d97706; font-weight: 600; }

@media (display-mode: standalone) { #btn-install { display: none !important; } }

#reader-surface, #reader-surface * { user-select: text; }

/* ---- Fenêtre Couverture & impression ---- */
.studio-tab { padding: .375rem .875rem; border-radius: .375rem; font-weight: 600; color: #526074; }
.studio-tab:hover { background: rgba(127,127,127,.12); }
.studio-tab.active { color: #92400e; background: rgba(217,119,6,.12); }
.dark .studio-tab.active { color: #fbbf24; }
.studio-label { display: block; font-size: 11px; font-weight: 600; color: #64748b; margin-bottom: .25rem; }
.studio-input { width: 100%; background: #f8fafc; border: 1px solid #e2e8f0; border-radius: .5rem; padding: .4rem .6rem; font-size: .75rem; color: inherit; }
.dark .studio-input { background: #020617; border-color: #1e293b; }
.studio-input:focus { outline: none; border-color: #d97706; }
.studio-color { width: 100%; height: 2rem; padding: 0; border: 1px solid #cbd5e1; border-radius: .375rem; cursor: pointer; background: transparent; }
#cv-view-front.active, #cv-view-wrap.active { background: rgba(217,119,6,.15); color: #b45309; font-weight: 700; }
.dark #cv-view-front.active, .dark #cv-view-wrap.active { color: #fbbf24; }

/* ---- Aperçu assemblé (pages calculées par chapitre) ---- */
.nt-row { display: flex; align-items: flex-start; }
.nt-page { flex: none; position: relative; box-sizing: content-box; overflow: hidden; box-shadow: 0 15px 35px -5px rgba(0,0,0,.35), 0 5px 15px rgba(0,0,0,.2); }
.nt-sheet { position: relative; overflow: hidden; }
.nt-page.with-bleed .nt-sheet { overflow: visible; outline: 1px dashed rgba(255, 0, 80, .75); }
.nt-sheet .pagedjs_page { background: transparent !important; box-shadow: none !important; margin: 0 !important; }
.nt-run { position: absolute; display: flex; align-items: center; font-size: 8pt; letter-spacing: .08em; text-transform: uppercase; color: #6b6b6b; pointer-events: none; }
.nt-loading { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 12px; color: #94a3b8; }

/* ---- Barre d'outils de l'éditeur ---- */
.tb { padding: .375rem .5rem; border-radius: .25rem; color: inherit; }
.tb:hover { background: #f1f5f9; }
.dark .tb:hover { background: #1e293b; }
.tb:disabled { opacity: .35; pointer-events: none; }
.tb.tb-active { background: rgba(217, 119, 6, .18); color: #b45309; }
.dark .tb.tb-active { color: #fbbf24; }
.tb-wide { padding: .25rem .5rem; background: #f1f5f9; border: 1px solid #e2e8f0; border-radius: .25rem; font-size: .75rem; display: flex; align-items: center; gap: .25rem; }
.dark .tb-wide { background: #1e293b; border-color: #334155; }
.tb-wide:hover { background: #e2e8f0; }
.dark .tb-wide:hover { background: #334155; }
.tb-sep { height: 1rem; width: 1px; background: #e2e8f0; margin: auto .25rem; }
.dark .tb-sep { background: #1e293b; }

/* ---- Contenu de l'éditeur (ProseMirror) ---- */
.ProseMirror { outline: none; min-height: 400px; white-space: pre-wrap; word-wrap: break-word; user-select: text; caret-color: #d97706; }
.ProseMirror p { margin-bottom: 1em; text-indent: var(--st-indent, 1.5em); text-align: var(--st-align, left); }
.ProseMirror p.verse { text-indent: 0; margin-left: var(--v-left, 1.5em); margin-right: var(--v-right, 1.5em); font-size: var(--v-size, 1em); font-style: var(--v-style, italic); text-align: var(--v-align, left); margin-top: .8em; }
.ProseMirror p:first-child, .ProseMirror h2 + p, .ProseMirror h3 + p, .ProseMirror hr + p, .ProseMirror figure + p { text-indent: 0; }
.ProseMirror h1 { font-size: 1.7em; font-weight: 700; margin: 1em 0 .5em; text-align: center; }
.ProseMirror h2 { font-size: var(--h2-size, 1.35em); font-weight: 700; margin: var(--h2-before, 1.2em) 0 var(--h2-after, .5em); text-align: var(--h2-align, left); font-style: var(--h2-style, normal); }
.ProseMirror h3 { font-size: var(--h3-size, 1.15em); font-weight: 700; margin: var(--h3-before, 1em) 0 var(--h3-after, .4em); text-align: var(--h3-align, left); font-style: var(--h3-style, normal); }
.ProseMirror blockquote { margin: 1em var(--q-right, 1.5em) 1em var(--q-left, 1.5em); font-size: var(--q-size, 1em); text-align: var(--q-align, left); font-style: var(--q-style, italic); border-left: 3px solid rgba(217,119,6,.5); padding-left: 1em; }
.ProseMirror ul, .ProseMirror ol { margin: 0 0 1em 1.5em; padding-left: 1em; }
.ProseMirror ul { list-style: disc; }
.ProseMirror ol { list-style: decimal; }
.ProseMirror p.drop-cap::first-letter { float: left; font-size: 3.2em; line-height: .8; padding: 4px 8px 0 3px; font-weight: bold; }
.ProseMirror hr.page-break { margin: 1.5rem 0; border: 0; border-top: 2px dashed rgba(217, 119, 6, .45); position: relative; overflow: visible; height: 0; }
.ProseMirror hr.page-break::after { content: "saut de page"; position: absolute; top: -.65em; right: 0; font-size: 10px; font-family: ui-monospace, monospace; color: #d97706; background: inherit; padding: 0 .4em; }
.cmp ins, .cmp-legend { background: rgba(16, 185, 129, .22); text-decoration: none; color: inherit; border-radius: 2px; padding: 0 1px; }
.cmp del, del.cmp-legend { background: rgba(244, 63, 94, .22); text-decoration: line-through; color: inherit; border-radius: 2px; padding: 0 1px; }
.ProseMirror span.idx { border-bottom: 1px dotted #d97706; background: rgba(217, 119, 6, .08); }
.ProseMirror hr.scene-break { border: 0; margin: 1.4em 0; text-align: center; height: auto; }
.ProseMirror hr.scene-break::after { content: "*   *   *"; display: block; color: #94a3b8; letter-spacing: .3em; }
.ProseMirror hr.ProseMirror-selectednode { outline: 2px solid #d97706; outline-offset: 4px; }
.ProseMirror figure.img { margin: 1.2em 0; text-align: center; cursor: default; }
.ProseMirror figure.img img { max-width: 100%; max-height: 420px; border-radius: 2px; box-shadow: 0 2px 8px rgba(0,0,0,.25); }
.ProseMirror figure.img.size-half img { max-width: 55%; }
.ProseMirror figure.img.size-wide img { max-width: 85%; }
.ProseMirror figure.img figcaption { font-size: .85em; font-style: italic; color: #64748b; margin-top: .4em; }
.ProseMirror figure.ProseMirror-selectednode img { outline: 3px solid #d97706; }
.ProseMirror .fn-chip { counter-increment: fn; display: inline-block; cursor: pointer; font-size: .7em; line-height: 1; padding: 0 .3em; margin: 0 .1em; border-radius: .3em; background: rgba(217,119,6,.2); color: #b45309; vertical-align: super; user-select: none; }
.ProseMirror .fn-chip::before { content: counter(fn); }
.dark .ProseMirror .fn-chip { color: #fbbf24; }
.ProseMirror .fn-chip.ProseMirror-selectednode { outline: 2px solid #d97706; }
#editor { counter-reset: fn; }

/* ---- Accessibilité : contrastes (WCAG AA, 4,5 : 1) ---- */
.dark .text-studio-500 { color: #94a3b8; }                 /* ardoise 500 sur fond sombre : 3,1:1 -> 6,9:1 */
.dark .studio-label, .dark .studio-tab { color: #94a3b8; }
html:not(.dark) .text-studio-400, html:not(.dark) .text-studio-500 { color: #526074; }   /* sur fond clair ou légèrement teinté : ≥ 5:1 */
.dark .studio-tab.active, .dark .nav-btn.active { color: #fbbf24; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
:focus-visible { outline: 2px solid #d97706; outline-offset: 2px; }

/* Recomposition : modes, rail, ajout de sections */
.mode-btn { padding: 0.25rem 0.75rem; border-radius: 0.375rem; font-weight: 500; color: #475569; transition: background-color .15s, color .15s; }
.dark .mode-btn { color: #cbd5e1; }
.mode-btn:hover { background: rgba(148, 163, 184, 0.2); }
.mode-btn.active { background: #b45309; color: #ffffff; font-weight: 700; }
.rail-btn { width: 2.25rem; height: 2.25rem; border-radius: 0.5rem; display: flex; align-items: center; justify-content: center; color: #475569; transition: background-color .15s, color .15s; }
.dark .rail-btn { color: #cbd5e1; }
.rail-btn:hover { background: #f1f5f9; }
.dark .rail-btn:hover { background: #1e293b; }
.rail-btn.active { color: #b45309; background: rgba(217, 119, 6, 0.12); }
.dark .rail-btn.active { color: #fbbf24; }
.add-btn { padding: 0.375rem 0.25rem; border-radius: 0.5rem; background: #f1f5f9; color: #334155; font-weight: 500; display: flex; align-items: center; justify-content: center; gap: 0.25rem; transition: background-color .15s; }
.dark .add-btn { background: #1e293b; color: #e2e8f0; }
.add-btn:hover { background: #f59e0b; color: #0f172a; }

/* Réglages liminaires et impression : panneau à gauche, le rendu des pages reste visible à droite */
@media (min-width: 768px) {
  #studio-modal.studio-side { right: 480px; background: transparent !important; backdrop-filter: none !important; padding: 0 !important; justify-content: stretch; align-items: stretch; }
  #studio-modal.studio-side > div { max-width: none !important; width: 100% !important; height: 100% !important; border-radius: 0 !important; }
}
@media (min-width: 1024px) {
  #studio-modal.studio-side { right: 560px; }
}

/* Tableaux dans l'éditeur */
.ProseMirror table { border-collapse: collapse; width: 100%; margin: 1em 0; table-layout: fixed; font-size: 0.9em; }
.ProseMirror th, .ProseMirror td { border: 1px solid #94a3b8; padding: 0.3em 0.5em; vertical-align: top; text-align: left; position: relative; }
.ProseMirror th { background: rgba(148, 163, 184, 0.2); font-weight: 700; }
.ProseMirror td p, .ProseMirror th p { margin: 0; text-indent: 0; }
.ProseMirror .selectedCell { background: rgba(245, 158, 11, 0.25); }
