:root{--bg:#f7f6f3;--surface:#fff;--text:#242825;--muted:#7b817c;--line:#e6e8e3;--green:#204c3b;--green-soft:#e9f1e8;--gold:#bda67a;--danger:#a33d38;--shadow:0 16px 50px #1c281e0f}:root[data-theme=dark]{--bg:#171e1b;--surface:#202923;--text:#eef0e9;--muted:#a7afa7;--line:#354039;--green:#b4d3bb;--green-soft:#263e30;--gold:#d0b77d;--danger:#ed968f;--shadow:none}*{box-sizing:border-box}html,body{background:var(--bg);min-height:100%;color:var(--text);margin:0}body{font-family:Arial,Helvetica,sans-serif}button,input,select{font:inherit}button{cursor:pointer}button:disabled{opacity:.45;cursor:not-allowed}a{color:var(--green)}.app-frame{min-height:100vh;display:flex}.rail{color:#e9f0e9;background:#183829;flex-direction:column;flex:0 0 232px;width:232px;height:100vh;padding:26px 17px;display:flex;position:sticky;top:0}.rail-brand{align-items:center;gap:12px;padding:4px 7px 39px;display:flex}.brand-mark{color:#e8d9aa;background:#1d4835;border:1px solid #dce6c880;border-radius:11px;place-items:center;width:38px;height:38px;font:italic 27px Georgia,serif;display:grid}.rail-brand strong{letter-spacing:.03em;font:22px Georgia,serif;display:block}.rail-brand span{color:#b7c9bb;letter-spacing:.16em;text-transform:uppercase;margin-top:4px;font-size:10px;display:block}.rail nav{gap:5px;display:grid}.rail nav button,.rail-bottom button{color:#c7d4c9;text-align:left;background:0 0;border:0;border-radius:9px;align-items:center;gap:13px;width:100%;padding:12px 14px;display:flex}.rail nav button:hover,.rail-bottom button:hover,.rail nav button.selected{color:#fff;background:#2b533e}.rail nav button span,.rail-bottom button span{font-size:14px}.rail-bottom{margin-top:auto}.rail-bottom>span{letter-spacing:.17em;color:#94ac9b;margin:0 14px 11px;font-size:10px;display:block}.main-area{flex:1;min-width:0}.topbar{border-bottom:1px solid var(--line);justify-content:space-between;align-items:center;padding:43px 56px 35px;display:flex}.eyebrow{letter-spacing:.19em;color:var(--green);margin:0 0 10px;font-size:11px;font-weight:700}.topbar h1,.workspace-title h1{letter-spacing:-.025em;margin:0;font:37px Georgia,serif}.top-actions{align-items:center;gap:24px;display:flex}.source-pill,.status{background:var(--green-soft);color:var(--green);border-radius:100px;padding:8px 12px;font-size:12px;font-weight:600}.avatar{color:#315841;background:#c7d6c9;border-radius:50%;place-items:center;width:38px;height:38px;font-weight:700;display:grid}.library{max-width:1320px;margin:auto;padding:40px 56px}.section-head{justify-content:space-between;align-items:end;margin-bottom:27px;display:flex}.section-head h2{margin:0 0 8px;font:24px Georgia,serif}.section-head p,.section-head>span{color:var(--muted);margin:0;font-size:13px}.book-grid{grid-template-columns:repeat(auto-fill,minmax(205px,1fr));gap:22px;display:grid}.book-card{background:var(--surface);border:1px solid var(--line);text-align:left;box-shadow:var(--shadow);border-radius:13px;padding:0;transition:transform .15s,box-shadow .15s;overflow:hidden}.book-card:hover:not(:disabled){transform:translateY(-3px);box-shadow:0 18px 45px #19372221}.book-card:disabled{opacity:.7}.book-cover{color:#f7f0dc;background:linear-gradient(145deg,#273d33,#182822);flex-direction:column;justify-content:space-between;height:260px;padding:25px;display:flex}.book-cover span{font:28px/1.1 Georgia,serif}.book-cover small{letter-spacing:.17em;text-transform:uppercase;color:#d2caa9;font-size:10px}.test-cover{background:linear-gradient(145deg,#a78d5c,#4e6045)}.test-cover span{letter-spacing:.08em;font-size:24px}.book-info{gap:9px;padding:20px;display:grid}.book-info strong{font:17px Georgia,serif}.book-info span{color:var(--muted);font-size:12px}.book-info em{color:var(--green);margin-top:8px;font-size:12px;font-style:normal;font-weight:700}.record-list{background:var(--surface);border:1px solid var(--line);border-radius:12px;overflow:hidden}.record-row{border-bottom:1px solid var(--line);align-items:center;gap:16px;padding:15px 21px;display:flex}.record-row:last-child{border-bottom:0}.record-row strong{flex:1;font-weight:600}.record-row>span:last-child{color:var(--muted);font-size:12px}.record-icon{background:var(--green-soft);width:34px;height:34px;color:var(--green);border-radius:9px;place-items:center;font:italic 19px Georgia,serif;display:grid}.login-wrap{background:radial-gradient(circle at 72% 30%,#dfe9db,#0000 35%),#eff2e9;place-items:center;min-height:100vh;padding:20px;display:grid}.login-card{background:#fff;border:1px solid #d9e2d6;border-radius:18px;width:min(430px,100%);padding:45px;box-shadow:0 25px 80px #1537221f}.login-card .brand-mark{margin-bottom:30px}.login-card h1{margin:0 0 15px;font:32px Georgia,serif}.muted{color:var(--muted)}.login-card>.muted{margin:0 0 28px;line-height:1.5}.login-card form{gap:16px;display:grid}.login-card label{gap:7px;font-size:12px;font-weight:700;display:grid}.login-card input{color:#243226;background:#fff;border:1px solid #d7ddd5;border-radius:8px;width:100%;padding:13px}.primary{color:#fff;background:#214c39;border:1px solid #214c39;border-radius:8px;padding:11px 16px;font-weight:700}.primary:hover:not(:disabled){background:#32654c}.error{color:var(--danger);font-size:13px}.pad{padding:30px}.workspace-top{border-bottom:1px solid var(--line);background:var(--surface);align-items:center;gap:28px;padding:25px 35px;display:flex}.back{color:var(--green);white-space:nowrap;background:0 0;border:0;font-size:13px}.workspace-title{flex:1;min-width:0}.workspace-title .eyebrow{margin-bottom:5px}.workspace-title h1{font-size:25px}.workspace-title p{color:var(--muted);margin:6px 0 0;font-size:12px}.workspace-title p span,.chapter-heading p span{color:#b2b8b0;padding:0 5px}.workspace-actions{align-items:center;gap:14px;display:flex}.status.unsaved-changes,.status.conflict,.status.save-failed{color:#805b27;background:#fbecd9}.workspace-body{grid-template-columns:235px minmax(0,1fr) 208px;min-height:calc(100vh - 111px);display:grid}.chapter-rail{border-right:1px solid var(--line);background:var(--surface);flex-direction:column;min-height:0;display:flex}.chapter-rail-head{text-transform:uppercase;letter-spacing:.1em;justify-content:space-between;padding:25px 20px 14px;font-size:12px;display:flex}.chapter-rail-head span{color:var(--muted)}.chapter-list{max-height:calc(100vh - 230px);padding:0 8px 12px;overflow:auto}.chapter-list button{text-align:left;width:100%;color:var(--text);background:0 0;border:0;border-radius:8px;align-items:center;gap:11px;padding:12px;display:flex}.chapter-list button:hover,.chapter-list button.active{background:var(--green-soft)}.chapter-list button span{color:var(--muted);font-size:11px}.chapter-list button strong{font-size:12px;font-weight:600;line-height:1.35}.chapter-list button.active strong{color:var(--green)}.reference-note{border-top:1px solid var(--line);margin-top:auto;padding:18px 20px}.reference-note strong{font-size:12px}.reference-note p,.reference-note a{font-size:11px;line-height:1.5}.reference-note p{color:var(--muted)}.writing-panel{background:var(--bg);min-width:0}.chapter-tools{border-bottom:1px solid var(--line);justify-content:space-between;align-items:center;gap:12px;padding:18px 35px;display:flex}.chapter-tools label{color:var(--muted);font-size:11px;font-weight:700}.chapter-select{align-items:center;gap:9px;min-width:0;display:flex}.chapter-tools select,.chapter-tools input{background:var(--surface);color:var(--text);border:1px solid var(--line);border-radius:7px;padding:8px;font-size:12px}.chapter-select select{max-width:260px}.appearance{align-items:center;gap:10px;display:flex}.appearance label{align-items:center;gap:6px;display:flex}.appearance input{width:55px}.appearance button{border:1px solid var(--line);background:var(--surface);color:var(--text);border-radius:7px;padding:7px 11px}.search-box{gap:7px;max-width:810px;margin:18px auto 0;padding:0 25px;display:flex}.search-box input{border:1px solid var(--line);background:var(--surface);min-width:0;color:var(--text);border-radius:7px;flex:1;padding:9px 12px;font-size:12px}.search-box button{border:1px solid var(--line);background:var(--surface);color:var(--text);border-radius:7px;padding:9px 13px;font-size:12px}.search-results{background:var(--surface);border:1px solid var(--line);border-radius:8px;max-width:760px;max-height:220px;margin:8px auto;overflow:auto}.search-results button{border:0;border-bottom:1px solid var(--line);width:100%;color:var(--text);text-align:left;background:0 0;gap:4px;padding:9px 13px;font-size:12px;display:grid}.search-results small{color:var(--muted)}.inline{max-width:760px;margin:18px auto}.chapter-heading{max-width:780px;margin:36px auto 0;padding:0 27px}.chapter-heading h2{margin:0 0 10px;font:34px Georgia,serif}.chapter-heading p:last-child{color:var(--muted);margin:0;font-size:12px}.mode-note{color:#5b7c61;background:var(--green-soft);border-radius:7px;max-width:760px;margin:24px auto 0;padding:10px 13px;font-size:12px}.mode-note.readonly{color:#6f6a58;background:#f3eee1}.editor-shell{background:var(--surface);border:1px solid var(--line);max-width:810px;min-height:420px;box-shadow:var(--shadow);border-radius:9px;margin:19px auto 35px}.format-bar{border-bottom:1px solid var(--line);flex-wrap:wrap;align-items:center;gap:3px;padding:8px 12px;font-family:Arial,sans-serif;font-size:12px;display:flex}.format-bar button{color:var(--text);background:0 0;border:0;border-radius:5px;padding:6px 10px}.format-bar button:hover,.format-bar button.active{background:var(--green-soft)}.format-bar span{color:var(--muted);margin-left:auto;font-size:10px}.editor-content .tiptap{min-height:370px;color:var(--text);outline:none;padding:42px 50px;line-height:1.7}.editor-content .tiptap p{margin:0 0 1.15em}.editor-content .tiptap h1,.editor-content .tiptap h2,.editor-content .tiptap h3{font-family:Georgia,serif;line-height:1.25}.editor-content .tiptap hr{text-align:center;border:0;margin:32px auto}.editor-content .tiptap hr:after{content:"*  *  *";color:var(--muted);letter-spacing:.15em}.editor-content .tiptap blockquote{border-left:3px solid var(--gold);color:var(--muted);margin-left:0;padding-left:18px}.chapter-footer{justify-content:space-between;align-items:center;gap:15px;max-width:810px;margin:0 auto 35px;display:flex}.chapter-footer button{border:1px solid var(--line);background:var(--surface);color:var(--text);border-radius:7px;padding:10px 13px;font-size:12px}.chapter-footer .text-danger{color:var(--danger);background:0 0;border:0}.context-panel{border-left:1px solid var(--line);background:var(--surface);padding:28px 21px}.context-panel h3{margin:0 0 23px;font:19px Georgia,serif}.context-panel .stat{gap:5px;margin-bottom:19px;font-size:11px;display:grid}.context-panel .stat span,.context-panel>p:last-child{color:var(--muted);line-height:1.55}.context-panel .stat strong{font-size:13px}.context-divider{background:var(--line);height:1px;margin:28px 0}.context-panel>p:last-child{font-size:12px}.modal-backdrop{z-index:20;background:#0c191299;place-items:center;padding:18px;display:grid;position:fixed;inset:0}.modal{background:var(--surface);color:var(--text);border-radius:14px;width:min(530px,100%);padding:32px;box-shadow:0 25px 90px #00000038}.modal h2{margin:0 0 12px;font:27px Georgia,serif}.modal>p:not(.eyebrow){color:var(--muted);font-size:14px;line-height:1.5}.modal-actions{flex-wrap:wrap;gap:8px;margin-top:24px;display:flex}.modal-actions button{border:1px solid var(--line);background:var(--surface);color:var(--text);border-radius:7px;padding:10px 12px;font-size:12px}.modal-actions button.primary{color:#fff;background:#214c39}.modal-actions .text-danger{color:var(--danger)}.conflict-modal{width:min(850px,100%)}.compare{grid-template-columns:1fr 1fr;gap:13px;margin-top:22px;display:grid}.compare>div{border:1px solid var(--line);border-radius:8px;max-height:300px;padding:14px;font:14px/1.5 Georgia,serif;overflow:auto}.compare strong{text-transform:uppercase;letter-spacing:.1em;font:700 11px Arial,sans-serif}.compare p{margin-bottom:8px}.bookshelf-filters{align-items:center;gap:10px;margin-bottom:20px;display:flex}.bookshelf-filters input,.bookshelf-filters select{border:1px solid var(--line);background:var(--surface);color:var(--text);border-radius:7px;padding:10px 12px;font-size:12px}.bookshelf-filters input{min-width:240px}.bookshelf-filters span{color:var(--muted);margin-left:auto;font-size:12px}.quiet-action{border:1px solid var(--line);background:var(--surface);color:var(--text);white-space:nowrap;border-radius:7px;padding:8px 11px;font-size:12px}.quiet-action:hover:not(:disabled){background:var(--green-soft)}.app-frame.fullscreen-mode{background:var(--bg);height:100vh;min-height:0;overflow:auto}.fullscreen-mode .rail,.fullscreen-mode .chapter-rail,.fullscreen-mode .context-panel{display:none}.fullscreen-mode .workspace-top{z-index:5;padding:14px clamp(16px,3vw,48px);position:sticky;top:0}.fullscreen-mode .workspace-body{min-height:0;display:block}.fullscreen-mode .writing-panel{min-height:calc(100vh - 92px)}.fullscreen-mode .chapter-tools{max-width:1180px;margin:auto;padding-inline:clamp(16px,3vw,40px)}.fullscreen-mode .chapter-heading,.fullscreen-mode .mode-note{max-width:min(1000px,100vw - 32px)}.fullscreen-mode .editor-shell,.fullscreen-mode .chapter-footer{max-width:min(1040px,100vw - 32px)}.fullscreen-mode .editor-content .tiptap{min-height:60vh;padding:clamp(24px,4vw,64px)}@media (max-width:1200px){.context-panel{display:none}.workspace-body{grid-template-columns:220px minmax(0,1fr)}}@media (max-width:850px){.rail{flex-basis:66px;width:66px;padding:18px 9px}.rail-brand{padding:4px 4px 25px}.rail-brand>div:last-child,.rail nav button span,.rail-bottom button span,.rail-bottom>span{display:none}.rail nav button,.rail-bottom button{justify-content:center;padding:12px}.topbar,.library{padding:30px}.workspace-top{gap:10px;padding:18px}.workspace-title h1{font-size:20px}.workspace-title p{display:none}.workspace-body{grid-template-columns:175px minmax(0,1fr)}.chapter-tools{flex-wrap:wrap;padding:13px}.chapter-heading{margin-top:24px}.editor-shell{margin:18px 20px}.chapter-footer{margin:0 20px 25px}.mode-note{margin:18px 20px 0}}@media (max-width:620px){.app-frame{display:block}.rail{flex-direction:row;align-items:center;width:100%;height:55px;padding:8px 12px;display:flex;position:static}.rail-brand{padding:0}.rail-brand .brand-mark{width:31px;height:31px;font-size:23px}.rail nav{margin-left:auto;display:flex}.rail nav button{width:auto;padding:6px 9px}.rail-bottom{display:none}.topbar{padding:25px 20px}.topbar h1{font-size:31px}.source-pill{display:none}.library{padding:26px 20px}.bookshelf-filters{flex-wrap:wrap}.bookshelf-filters input,.bookshelf-filters select{flex:1;min-width:140px}.bookshelf-filters span{width:100%}.workspace-top{grid-template-columns:1fr auto;display:grid}.back{text-align:left;grid-column:1/-1;padding:0}.workspace-title h1{font-size:20px}.workspace-actions{gap:6px}.workspace-actions .status{display:none}.workspace-body{display:block}.chapter-rail{display:none}.chapter-select{flex:1}.chapter-select select{max-width:200px}.appearance{justify-content:space-between;width:100%}.chapter-heading h2{font-size:29px}.editor-content .tiptap{min-height:52vh;padding:26px 23px}.format-bar span{display:none}.chapter-footer{gap:5px}.chapter-footer button{padding:9px;font-size:11px}.compare{grid-template-columns:1fr}.modal{max-height:90vh;overflow:auto}}@media (max-width:850px){.workspace-actions{flex-wrap:wrap;justify-content:flex-end}.fullscreen-mode .workspace-top{gap:12px}.fullscreen-mode .workspace-title{min-width:160px}}@media (max-width:620px){.workspace-actions .quiet-action{padding:7px;font-size:11px}.fullscreen-mode .workspace-top{grid-template-columns:1fr}.fullscreen-mode .workspace-actions{justify-content:flex-start}.fullscreen-mode .editor-shell{margin:18px auto}.fullscreen-mode .mode-note{margin:18px auto 0}.fullscreen-mode .chapter-footer{margin:0 auto 25px}}.settings-page{max-width:950px}.settings-card{background:var(--surface);border:1px solid var(--line);box-shadow:var(--shadow);border-radius:13px;margin-bottom:20px;padding:28px 32px}.settings-card h3{margin:0 0 17px;font:22px Georgia,serif}.settings-card>p,.settings-hint,.settings-footer p{color:var(--muted);font-size:13px;line-height:1.5}.settings-card>p{margin:0 0 20px}.settings-option{border-top:1px solid var(--line);cursor:pointer;align-items:flex-start;gap:13px;padding:15px 0;display:flex}.settings-option input,.settings-radios input,.pen-name-options input{accent-color:#24543d;flex:none;width:17px;height:17px;margin:1px 0 0}.settings-option span{gap:5px;display:grid}.settings-option strong{font-size:14px}.settings-option small{color:var(--muted);font-size:12px;line-height:1.45}.settings-radios{flex-wrap:wrap;gap:24px;margin-bottom:19px;display:flex}.settings-radios label,.pen-name-options label{cursor:pointer;align-items:flex-start;gap:9px;font-size:13px;display:flex}.pen-name-options{background:var(--bg);border:1px solid var(--line);border-radius:9px;grid-template-columns:repeat(auto-fill,minmax(190px,1fr));gap:14px 20px;padding:19px;display:grid}.settings-hint{color:var(--danger);margin:13px 0 0}.settings-footer{justify-content:space-between;align-items:center;gap:16px;display:flex}.settings-footer p{margin:0}@media (max-width:620px){.settings-page .section-head{display:block}.settings-page .section-head>span{margin-top:12px;display:block}.settings-card{padding:22px 18px}.settings-radios{gap:13px;display:grid}.settings-footer{display:grid}.pen-name-options{grid-template-columns:1fr 1fr}}
.book-cover{position:relative}.book-cover img{object-fit:contain;object-position:center;z-index:1;background:#182822;width:100%;height:100%;display:block;position:absolute;inset:0}
