
.demo-bar{position:fixed;left:50%;bottom:18px;transform:translateX(-50%);z-index:130;display:flex;align-items:center;gap:.6rem;
  background:var(--surface);border:1px solid var(--rule2,var(--rule));border-radius:999px;padding:.4rem .5rem .4rem .8rem;
  box-shadow:var(--shadow);max-width:calc(100vw - 24px);font-family:var(--sans);}
.demo-bar .demo-tag{font-size:.62rem;font-weight:800;letter-spacing:.12em;color:#fff;background:var(--brand);border-radius:999px;padding:.2rem .5rem;}
.demo-bar .demo-msg{font-size:.86rem;color:var(--muted);white-space:nowrap;}
.demo-bar .db-btn{border:1px solid transparent;background:var(--brand);color:#fff8ef;font:inherit;font-size:.86rem;font-weight:600;
  padding:.45rem .8rem;border-radius:999px;cursor:pointer;white-space:nowrap;transition:filter .15s,background .15s;}
.demo-bar .db-btn:hover{filter:brightness(1.06);}
.demo-bar .db-more{background:transparent;color:var(--text);border-color:var(--rule2,var(--rule));width:34px;height:34px;padding:0;
  border-radius:50%;font-size:1rem;line-height:1;}
.demo-bar .db-more:hover{background:var(--surface2);}
@media(max-width:640px){ .demo-bar .demo-msg{display:none;} .demo-bar{bottom:12px;gap:.4rem;} }

.demo-menu{position:fixed;right:12px;bottom:66px;z-index:131;background:var(--surface);border:1px solid var(--rule2,var(--rule));
  border-radius:14px;box-shadow:var(--shadow);padding:.4rem;min-width:230px;font-family:var(--sans);}
.demo-menu button{display:flex;align-items:center;gap:.55rem;width:100%;text-align:left;border:none;background:transparent;
  color:var(--text);font:inherit;font-size:.9rem;padding:.55rem .6rem;border-radius:9px;cursor:pointer;}
.demo-menu button:hover{background:var(--surface2);}
.demo-menu button.db-locked{color:var(--muted);opacity:.72;}
.demo-menu button.db-locked:hover{opacity:1;}

.dm-scrim{position:fixed;inset:0;background:rgba(10,6,2,.5);z-index:140;backdrop-filter:blur(2px);}
.dm-modal{position:fixed;inset:0;z-index:141;display:grid;place-items:center;padding:1.2rem;pointer-events:none;}
.dm-sheet{pointer-events:auto;width:min(560px,96vw);max-height:88vh;overflow:auto;background:var(--surface);border:1px solid var(--rule2,var(--rule));
  border-radius:18px;box-shadow:var(--shadow);padding:1.5rem;font-family:var(--sans);}
.dm-sheet h3{font-family:var(--serif);font-weight:600;font-size:1.35rem;margin:0 0 .5rem;color:var(--text);}
.dm-sheet p{color:var(--muted);font-size:.94rem;line-height:1.55;margin:.5rem 0;}
.dm-sheet p.lead{color:var(--text);}
.dm-badge{display:inline-block;font-size:.64rem;font-weight:800;letter-spacing:.1em;color:#fff;background:var(--brand);border-radius:999px;padding:.16rem .5rem;margin-bottom:.6rem;}
.dm-actions{display:flex;gap:.5rem;justify-content:flex-end;flex-wrap:wrap;margin-top:1.2rem;}
.dm-btn{border:1px solid var(--rule2,var(--rule));background:var(--surface);color:var(--text);font:inherit;font-weight:600;font-size:.92rem;
  padding:.62rem 1rem;border-radius:10px;cursor:pointer;}
.dm-btn.primary{background:var(--brand);border-color:var(--brand);color:#fff8ef;}
.dm-btn.primary:hover{filter:brightness(1.06);}
.dm-btn:hover{border-color:var(--brand);}

.dz{margin-top:1rem;border:2px dashed var(--rule2,var(--rule));border-radius:14px;padding:2rem 1rem;text-align:center;cursor:pointer;
  transition:border-color .15s,background .15s;background:var(--surface2);}
.dz:hover,.dz.over{border-color:var(--brand);background:var(--hl);}
.dz .dz-ico{font-size:2rem;}
.dz .dz-main{font-weight:600;color:var(--text);margin-top:.4rem;}
.dz .dz-sub{font-size:.82rem;color:var(--muted);margin-top:.25rem;}
.dz-file{margin-top:.9rem;font-size:.9rem;color:var(--text);font-weight:600;}
.dm-err{color:var(--danger,#b02a1a);font-size:.86rem;margin-top:.7rem;min-height:1em;}
.dm-note{font-size:.78rem;color:var(--faint);margin-top:.9rem;line-height:1.5;}

.dm-memo-item{padding:.7rem 0;border-bottom:1px dashed var(--rule);}
.dm-memo-item:last-child{border-bottom:none;}
.dm-mi-top{display:flex;align-items:center;gap:.5rem;}
.dm-rank{font-family:var(--mono,monospace);font-size:.72rem;font-weight:700;color:#fff;background:var(--brand);border-radius:6px;padding:.05rem .4rem;}
.dm-mi-title{font-family:var(--serif);font-weight:600;font-size:1rem;color:var(--text);}
.dm-mi-votes{margin-left:auto;font-size:.74rem;color:var(--muted);white-space:nowrap;}
.dm-mi-desc{font-size:.88rem;color:var(--muted);line-height:1.45;margin-top:.3rem;}

.dm-terms{margin:.3rem 0 .2rem;padding-left:1.1rem;display:flex;flex-direction:column;gap:.4rem;}
.dm-terms li{color:var(--muted);font-size:.9rem;line-height:1.5;}
.dm-terms li::marker{color:var(--brand);}

.demo-spin{display:inline-block;width:15px;height:15px;border:2px solid rgba(255,255,255,.4);border-top-color:#fff;border-radius:50%;animation:demospin .7s linear infinite;vertical-align:-2px;margin-right:.4rem;}
@keyframes demospin{to{transform:rotate(360deg);}}
@media(prefers-reduced-motion:reduce){.demo-spin{animation:none;}}

.dm-vtabs{display:inline-flex;align-items:center;gap:2px;flex:none;margin-left:.5rem;padding:2px;font-family:var(--sans,sans-serif);
  background:var(--surface2,#f2ede2);border:1px solid var(--rule2,var(--rule,#d8ceba));border-radius:999px;}
.dm-vtab{border:none;background:transparent;color:var(--muted,#6c6356);font:inherit;font-size:.76rem;font-weight:600;
  padding:.26rem .66rem;border-radius:999px;cursor:pointer;white-space:nowrap;transition:color .15s,background .15s;}
.dm-vtab:hover{color:var(--text,#211c15);}
.dm-vtab.active{background:var(--surface,#fffdf8);color:var(--text,#211c15);cursor:default;
  box-shadow:0 1px 3px var(--shadow-color,rgba(0,0,0,.15));}
.dm-vtab .dm-vtab-plus{color:var(--brand,#7C4DBA);font-weight:800;margin-left:.1rem;}
@media(max-width:640px){ .dm-vtabs{margin-left:.3rem;} .dm-vtab{padding:.24rem .5rem;font-size:.72rem;} }

.dm-prog{margin-top:1.1rem;height:8px;border-radius:999px;overflow:hidden;
  background:var(--surface2,#f2ede2);border:1px solid var(--rule,#e6ddcd);}
.dm-prog-fill{height:100%;width:0%;background:var(--brand,#7C4DBA);border-radius:999px;transition:width .5s ease;}
.dm-prog-meta{display:flex;justify-content:space-between;gap:.6rem;margin-top:.45rem;font-size:.8rem;color:var(--muted,#6c6356);}
.dm-prog-line{display:flex;align-items:center;gap:.45rem;margin-top:.8rem;min-height:1.3em;font-size:.9rem;color:var(--text,#211c15);}
.dm-prog-line.err{color:var(--danger,#b02a1a);}
.dm-prog-line.ok{color:var(--brand,#7C4DBA);font-weight:600;}
.demo-spin.dm-ink{border-color:var(--rule2,var(--rule,#d8ceba));border-top-color:var(--brand,#7C4DBA);margin-right:0;flex:none;}

#panel-edit{padding:0;overflow:hidden;}
.tm-shell{position:relative;display:flex;flex-direction:column;height:100%;
  background:var(--bg);color:var(--text);font-family:var(--sans);--tm-ok:#4f9066;}
:root[data-theme="ink"] .tm-shell{--tm-ok:#6fbf86;}

.tm-col-sel{background:var(--surface2);color:var(--text);border:1px solid var(--rule2,var(--rule));
  border-radius:8px;padding:.3rem .45rem;font:inherit;font-size:.8rem;max-width:60%;}
.tm-col-x{margin-left:auto;border:1px solid transparent;background:transparent;color:var(--muted);
  cursor:pointer;font-size:.9rem;line-height:1;border-radius:6px;padding:.1rem .32rem;}
.tm-col-x:hover{color:var(--danger,#b02a1a);background:var(--surface2);}
.tm-shell .tm-pane-h{align-items:center;padding:.35rem .6rem;gap:.4rem;}

.tm-edit-badge{font-size:.7rem;font-weight:700;color:#fff;background:var(--brand);border-radius:999px;padding:.16rem .5rem;white-space:nowrap;}
.tm-pane.editing{background:color-mix(in srgb,var(--brand) 4%,transparent);}
.tm-pane.editing .tm-pane-h,.tm-pane-h.editing{box-shadow:inset 0 -2px 0 var(--brand);}

.tm-gate{height:100%;overflow-y:auto;box-sizing:border-box;padding:1.6rem clamp(1rem,5vw,3rem) 4rem;
  max-width:760px;margin:0 auto;}

.tm-top{display:flex;align-items:center;gap:.8rem;flex-wrap:wrap;padding:.55rem .8rem;
  border-bottom:1px solid var(--rule2,var(--rule));background:var(--surface);}
.tm-top-l,.tm-top-r{display:flex;align-items:center;gap:.4rem;}
.tm-top-c{flex:1;display:flex;align-items:center;gap:.6rem;min-width:180px;justify-content:center;}
.tm-tag{font-size:.72rem;font-weight:800;letter-spacing:.06em;color:#fff;background:var(--brand);border-radius:999px;padding:.22rem .6rem;white-space:nowrap;}
.tm-nav{border:1px solid var(--rule2,var(--rule));background:var(--surface);color:var(--text);
  width:30px;height:30px;border-radius:8px;cursor:pointer;font-size:1rem;line-height:1;}
.tm-nav:hover{background:var(--surface2);}
.tm-sec-sel,.tm-f-sec{background:var(--surface2);color:var(--text);border:1px solid var(--rule2,var(--rule));
  border-radius:8px;padding:.32rem .5rem;font:inherit;font-size:.84rem;max-width:44vw;}
.tm-prog{flex:1;max-width:260px;height:7px;border-radius:999px;overflow:hidden;background:var(--surface2);border:1px solid var(--rule,#e6ddcd);}
.tm-prog-fill{display:block;height:100%;width:0%;background:var(--tm-ok);transition:width .3s ease;}
.tm-prog-text{font-size:.78rem;color:var(--muted);white-space:nowrap;}
.tm-btn{border:1px solid var(--rule2,var(--rule));background:var(--surface);color:var(--text);font:inherit;
  font-size:.82rem;font-weight:600;padding:.4rem .7rem;border-radius:8px;cursor:pointer;white-space:nowrap;}
.tm-btn:hover{border-color:var(--brand);}
.tm-btn.tm-sm{padding:.28rem .5rem;font-size:.76rem;}
.tm-btn.tm-close{border-color:transparent;}

.tm-panes{flex:1;display:flex;min-height:0;}
.tm-pane{flex:1;min-width:0;display:flex;flex-direction:column;}
.tm-pane+.tm-pane{border-left:1px solid var(--rule2,var(--rule));}
.tm-pane-h{padding:.4rem .9rem;font-size:.72rem;font-weight:700;letter-spacing:.04em;text-transform:uppercase;
  color:var(--muted);background:var(--bg2);border-bottom:1px solid var(--rule);display:flex;align-items:baseline;gap:.5rem;flex-wrap:wrap;}
.tm-pane-hint{font-weight:500;letter-spacing:0;text-transform:none;color:var(--faint);font-size:.72rem;}
.tm-col{flex:1;overflow-y:auto;overflow-x:hidden;position:relative;padding:.5rem 1rem 40vh;
  font-family:var(--serif);font-size:1rem;line-height:1.6;}
.tm-sec-head{font-family:var(--serif);font-weight:600;font-size:1.1rem;color:var(--text);
  padding:.4rem 0 .7rem;border-bottom:1px solid var(--rule);margin-bottom:.4rem;}
.tm-blk{padding:.45rem .55rem;border-radius:8px;border:1px solid transparent;position:relative;margin:.15rem 0;}
.tm-blk-body p{margin:0 0 .4em;}
.tm-blk-body p:last-child{margin-bottom:0;}
.tm-blk-body .term{all:unset;color:inherit;}
.tm-blk-body sup.fn{font-size:.7em;color:var(--brand);}
.tm-blk-body sup.fn a{color:inherit;text-decoration:none;pointer-events:none;}
.tm-blk-body .tm-empty{color:var(--faint);}
.tm-blk-src{color:var(--text);}
.tm-blk-tgt.editable{cursor:text;}
.tm-blk-tgt.editable:hover{background:var(--surface2);border-color:var(--rule);}
.tm-blk-tgt.editing{background:var(--surface2);border-color:var(--brand);}
.tm-blk-tgt.confirmed{border-left:3px solid var(--tm-ok);}
.tm-blk-tgt.edited{box-shadow:inset 3px 0 0 -1px var(--brand-bright,var(--brand));}
.tm-blk-tgt.confirmed.edited{box-shadow:none;}
.tm-blk-tgt.marker-err{border-color:var(--danger,#b02a1a);background:color-mix(in srgb,var(--danger,#b02a1a) 8%,transparent);}
.tm-blk-tgt.flash{animation:tmflash 1.2s ease;}
@keyframes tmflash{0%,100%{background:transparent;}25%{background:var(--hl);}}
@media(prefers-reduced-motion:reduce){.tm-blk-tgt.flash{animation:none;}}

.tm-ta{width:100%;box-sizing:border-box;font-family:var(--serif);font-size:1rem;line-height:1.6;
  color:var(--text);background:var(--surface);border:1px solid var(--brand);border-radius:6px;
  padding:.4rem .5rem;resize:none;overflow:hidden;}
.tm-ta:focus{outline:2px solid var(--brand);outline-offset:0;}

.tm-bar{display:flex;align-items:center;gap:.5rem;margin-top:.4rem;font-family:var(--sans);
  font-size:.72rem;color:var(--muted);flex-wrap:wrap;}
.tm-confirm{border:1px solid var(--rule2,var(--rule));background:var(--surface);color:var(--muted);
  font:inherit;font-size:.72rem;font-weight:600;padding:.2rem .55rem;border-radius:999px;cursor:pointer;}
.tm-confirm:hover{border-color:var(--tm-ok);color:var(--text);}
.tm-confirm.on{background:var(--tm-ok);border-color:var(--tm-ok);color:#fff;}
.tm-badge-edited{color:var(--brand);font-weight:600;}
.tm-qa{color:#b26a00;font-weight:600;cursor:help;}
:root[data-theme="ink"] .tm-qa{color:#e0a24a;}
.tm-saved{color:var(--tm-ok);font-weight:600;opacity:0;}

.tm-toast{position:absolute;left:50%;bottom:18px;transform:translateX(-50%);z-index:5;
  background:var(--text);color:var(--bg);font-size:.82rem;font-weight:600;padding:.5rem .9rem;
  border-radius:999px;opacity:0;pointer-events:none;transition:opacity .2s;box-shadow:var(--shadow);}
.tm-toast.show{opacity:.96;}

.tm-log{position:absolute;top:0;right:0;bottom:0;width:min(460px,94vw);z-index:6;
  background:var(--surface);border-left:1px solid var(--rule2,var(--rule));box-shadow:var(--shadow);
  display:flex;flex-direction:column;font-family:var(--sans);}
.tm-log[hidden]{display:none;}
.tm-log-head{display:flex;align-items:center;justify-content:space-between;padding:.7rem .9rem;border-bottom:1px solid var(--rule);}
.tm-log-head strong{font-family:var(--serif);font-weight:600;font-size:1.05rem;}
.tm-log-filters{display:flex;flex-wrap:wrap;gap:.4rem;align-items:center;padding:.6rem .9rem;border-bottom:1px solid var(--rule);}
.tm-log-filters label{display:flex;align-items:center;gap:.3rem;font-size:.74rem;color:var(--muted);}
.tm-f-date,.tm-f-q{background:var(--surface2);color:var(--text);border:1px solid var(--rule2,var(--rule));
  border-radius:8px;padding:.3rem .5rem;font:inherit;font-size:.8rem;}
.tm-f-q{flex:1;min-width:120px;}
.tm-log-list{flex:1;overflow-y:auto;padding:.5rem .7rem 2rem;}
.tm-log-empty{color:var(--muted);font-size:.86rem;padding:1.2rem .5rem;text-align:center;}
.tm-log-row{border:1px solid var(--rule);border-radius:10px;padding:.55rem .6rem;margin-bottom:.5rem;background:var(--bg2);}
.tm-log-row.rollback{border-style:dashed;}
.tm-log-top{display:flex;align-items:center;gap:.5rem;font-size:.72rem;color:var(--muted);flex-wrap:wrap;}
.tm-log-op{font-weight:700;color:var(--brand);}
.tm-log-row.rollback .tm-log-op{color:var(--tm-ok);}
.tm-log-where{font-weight:600;color:var(--text);}
.tm-log-when{margin-left:auto;}
.tm-log-diff{font-family:var(--serif);font-size:.86rem;line-height:1.4;margin:.4rem 0;}
.tm-log-before{color:var(--muted);text-decoration:line-through;}
.tm-log-after{color:var(--text);}
.tm-log-act{display:flex;gap:.4rem;justify-content:flex-end;}

@media(max-width:760px){
  .tm-panes{flex-direction:column;}
  .tm-pane+.tm-pane{border-left:none;border-top:1px solid var(--rule2,var(--rule));}
  .tm-top-c{order:3;flex-basis:100%;}
}

.tm-work{flex:1;display:flex;min-height:0;}
.tm-body{flex:1;min-width:0;display:flex;flex-direction:column;min-height:0;}
.tm-view-translate .tm-panes,.tm-view-one-page .tm-panes{flex:1;}

.tm-vsw{display:inline-flex;gap:2px;background:var(--surface2);border:1px solid var(--rule2,var(--rule));border-radius:999px;padding:2px;}
.tm-vsw-tab{border:0;background:transparent;color:var(--muted);font:inherit;font-size:.8rem;font-weight:600;
  padding:.28rem .7rem;border-radius:999px;cursor:pointer;white-space:nowrap;}
.tm-vsw-tab:hover{color:var(--text);}
.tm-vsw-tab.on{background:var(--brand);color:#fff;}
.tm-vsw-tab:focus-visible{outline:2px solid var(--brand);outline-offset:2px;}

.tm-toolbox{display:flex;align-items:center;gap:.5rem;}
.tm-tb-h{font-size:.66rem;font-weight:800;letter-spacing:.1em;text-transform:uppercase;color:var(--faint);}
.tm-tb-nav{display:flex;align-items:center;gap:.35rem;}
.tm-tb-prog{display:flex;align-items:center;gap:.5rem;min-width:0;}
.tm-tb-actions{display:flex;align-items:center;gap:.4rem;flex-wrap:wrap;}
.tm-view-translate .tm-toolbox{margin-left:auto;flex-wrap:wrap;}

.tm-view-one-page .tm-body{align-items:center;}
.tm-view-one-page .tm-panes{width:100%;max-width:820px;margin:0 auto;}
.tm-view-one-page .tm-toolbox{flex-direction:column;align-items:stretch;gap:.85rem;width:212px;flex:none;
  border-left:1px solid var(--rule2,var(--rule));background:var(--surface);padding:1rem .85rem;overflow-y:auto;}
.tm-view-one-page .tm-tb-nav{flex-wrap:wrap;}
.tm-view-one-page .tm-tb-actions{flex-direction:column;align-items:stretch;}
.tm-view-one-page .tm-sec-sel{flex:1;min-width:0;}

.tm-view-spread .tm-toolbox{flex-direction:column;align-items:stretch;gap:.6rem;width:58px;flex:none;
  border-left:1px solid var(--rule2,var(--rule));background:var(--surface);padding:.7rem .4rem;overflow:hidden auto;}
.tm-view-spread .tm-tb-h,.tm-view-spread .tm-tb-prog,.tm-view-spread .tm-sec-sel{display:none;}
.tm-view-spread .tm-tb-actions{flex-direction:column;}
.tm-view-spread .tm-toolbox .tm-btn{padding:.4rem .2rem;font-size:.7rem;}

.tm-spread{flex:1;display:flex;flex-direction:column;min-height:0;gap:.5rem;padding:.6rem clamp(.5rem,2vw,1.4rem) .7rem;}
.tm-spread-chip{flex:none;font-size:.74rem;color:var(--muted);background:var(--surface2);
  border:1px dashed var(--rule2,var(--rule));border-radius:8px;padding:.32rem .6rem;text-align:center;}
.tm-spread-chip strong{color:var(--text);font-weight:700;}
.tm-spread-book{position:relative;margin:auto;max-width:100%;max-height:100%;background:var(--surface);
  border:1px solid var(--rule2,var(--rule));border-radius:2px;box-shadow:0 8px 42px rgba(0,0,0,.18);overflow:hidden;}
.tm-spread-track{color:var(--text);font-family:var(--serif);hyphens:auto;-webkit-hyphens:auto;}
.tm-spread-track .tm-blk{margin:0;padding:0;border:0;border-radius:0;}
.tm-spread-track .tm-blk-body p{margin:0 0 .3em;text-indent:1.25em;}
.tm-spread-track .tm-bar{display:none;}
.tm-spread-head,.tm-spread-track .tm-sec-head{font-family:var(--serif);font-weight:600;font-size:1.35em;
  margin:0 0 .6em;text-align:center;text-indent:0;break-inside:avoid;}
.tm-spread-track .tm-blk-tgt.editable{cursor:text;border-radius:3px;}
.tm-spread-track .tm-blk-tgt.editable:hover{background:color-mix(in srgb,var(--brand) 7%,transparent);}
.tm-spread-track .tm-blk-tgt.editing{outline:2px solid var(--brand);}
.tm-spread-spine{position:absolute;top:0;bottom:0;left:50%;width:2px;transform:translateX(-1px);pointer-events:none;
  background:linear-gradient(to right,transparent,rgba(0,0,0,.16),transparent);}
:root[data-theme="ink"] .tm-spread-spine{background:linear-gradient(to right,transparent,rgba(0,0,0,.5),transparent);}
.tm-spread-nav{flex:none;display:flex;align-items:center;justify-content:center;gap:1rem;color:var(--muted);font-size:.8rem;}
.tm-spread-pos{min-width:130px;text-align:center;}

.tm-blk-ph{display:flex;align-items:center;gap:.7rem;padding:.6rem .7rem;margin:.4rem 0;border-radius:10px;
  border:1px dashed var(--rule2,var(--rule));background:var(--surface2);}
.tm-ph-ic{flex:none;color:var(--faint);display:inline-flex;}
.tm-ph-txt{flex:1;min-width:0;}
.tm-ph-title{font-weight:700;font-size:.86rem;color:var(--text);}
.tm-ph-sub{font-size:.74rem;color:var(--muted);}
.tm-ph-del{flex:none;border:1px solid var(--rule2,var(--rule));background:var(--surface);color:var(--danger,#b02a1a);
  font:inherit;font-size:.76rem;font-weight:600;padding:.3rem .6rem;border-radius:8px;cursor:pointer;}
.tm-ph-del:hover{border-color:var(--danger,#b02a1a);background:color-mix(in srgb,var(--danger,#b02a1a) 8%,transparent);}
.tm-ph-del:focus-visible{outline:2px solid var(--brand);outline-offset:2px;}

.tm-blk-fig{display:flex;gap:.9rem;align-items:flex-start;padding:.6rem .7rem;margin:.5rem 0;border-radius:12px;
  border:1px solid var(--rule2,var(--rule));background:var(--surface);}
.tm-blk-fig.svg{flex-direction:column;}
.tm-fig-media{flex:none;max-width:44%;border-radius:8px;overflow:hidden;background:var(--surface2);}
.tm-blk-fig.svg .tm-fig-media{max-width:100%;width:100%;}
.tm-fig-media img,.tm-fig-media svg{display:block;max-width:100%;height:auto;}
.tm-fig-meta{flex:1;min-width:0;display:flex;flex-direction:column;gap:.4rem;}
.tm-fig-label{display:flex;align-items:center;gap:.5rem;flex-wrap:wrap;}
.tm-fig-num{font-family:var(--serif);font-weight:700;font-size:.9rem;color:var(--brand-ink,var(--text));}
.tm-fig-caprow{display:flex;flex-direction:column;gap:.15rem;}
.tm-fig-caplbl{font-size:.64rem;font-weight:800;letter-spacing:.1em;text-transform:uppercase;color:var(--faint);}
.tm-fig-hint{font-size:.8rem;color:var(--faint);font-style:italic;}
.tm-fig-cap{font-size:.9rem;color:var(--text);line-height:1.4;border-radius:6px;padding:.25rem .35rem;
  border:1px solid transparent;}
.tm-fig-cap.editable{cursor:text;}
.tm-fig-cap.editable:hover{background:var(--surface2);border-color:var(--rule);}
.tm-fig-cap.editing{background:var(--surface2);border-color:var(--brand);}
.tm-fig-fields{display:flex;flex-wrap:wrap;align-items:center;gap:.4rem;}
.tm-fig-field{font:inherit;font-size:.82rem;color:var(--text);background:var(--surface2);
  border:1px solid var(--rule2,var(--rule));border-radius:999px;padding:.22rem .6rem;cursor:default;max-width:100%;
  overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
.tm-fig-field.editable{cursor:text;}
.tm-fig-field.editable:hover{border-color:var(--brand);background:color-mix(in srgb,var(--brand) 7%,transparent);}
.tm-fig-field:focus-visible,.tm-fig-cap.editable:focus-visible{outline:2px solid var(--brand);outline-offset:1px;}
.tm-fig-ta{width:100%;box-sizing:border-box;font:inherit;font-size:.9rem;color:var(--text);background:var(--surface);
  border:1px solid var(--brand);border-radius:6px;padding:.3rem .4rem;resize:none;overflow:hidden;line-height:1.4;}
.tm-fig-kindwrap{display:inline-flex;align-items:center;gap:.35rem;}
.tm-fig-kind{font-size:.68rem;font-weight:700;color:var(--muted);background:var(--surface2);
  border:1px solid var(--rule2,var(--rule));border-radius:999px;padding:.14rem .5rem;}
.tm-fig-kind.verbatim{color:var(--brand);border-color:color-mix(in srgb,var(--brand) 45%,transparent);}
.tm-fig-kindflip{font:inherit;font-size:.7rem;font-weight:600;color:var(--brand);background:transparent;
  border:1px solid color-mix(in srgb,var(--brand) 40%,transparent);border-radius:999px;padding:.14rem .5rem;cursor:pointer;}
.tm-fig-kindflip:hover{background:color-mix(in srgb,var(--brand) 8%,transparent);}
.tm-fig-kindflip:focus-visible{outline:2px solid var(--brand);outline-offset:1px;}

.tm-spread-track .tm-blk-fig{flex-direction:column;border:0;background:transparent;padding:0;margin:0 0 .5em;text-indent:0;}
.tm-spread-track .tm-fig-media{max-width:100%;width:100%;}

.rv-cycle{position:fixed;right:16px;bottom:16px;z-index:50;width:44px;height:44px;border-radius:50%;
  display:grid;place-items:center;color:var(--text);background:var(--surface);
  border:1px solid var(--rule2,var(--rule));box-shadow:0 6px 24px rgba(0,0,0,.18);cursor:pointer;}
.rv-cycle:hover{border-color:var(--brand);color:var(--brand);}
.rv-cycle:focus-visible{outline:2px solid var(--brand);outline-offset:2px;}
.rv-cycle[aria-pressed="true"]{color:var(--brand);border-color:var(--brand);}
body.ws-panel-active .rv-cycle,body.ws-panel-active #rv-spread{display:none;}
#reading.rv-on #article{display:none;}
.rv-spread{position:absolute;left:0;right:0;top:0;bottom:0;display:flex;flex-direction:column;min-height:0;
  gap:.5rem;padding:.7rem clamp(.5rem,2vw,1.4rem) 1rem;}
.rv-loading{margin:auto;color:var(--muted);display:flex;align-items:center;gap:.5rem;}
.rv-chip{flex:none;font-size:.74rem;color:var(--muted);background:var(--surface2);
  border:1px dashed var(--rule2,var(--rule));border-radius:8px;padding:.32rem .6rem;text-align:center;}
.rv-chip strong{color:var(--text);font-weight:700;}
.rv-book{position:relative;margin:auto;max-width:100%;max-height:100%;background:var(--surface);
  border:1px solid var(--rule2,var(--rule));border-radius:2px;box-shadow:0 8px 42px rgba(0,0,0,.18);overflow:hidden;}
.rv-track{color:var(--text);font-family:var(--serif);hyphens:auto;-webkit-hyphens:auto;}
.rv-track .rv-blk{margin:0 0 .3em;}
.rv-track .rv-blk p{margin:0 0 .3em;text-indent:1.25em;}
.rv-track .rv-blk sup.fn{font-size:.7em;color:var(--brand);}
.rv-track .rv-blk sup.fn a{color:inherit;text-decoration:none;pointer-events:none;}
.rv-sec-head{font-family:var(--serif);font-weight:600;font-size:1.35em;margin:0 0 .6em;text-align:center;
  break-inside:avoid;}
.rv-fig{margin:0 0 .5em;break-inside:avoid;text-align:center;}
.rv-fig img,.rv-fig svg{display:block;max-width:100%;height:auto;margin:0 auto;}
.rv-figcap{font-size:.8em;color:var(--muted);text-align:center;margin-top:.2em;}
.rv-spine{position:absolute;top:0;bottom:0;left:50%;width:2px;transform:translateX(-1px);pointer-events:none;
  background:linear-gradient(to right,transparent,rgba(0,0,0,.16),transparent);}
:root[data-theme="ink"] .rv-spine{background:linear-gradient(to right,transparent,rgba(0,0,0,.5),transparent);}
.rv-nav{flex:none;display:flex;align-items:center;justify-content:center;gap:1rem;color:var(--muted);font-size:.8rem;}
.rv-pos{min-width:130px;text-align:center;}
.rv-navbtn{font:inherit;font-size:1.2rem;line-height:1;color:var(--text);background:var(--surface);
  border:1px solid var(--rule2,var(--rule));border-radius:8px;width:2rem;height:2rem;cursor:pointer;}
.rv-navbtn:hover{border-color:var(--brand);color:var(--brand);}
.rv-navbtn:focus-visible{outline:2px solid var(--brand);outline-offset:2px;}

@media(max-width:720px){
  .tm-blk-fig{flex-direction:column;}
  .tm-fig-media{max-width:100%;width:100%;}
}

@media(max-width:720px){
  .tm-work{flex-direction:column;}
  .tm-view-one-page .tm-toolbox,.tm-view-spread .tm-toolbox{width:auto;flex-direction:row;flex-wrap:wrap;
    align-items:center;border-left:0;border-top:1px solid var(--rule2,var(--rule));padding:.6rem .7rem;}
  .tm-view-one-page .tm-tb-actions,.tm-view-spread .tm-tb-actions{flex-direction:row;}
  .tm-view-spread .tm-tb-prog{display:none;}
  .tm-view-one-page .tm-panes{max-width:100%;}
}

.dm-input {
  width: 100%; box-sizing: border-box; margin-top: 10px; padding: 10px;
  font: inherit; color: var(--text); background: var(--bg, var(--surface));
  border: 1px solid var(--rule2, var(--rule)); border-radius: 10px;
}
.dm-input:focus-visible { outline: 2px solid var(--brand-bright, var(--brand)); outline-offset: 1px; }
textarea.dm-input { resize: vertical; min-height: 84px; }
.dm-lbl { display:block; margin:12px 0 2px; font-size:.8rem; color: var(--muted); font-weight:600; }

.up-tiers{display:grid;grid-template-columns:1fr 1fr;gap:.7rem;margin-top:1rem;}
@media(max-width:520px){ .up-tiers{grid-template-columns:1fr;} }
.up-tier{font:inherit;text-align:left;cursor:pointer;background:var(--bg,var(--surface));color:var(--text);
  border:1px solid var(--rule2,var(--rule));border-radius:12px;padding:.9rem .95rem;transition:border-color .15s,box-shadow .15s;}
.up-tier.on{border-color:var(--brand);box-shadow:0 0 0 2px var(--brand);}
.up-tier .up-name{font-family:var(--serif);font-size:1.15rem;display:block;}
.up-price{margin:.35rem 0 .5rem;font-size:1.05rem;}
.up-price .up-list{color:var(--faint);margin-right:.15rem;}
.up-price small{color:var(--muted);font-size:.76rem;}
.up-feats{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:.3rem;}
.up-feats li{font-size:.8rem;color:var(--muted);line-height:1.35;padding-left:.9rem;position:relative;}
.up-feats li::before{content:"✓";position:absolute;left:0;color:var(--brand);font-weight:700;}
.up-msg{color:var(--danger,#b02a1a);min-height:1em;}

.demo-bar .demo-tag.sample{background:transparent;color:var(--brand);border:1px solid var(--brand);font-weight:700;}

.dm-sheet .ob-steps{list-style:none;margin:1.15rem 0 .2rem;padding:0;display:flex;flex-direction:column;gap:.55rem;}
.dm-sheet .ob-step{display:flex;align-items:center;gap:.7rem;font-size:.95rem;line-height:1.35;color:var(--muted);}
.dm-sheet .ob-step .ob-num{flex:none;width:1.65rem;height:1.65rem;border-radius:999px;display:grid;place-items:center;
  font-size:.82rem;font-weight:700;background:var(--surface2,var(--hl));color:var(--muted);border:1px solid var(--rule2,var(--rule));}
.dm-sheet .ob-step.done{color:var(--text);}
.dm-sheet .ob-step.done .ob-num{background:var(--brand);color:#fff8ef;border-color:var(--brand);}
.dm-sheet .ob-step.active{color:var(--text);font-weight:600;}
.dm-sheet .ob-step.active .ob-num{border-color:var(--brand);color:var(--brand);background:var(--surface);}

.ob-chip{position:fixed;left:max(18px,env(safe-area-inset-left));bottom:max(18px,env(safe-area-inset-bottom));z-index:60;
  display:flex;align-items:center;gap:.15rem;padding:.3rem .35rem .3rem .6rem;border-radius:999px;
  background:var(--surface);border:1px solid var(--rule2,var(--rule));box-shadow:var(--shadow);
  font-family:var(--sans);font-size:.78rem;color:var(--muted);max-width:calc(100vw - 24px);}
.ob-chip .obc-step{display:inline-flex;align-items:center;gap:.28rem;border:none;background:transparent;
  color:var(--muted);font:inherit;padding:.2rem .4rem;border-radius:999px;cursor:pointer;white-space:nowrap;}
.ob-chip .obc-step:hover{background:var(--surface2);color:var(--text);}
.ob-chip .obc-step .obc-dot{flex:none;width:1.1rem;height:1.1rem;border-radius:999px;display:grid;place-items:center;
  font-size:.62rem;font-weight:700;border:1px solid var(--rule2,var(--rule));color:var(--muted);background:var(--surface2);}
.ob-chip .obc-step.done{color:var(--text);}
.ob-chip .obc-step.done .obc-dot{background:var(--brand);border-color:var(--brand);color:#fff8ef;}
.ob-chip .obc-step.next{color:var(--brand-ink,var(--brand));font-weight:600;}
.ob-chip .obc-step.next .obc-dot{border-color:var(--brand);color:var(--brand);background:var(--surface);}
.ob-chip .obc-x{flex:none;border:none;background:transparent;color:var(--faint);font-size:1rem;line-height:1;
  cursor:pointer;padding:.15rem .35rem;border-radius:999px;}
.ob-chip .obc-x:hover{color:var(--text);background:var(--surface2);}
@media(max-width:640px){
  .ob-chip{bottom:max(74px,calc(env(safe-area-inset-bottom) + 62px));left:12px;}
  .ob-chip .obc-lbl{display:none}
}

.demo-bar .demo-tag.coedit{background:transparent;color:var(--brand);border:1px solid var(--brand);font-weight:700;}

.dm-sheet .iv-list{display:flex;flex-direction:column;gap:.5rem;margin:1rem 0;}
.dm-sheet .iv-row{display:flex;align-items:center;gap:.5rem;padding:.6rem .75rem;background:var(--surface2,var(--hl));border:1px solid var(--rule2,var(--rule));border-radius:12px;}
.dm-sheet .iv-row .grow{flex:1;min-width:0;}
.dm-sheet .iv-name{font-weight:600;color:var(--text);font-size:.95rem;}
.dm-sheet .iv-meta{font-size:.8rem;color:var(--muted);margin-top:.1rem;}
.dm-sheet .dm-btn.dm-sm{padding:.32rem .7rem;font-size:.8rem;white-space:nowrap;}
.dm-sheet .iv-new{margin-top:1.1rem;padding-top:1rem;border-top:1px solid var(--rule2,var(--rule));display:flex;flex-direction:column;gap:.5rem;}
.dm-sheet .iv-selrow{display:flex;gap:.5rem;}
.dm-sheet .iv-selrow .dm-input{flex:1;min-width:0;}

.bmi-wrap{position:fixed;inset:0;z-index:200;background:var(--bg,#fff);overflow:auto;overscroll-behavior:contain;}
.bmi-sheet{width:min(900px,100%);margin:0 auto;padding:1.1rem 1rem 6.5rem;}
.bmi-head{display:flex;align-items:flex-start;gap:1rem;padding:.4rem 0 .2rem;position:sticky;top:0;z-index:2;
  background:var(--bg,#fff);border-bottom:1px solid var(--rule);}
.bmi-head h2{font-family:var(--serif);font-weight:600;font-size:1.4rem;margin:0;color:var(--text);}
.bmi-sub{color:var(--muted);font-size:.88rem;margin:.15rem 0 .5rem;}
.bmi-x{flex:none;margin-left:auto;background:none;border:0;color:var(--muted);font-size:1.6rem;line-height:1;cursor:pointer;padding:.1rem .3rem;}
.bmi-x:hover{color:var(--text);}
.bmi-lead{color:var(--muted);font-size:.94rem;line-height:1.6;margin:.9rem 0;}
.bmi-lead strong{color:var(--text);}
.bmi-h3{font-family:var(--serif);font-weight:600;font-size:1.05rem;margin:0 0 .6rem;color:var(--text);}
.bmi-warn{margin:.9rem 0;padding:.7rem .9rem .7rem 2rem;border:1px solid #d9a441;border-radius:10px;
  background:rgba(217,164,65,.09);color:var(--text);font-size:.9rem;line-height:1.5;}
.bmi-warn li+li{margin-top:.35rem;}
.bmi-card{border:1px solid var(--rule2,var(--rule));border-radius:12px;padding:1rem;margin:0 0 1.4rem;background:var(--surface);}
.bmi-meta{display:grid;gap:1rem;}
.bmi-f{display:block;margin:0 0 .6rem;}
.bmi-f span{display:block;font-size:.8rem;color:var(--muted);margin-bottom:.2rem;}
.bmi-f input{width:100%;font:inherit;font-size:.95rem;padding:.5rem .6rem;border:1px solid var(--rule2,var(--rule));
  border-radius:8px;background:var(--bg,#fff);color:var(--text);}
.bmi-f input:focus{outline:2px solid var(--brand);outline-offset:1px;}
.bmi-facts{color:var(--muted);font-size:.82rem;margin:.4rem 0 0;}
.bmi-cover{margin:0;text-align:center;}
.bmi-cover img{max-width:150px;width:100%;border-radius:6px;border:1px solid var(--rule);box-shadow:0 6px 18px rgba(0,0,0,.14);}
.bmi-cover figcaption{color:var(--muted);font-size:.78rem;margin-top:.4rem;}
.bmi-list{display:flex;flex-direction:column;gap:.6rem;}
.bmi-row{border:1px solid var(--rule2,var(--rule));border-left:3px solid var(--rule);border-radius:10px;padding:.7rem .8rem;background:var(--surface);}
.bmi-row.bmi-k-chapter{border-left-color:var(--brand);}
.bmi-row.bmi-k-frontmatter,.bmi-row.bmi-k-backmatter{border-left-color:var(--muted);background:transparent;}
.bmi-row.bmi-gone{opacity:.55;}
.bmi-row-main{display:flex;align-items:center;gap:.5rem;flex-wrap:wrap;}
.bmi-badge{flex:none;min-width:1.7rem;height:1.7rem;padding:0 .35rem;border-radius:999px;display:grid;place-items:center;
  font-size:.78rem;font-weight:700;color:var(--brand);border:1px solid var(--rule2,var(--rule));}
.bmi-title{flex:1 1 12rem;min-width:0;font:inherit;font-size:.98rem;font-weight:600;padding:.4rem .5rem;color:var(--text);
  border:1px solid transparent;border-radius:7px;background:transparent;}
.bmi-title:hover{border-color:var(--rule);}
.bmi-title:focus{outline:2px solid var(--brand);outline-offset:1px;background:var(--bg,#fff);}
.bmi-kind{flex:none;font:inherit;font-size:.82rem;padding:.32rem .4rem;border-radius:7px;
  border:1px solid var(--rule2,var(--rule));background:var(--bg,#fff);color:var(--muted);}
.bmi-row-meta{color:var(--muted);font-size:.8rem;margin:.3rem 0 0 2.2rem;}
.bmi-gone-t{font-weight:600;color:var(--muted);text-decoration:line-through;}
.bmi-acts{display:flex;flex-wrap:wrap;gap:.4rem;margin:.55rem 0 0 2.2rem;}
.bmi-mini{font:inherit;font-size:.78rem;padding:.28rem .55rem;border-radius:999px;cursor:pointer;
  border:1px solid var(--rule2,var(--rule));background:transparent;color:var(--muted);}
.bmi-mini:hover{border-color:var(--brand);color:var(--text);}
.bmi-mini.bmi-danger:hover{border-color:#b4432f;color:#b4432f;}
.bmi-link{font:inherit;font-size:inherit;background:none;border:0;padding:0;color:var(--brand);cursor:pointer;text-decoration:underline;}
.bmi-split{margin:.7rem 0 0 2.2rem;border-top:1px dashed var(--rule);padding-top:.6rem;}
.bmi-split-help,.bmi-split-note{color:var(--muted);font-size:.8rem;margin:.2rem 0 .5rem;}
.bmi-split-note{margin-left:2.2rem;}
.bmi-blocks{list-style:none;margin:0;padding:0;max-height:16rem;overflow:auto;display:flex;flex-direction:column;gap:.15rem;}
.bmi-b{display:block;width:100%;text-align:left;font:inherit;font-size:.82rem;line-height:1.4;padding:.35rem .5rem;
  border:1px solid transparent;border-radius:6px;background:transparent;color:var(--muted);cursor:pointer;}
.bmi-b:hover{border-color:var(--rule);color:var(--text);}
.bmi-b.on{border-color:var(--brand);background:rgba(124,77,186,.1);color:var(--text);}
.bmi-b-h .bmi-b{font-weight:700;color:var(--text);}
.bmi-foot{position:fixed;left:0;right:0;bottom:0;z-index:3;padding:.7rem 1rem calc(.7rem + env(safe-area-inset-bottom));
  background:var(--surface);border-top:1px solid var(--rule2,var(--rule));}
.bmi-foot-acts{display:flex;gap:.6rem;justify-content:flex-end;align-items:center;width:min(900px,100%);margin:0 auto;}
.bmi-msg{color:var(--muted);font-size:.85rem;margin:0 auto .35rem;width:min(900px,100%);}
.bmi-btn{font:inherit;font-weight:600;font-size:.92rem;padding:.6rem 1rem;border-radius:9px;cursor:pointer;
  border:1px solid var(--rule2,var(--rule));background:var(--surface);color:var(--text);}
.bmi-btn:hover{border-color:var(--brand);}
.bmi-btn.primary{background:var(--brand);border-color:var(--brand);color:#fff8ef;}
.bmi-btn.primary:hover{filter:brightness(1.06);}
.bmi-btn[disabled]{opacity:.6;cursor:default;}

.dz-alt{margin:.8rem 0 0;padding:.75rem .85rem;border:1px dashed var(--rule2,var(--rule));border-radius:10px;}
.dz-alt b{display:block;font-size:.92rem;color:var(--text);margin-bottom:.15rem;}
.dz-alt p{margin:0 0 .5rem;font-size:.85rem;}
@media (min-width:720px){
  .bmi-sheet{padding:1.4rem 1.5rem 6.5rem;}
  .bmi-meta{grid-template-columns:1fr auto;align-items:start;gap:1.6rem;}
  .bmi-head h2{font-size:1.7rem;}
}

.bmpay-sheet{width:min(500px,96vw);background:#ffffff;border-color:#e9e2d6;padding:1.15rem 1.25rem 1rem;}
.bmpay-sheet h3{color:#211c15;}
.bmpay-sheet .dm-note{color:#6c6356;}
.bmpay-head{display:flex;align-items:flex-start;justify-content:space-between;gap:1rem;}
.bmpay-head h3{margin:0;}
.bmpay-x{background:none;border:0;color:var(--faint);font-size:1.5rem;line-height:1;cursor:pointer;
  padding:0 .1rem;border-radius:8px;flex:none;}
.bmpay-x:hover{color:var(--text);}
.bmpay-note{margin-top:.35rem;}

.bmpay-frame{margin:.6rem -.35rem 0;min-height:460px;}
.bmpay-mor{border-top:1px solid #ece5d8;padding-top:.75rem;margin-top:.5rem;color:#6c6356;}

.bmpay-done{text-align:center;padding:1.6rem .4rem .8rem;}
.bmpay-tick{width:54px;height:54px;margin:0 auto .9rem;border-radius:50%;
  background:var(--brand,#7C4DBA);color:#fff8ef;font-size:1.7rem;line-height:54px;font-weight:600;}
.bmpay-done h3{margin:0 0 .3rem;}

.db-drop { display: inline-flex; align-items: baseline; gap: .45rem; }
.db-drop .db-drop-hint { font-style: normal; opacity: .55; font-size: .82em; }
.db-drop.over { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 10%, transparent); }
.db-drop.over .db-drop-hint { opacity: .9; }
@media (max-width: 640px) { .db-drop .db-drop-hint { display: none; } }

body.ws-panel-active #panel-edit .rv-spread { display: flex; }
.rv-spread.rv-in-panel { position: static; margin: 0; padding-left: 0; padding-right: 0;
  padding-top: 0; flex: 1 1 auto; min-height: 0; }

.rv-blk { border-radius: 3px; }
.rv-blk:hover { background: color-mix(in srgb, currentColor 6%, transparent); cursor: text; }
.rv-edit { display: block; width: 100%; box-sizing: border-box; margin: 0; padding: 0;
  border: 0; outline: 0; background: transparent; color: inherit; resize: none; overflow: hidden;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--brand) 45%, transparent); border-radius: 3px; }
.rv-edit:focus { box-shadow: inset 0 0 0 2px var(--brand); }

.dz-confirm{display:flex;gap:.6rem;align-items:flex-start;cursor:pointer;margin:.9rem 0 0;
  padding:.7rem .8rem;border-radius:10px;border:1px solid var(--rule2,var(--rule));
  background:var(--surface2);}
.dz-confirm:hover{border-color:var(--brand);}
.dz-confirm input{margin-top:.18rem;accent-color:var(--brand);flex:none;width:16px;height:16px;}
.dz-confirm b{display:block;font-size:.88rem;font-weight:650;}
.dz-confirm em{display:block;font-style:normal;font-size:.8rem;color:var(--muted);line-height:1.5;margin-top:.25rem;}

.bm-cr-waiver{display:flex;gap:.55rem;align-items:flex-start;cursor:pointer;margin:1rem 0 0;
  padding:.6rem .7rem;border-radius:10px;border:1px solid var(--rule2,var(--rule));
  background:var(--surface2);font-size:.84rem;line-height:1.5;}
.bm-cr-waiver input{margin-top:.2rem;accent-color:var(--brand);flex:none;width:15px;height:15px;}
.bm-cr-waiver a{color:var(--brand);}
.bm-cr-waiver.nudge{border-color:var(--brand);animation:bmCrNudge .5s ease;}
@keyframes bmCrNudge{0%,100%{transform:translateX(0)}25%{transform:translateX(-4px)}75%{transform:translateX(4px)}}
@media(prefers-reduced-motion:reduce){.bm-cr-waiver.nudge{animation:none;}}
