/*! 小桃源·剧场自有代码保留所有权利。未经授权，不得复制、转载、出售或用于制作衍生产品。第三方代码及用户自有内容的权利归原权利人。 */
/*! 小桃源·剧场自有代码保留所有权利。未经授权，不得复制、转载、出售或用于制作衍生产品。第三方代码及用户自有内容的权利归原权利人。 */
/*! 小桃源·剧场自有代码保留所有权利。未经授权，不得复制、转载、出售或用于制作衍生产品。第三方代码及用户自有内容的权利归原权利人。 */
/*! 小桃源·剧场自有代码保留所有权利。未经授权，不得复制、转载、出售或用于制作衍生产品。第三方代码及用户自有内容的权利归原权利人。 */
/*! 小桃源·剧场自有代码保留所有权利。未经授权，不得复制、转载、出售或用于制作衍生产品。第三方代码及用户自有内容的权利归原权利人。 */
/*! 小桃源·剧场自有代码保留所有权利。未经授权，不得复制、转载、出售或用于制作衍生产品。第三方代码及用户自有内容的权利归原权利人。 */
/*! 小桃源·剧场自有代码保留所有权利。未经授权，不得复制、转载、出售或用于制作衍生产品。第三方代码及用户自有内容的权利归原权利人。 */
/*! 小桃源·剧场自有代码保留所有权利。未经授权，不得复制、转载、出售或用于制作衍生产品。第三方代码及用户自有内容的权利归原权利人。 */
/*! 小桃源·剧场自有代码保留所有权利。未经授权，不得复制、转载、出售或用于制作衍生产品。第三方代码及用户自有内容的权利归原权利人。 */
/*! 小桃源·剧场自有代码保留所有权利。未经授权，不得复制、转载、出售或用于制作衍生产品。第三方代码及用户自有内容的权利归原权利人。 */
/*! 小桃源·剧场自有代码保留所有权利。未经授权，不得复制、转载、出售或用于制作衍生产品。第三方代码及用户自有内容的权利归原权利人。 */
/*! 小桃源·剧场自有代码保留所有权利。未经授权，不得复制、转载、出售或用于制作衍生产品。第三方代码及用户自有内容的权利归原权利人。 */

/* 2026年10月10日用户确认；标准与正式页面共用。 */
:root{--ui-top-mobile:48px;--ui-top-desktop:76px;--ui-shelf-top-mobile:48px;--ui-shelf-top-desktop:64px;--ui-panel-mobile:48px;--ui-panel-desktop:64px;--ui-control-height:34px;--ui-button-height:28px;--ui-control-radius:5px;--ui-gap:8px;--ui-confirm-width:360px;--ui-confirm-paper:var(--paper,#fffcf5);--ui-confirm-ink:var(--ink,#303d35);--ui-confirm-line:var(--line,#dcded2);--ui-confirm-accent:var(--accent,#486050);--ui-top-height:var(--ui-top-mobile);--ui-shelf-top-height:var(--ui-shelf-top-mobile)}
/* 在弹窗所在页面取色，跟随当前昼夜设置。 */
body{--ui-confirm-paper:var(--paper,#fffcf5);--ui-confirm-ink:var(--ink,#303d35);--ui-confirm-line:var(--line,#dcded2);--ui-confirm-accent:var(--accent,#486050)}
@media(min-width:761px){:root{--ui-top-height:var(--ui-top-desktop);--ui-shelf-top-height:var(--ui-shelf-top-desktop)}}
.ui-top,body[data-page]:not([data-page=shelf]):not([data-page=pool]) #app>.top{height:var(--ui-top-height);min-height:var(--ui-top-height)}
body:is([data-page=shelf],[data-page=pool]) #app>.top{height:var(--ui-shelf-top-height);min-height:var(--ui-shelf-top-height)}
@media(min-width:761px){body:is([data-page=shelf],[data-page=pool]) .top>.shelf-tabs{height:var(--ui-shelf-top-height)}}
.ui-top{display:grid;grid-template-columns:40px minmax(0,1fr) 40px;align-items:center;padding:0 18px;border-bottom:1px solid var(--line);background:var(--bg)}
.ui-top h2{font-size:16px;line-height:1.4;font-weight:400;font-style:normal;font-family:inherit;text-align:center;margin:0}
.ui-icon{width:32px;height:32px;padding:0;display:grid;place-items:center;background:none;border:0;box-shadow:none}
.ui-icon svg{width:18px;height:18px}
.ui-button{height:var(--ui-button-height);min-height:var(--ui-button-height);padding:3px 12px;border-radius:var(--ui-control-radius);font-size:13px;line-height:1.4;font-weight:normal;font-style:normal;font-family:inherit}
.ui-button.primary{background:var(--accent);color:var(--paper)}
.ui-search{display:flex;gap:var(--ui-gap);align-items:center;min-width:0}
.ui-search input,.ui-input{height:var(--ui-control-height);min-height:var(--ui-control-height);font-size:13px;line-height:1.4;font-weight:normal;font-style:normal;font-family:inherit;padding:5px 10px;border-radius:var(--ui-control-radius);width:100%;min-width:0}
.ui-search input{flex:1}.ui-search button{flex:none}.ui-search button[hidden]{display:none}
dialog.ui-confirm{transform:none;width:min(var(--ui-confirm-width),calc(100vw - 36px));max-width:none;max-height:calc(100dvh - 36px);margin:auto;inset:0;height:fit-content;padding:22px;border:1px solid var(--ui-confirm-line);border-radius:10px;background:var(--ui-confirm-paper);color:var(--ui-confirm-ink)}
.ui-confirm h2{font-size:16px;line-height:1.5;font-weight:400;font-style:normal;font-family:inherit;text-align:center;margin:0 0 12px}
.ui-confirm p{font-size:14px;line-height:1.8;font-weight:normal;font-style:normal;font-family:inherit;white-space:pre-wrap;overflow-wrap:anywhere;margin:0 0 18px}
.ui-confirm-actions{display:grid;grid-template-columns:none;grid-auto-flow:column;grid-auto-columns:minmax(0,1fr);gap:8px;width:100%}.ui-confirm-actions>button{width:100%}.ui-confirm-actions.three{grid-auto-flow:row;grid-template-columns:1fr}
.ui-confirm::backdrop{background:rgba(15,16,17,.28)}
.ui-button:focus-visible,.ui-icon:focus-visible{outline:2px solid var(--accent);outline-offset:3px}
.ui-text-tools button,.script-text-tools .script-expand{background:transparent;border:0;box-shadow:none;border-radius:0}
.ui-text-editor{position:relative}.ui-text-editor textarea{padding-bottom:30px}.ui-text-tools{position:absolute;bottom:4px;left:5px;right:12px;display:flex;justify-content:space-between;align-items:center;pointer-events:none}.ui-text-tools button{pointer-events:auto;width:24px;height:22px;padding:0}.ui-text-tools output{font-size:10px;line-height:16px;font-weight:normal;font-style:normal;font-family:inherit;color:var(--muted)}
@media(min-width:761px){.ui-top{padding-inline:40px}.ui-top h2{font-size:16px}}
.ui-panel-footer{flex:none;padding:14px 22px;border-top:1px solid var(--line);display:flex;justify-content:flex-end;gap:8px;background:var(--paper)}
.ui-panel-footer>.popup-actions{display:grid;grid-auto-flow:column;grid-auto-columns:minmax(0,1fr);gap:8px;width:100%}.ui-panel-footer>.popup-actions>button{width:100%}
body #sheet[open]{display:flex;flex-direction:column;overflow:hidden}
body #sheet>.sheet-head{flex:none}
body #sheet>.sheet-body{flex:1;min-height:0;max-height:none;overflow:auto}
/* 折叠内容展开后，表单末尾的操作仍留在当前滚动区底边。 */
.ui-panel>.sheet-body>form>.form-footer:last-child{position:sticky;bottom:0;z-index:2;background:var(--bg);padding-block:var(--ui-gap);}
.ui-panel>.sheet-body>form>.form-footer:last-child::after{content:'';position:absolute;top:100%;left:0;right:0;height:var(--ui-panel-body-padding,22px);background:var(--bg);pointer-events:none}
.ui-panel>.sheet-body>form>button[type=submit]:last-child{position:sticky;bottom:var(--ui-gap);z-index:2}

body #sheet.ui-bottom-sheet{width:min(580px,100vw);height:auto;max-height:80dvh;margin:auto auto 0;inset:auto 0 0;border-radius:16px 16px 0 0}
.ui-disclosure{margin:0;border-bottom:1px solid var(--line)}
.ui-disclosure>summary{list-style:none;display:flex;align-items:center;gap:8px;min-height:34px;padding:8px 0;font-size:13px;color:var(--ink);cursor:pointer}
.ui-disclosure>summary::-webkit-details-marker{display:none}.ui-disclosure-arrow{display:flex;width:14px;height:14px;flex:none}.ui-disclosure-arrow svg{width:14px;height:14px}.ui-disclosure[open]>.ui-disclosure-arrow,.ui-disclosure[open]>summary>.ui-disclosure-arrow{transform:rotate(90deg)}
.ui-disclosure-body{padding:4px 0 3px}.ui-disclosure-body .ui-disclosure{margin-left:14px}
.ui-disclosure-body>.field:last-child{margin-bottom:0}
.ui-disclosure-body .popup-list{gap:4px}
.ui-disclosure-body .popup-list label{padding:6px 0 3px}
.popup-list>[hidden]{display:none!important}
.popup-list{display:grid;gap:4px}
.popup-list label{display:flex;gap:8px;align-items:center;padding:6px 0 3px;border-bottom:1px solid var(--line)}
.ui-chapter-number{font-weight:700}
body #sheet .check-row input[type=radio]{width:17px;min-width:17px;height:17px;min-height:17px;flex:0 0 17px;padding:0;margin:2px 0 0;box-shadow:none;background:transparent;border:0;accent-color:var(--accent)}
@media(max-width:760px){.ui-panel-footer{padding:14px 18px calc(14px + env(safe-area-inset-bottom))}}

/* 正式页面接入，特殊内容页面继续使用自己的布局。 */
.ui-button{box-sizing:border-box;color:var(--ink);background:var(--paper);border:1px solid var(--line);cursor:pointer;box-shadow:none;min-width:0}
.ui-button.primary{border-color:var(--accent)}
.ui-input{box-sizing:border-box;color:var(--ink);background:var(--paper);border:1px solid var(--line)}
body[data-ui-surface=reading] :is(input,select).ui-input,body[data-ui-surface=square] :is(input,select).ui-input{height:var(--ui-control-height)!important;min-height:var(--ui-control-height)!important;font-size:13px!important;line-height:1.4;padding-block:5px;border-radius:var(--ui-control-radius)}
body[data-ui-surface] button.ui-button{height:var(--ui-button-height)!important;min-height:var(--ui-button-height)!important;padding-block:3px;font-size:13px;line-height:1.4;border-radius:var(--ui-control-radius);box-shadow:none}
body[data-ui-surface=account] :is(input,select).ui-input{height:var(--ui-control-height)!important;min-height:var(--ui-control-height)!important;font-size:13px;padding-block:5px}body[data-ui-surface=account] input:is([type=email],[type=password]).ui-input{font-size:16px}

/* 手机共用输入保持足够字号，避免点入时放大；正文和用户网页保持自己的样式。 */
@media(max-width:760px){
 body[data-ui-surface] :is(input.ui-input,select.ui-input,textarea):not(:where(.reading-frame *,.reader-phone-screen *,main.reader *)){font-size:16px!important}
 body[data-ui-surface] :is(#write-request,#user-additional-rule){font-size:16px!important}
}

body[data-ui-surface] .ui-search{margin-bottom:8px;width:100%;max-width:420px}
body[data-ui-surface] .ui-search>.ui-input{margin:0!important;width:100%!important;min-width:0!important}
body[data-ui-surface=square] #search-form{gap:var(--ui-gap)}
body[data-ui-surface=square] #search-form>.ui-search{margin:0;flex:1;max-width:none}
body[data-ui-surface=reading] #app>.top .top-title{font-size:16px;text-align:center}
body[data-ui-surface=reading]:not([data-page=shelf]):not([data-page=pool]):not([data-page=home]) #app>.top:not(.object-top){position:relative}
body[data-ui-surface=reading]:not([data-page=shelf]):not([data-page=pool]):not([data-page=home]) #app>.top .top-title{position:absolute;left:50%;transform:translateX(-50%);max-width:calc(100% - 160px);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;pointer-events:none}
body[data-ui-surface=reading] .top .icon{width:32px;height:32px;min-height:32px}
body[data-ui-surface=square] .header,body[data-ui-surface=account] .header{height:var(--ui-top-height);min-height:var(--ui-top-height);box-sizing:border-box}
body[data-ui-surface] :is(.check-row,.radio-row) input:is([type=radio],[type=checkbox]){width:17px!important;min-width:17px;height:17px!important;min-height:17px;flex:0 0 17px;padding:0;margin:2px 0 0;box-shadow:none}
body[data-ui-surface] .ui-disclosure>summary{list-style:none;display:flex;align-items:center;gap:8px;min-height:34px;font-size:13px;cursor:pointer}
body[data-ui-surface] .ui-disclosure>summary:before{display:none!important}
body[data-ui-surface] .ui-disclosure>summary::-webkit-details-marker{display:none}
body[data-ui-surface] .ui-disclosure>summary .filter-chevron{display:none}
body[data-ui-surface] .ui-disclosure>:not(summary){margin-bottom:3px}
body[data-ui-surface] .ui-disclosure>.field:last-child{margin-bottom:3px}
body[data-ui-surface] :is(.association-options,.binding-options,.script-filter-fields) .check-row{padding-block:6px 3px}
body[data-ui-surface] :is(.association-options,.binding-options) .check-row{border-bottom:1px solid var(--line)}
body[data-ui-surface] .form-footer:has(>button:nth-child(2)){display:grid;grid-auto-flow:column;grid-auto-columns:minmax(0,1fr);gap:var(--ui-gap);width:100%}
body[data-ui-surface] .form-footer:has(>button:nth-child(2))>button{width:100%;margin:0}
body[data-ui-surface] .ui-panel[open]{display:flex;flex-direction:column;overflow:hidden}
body[data-ui-surface] .ui-panel>.sheet-head{display:grid;grid-template-columns:32px minmax(0,1fr) 32px;align-items:center;flex:none;height:var(--ui-panel-mobile);min-height:var(--ui-panel-mobile);padding:0 18px;border-bottom:1px solid var(--line);background:var(--bg)}
body[data-ui-surface] .ui-panel>.sheet-head h2{font-size:16px;font-weight:400;text-align:center;margin:0}
body[data-ui-surface] .ui-panel>.sheet-body{flex:1;min-height:0;overflow:auto;max-height:none}
body[data-ui-surface] .ui-panel>.sheet-head .icon{width:32px;height:32px;background:transparent;border:0;padding:0;box-shadow:none}
body dialog.ui-confirm,body #sheet.ui-confirm{transform:none!important;width:min(var(--ui-confirm-width),calc(100vw - 36px))!important;max-width:none!important;min-width:0!important;height:fit-content!important;min-height:0!important;max-height:calc(100dvh - 36px)!important;inset:0!important;margin:auto!important;padding:22px!important;border:1px solid var(--ui-confirm-line)!important;border-radius:10px!important;background:var(--ui-confirm-paper)!important;color:var(--ui-confirm-ink);overflow:auto!important}
body dialog.ui-confirm[open],body #sheet.ui-confirm[open]{display:block!important}
body dialog.ui-confirm>h2{font-size:16px!important;line-height:1.5!important;font-weight:400!important;font-style:normal!important;font-family:inherit!important;text-align:center!important;margin:0 0 12px!important}
body dialog.ui-confirm .ui-confirm-actions{display:grid!important;grid-auto-flow:column;grid-template-columns:none;grid-auto-columns:minmax(0,1fr);gap:8px!important;margin:18px 0 0!important;padding:0!important;width:100%;justify-content:stretch}
body dialog.ui-confirm .ui-confirm-actions.three{grid-auto-flow:row;grid-template-columns:1fr}
body dialog.ui-confirm .ui-confirm-actions>button{width:100%!important;height:var(--ui-button-height)!important;min-height:var(--ui-button-height)!important;margin:0!important;font-size:13px!important;line-height:1.4;padding:3px 12px!important;border-radius:5px;min-width:0}
body dialog.ui-confirm .sheet-body{padding:0!important;max-height:none!important}
body dialog.ui-confirm::backdrop{background:rgba(15,16,17,.28)!important}
body dialog.ui-confirm .delete-confirm,body dialog.ui-confirm .delete-book-confirm,body dialog.ui-confirm .script-exit-body{padding:0;margin:0}
body dialog.ui-confirm p{white-space:pre-wrap;overflow-wrap:anywhere;font-size:14px;line-height:1.8}
body[data-ui-surface] .ui-panel.ui-bottom-sheet{width:min(580px,100vw)!important;height:auto!important;max-height:80dvh!important;margin:auto auto 0!important;inset:auto 0 0!important;border-radius:16px 16px 0 0!important}
/* 数据备份保留设置页面，五项操作使用共用小窗。 */
body[data-ui-surface] #sheet.ui-backup-dialog{width:min(580px,calc(100vw - 36px))!important;height:fit-content!important;min-height:0!important;max-height:calc(100dvh - 36px)!important;inset:0!important;margin:auto!important;transform:none!important;border:1px solid var(--line)!important;border-radius:10px!important}
body[data-ui-surface] #sheet.ui-backup-dialog>.sheet-body{flex:0 1 auto;padding:18px;overflow:auto}
body[data-ui-surface] #sheet.ui-backup-dialog>.sheet-body>p:first-child{margin-top:0}
body[data-ui-surface] #sheet.ui-backup-dialog>.sheet-body>section>.form-footer{margin-bottom:0}
@media(min-width:761px){body[data-ui-surface] .ui-panel>.sheet-head{height:var(--ui-panel-desktop);min-height:var(--ui-panel-desktop);padding-inline:22px}}

.ui-panel{width:min(640px,calc(100vw - 36px));max-width:none;max-height:calc(100dvh - 36px);padding:0;border:1px solid var(--line);border-radius:10px;background:var(--bg);color:var(--ink)}
.ui-panel>.sheet-head{display:grid;grid-template-columns:32px minmax(0,1fr) 32px;align-items:center;height:var(--ui-panel-mobile);padding:0 18px;border-bottom:1px solid var(--line);flex:none}
.ui-panel>.sheet-head h2{margin:0;font-size:16px;font-weight:400;text-align:center}
.ui-panel>.sheet-body{padding:22px;min-height:0;flex:1;overflow:auto}
.ui-panel[open]{display:flex;flex-direction:column;overflow:hidden}
.ui-panel>.sheet-head .icon{width:32px;height:32px;background:transparent;border:0;padding:0;box-shadow:none}
.ui-panel::backdrop{background:rgba(15,16,17,.28)}
.reader-select-head{height:var(--ui-panel-mobile);min-height:var(--ui-panel-mobile)}
.reader-select-picker .ui-search{max-width:none}
.script-random-dialog.ui-panel button.ui-button{height:var(--ui-button-height);min-height:var(--ui-button-height)}
#square-dialog .modal-bottom>.form-footer{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:var(--ui-gap)}
#square-dialog .modal-bottom>.form-footer>button{width:100%}
@media(min-width:761px){.ui-panel>.sheet-head,.reader-select-head{height:var(--ui-panel-desktop);min-height:var(--ui-panel-desktop)}}
@media(max-width:760px){.ui-panel:not(.ui-bottom-sheet):not(.script-random-dialog){width:100vw;max-width:100vw;height:100dvh;max-height:100dvh;inset:0;margin:0;border-radius:0}.ui-panel>.sheet-body{padding:22px 18px}.ui-panel .ui-confirm{height:auto}}

body dialog.ui-confirm button.ui-button:not(.primary){background:var(--ui-confirm-paper)!important;color:var(--ui-confirm-ink)!important;border:1px solid var(--ui-confirm-line)!important;box-shadow:none!important}
body dialog.ui-confirm button.ui-button{font-weight:400!important}
.ui-confirm button.ui-button:not(.primary){background:var(--ui-confirm-paper);border:1px solid var(--ui-confirm-line);color:var(--ui-confirm-ink)}
body[data-ui-surface] :is(.library-quick-import,.compact-add,.entry-pack-action){height:var(--ui-button-height);min-height:var(--ui-button-height);font-size:13px;padding-block:3px}

.ui-panel .reader-select-body{max-height:none;overflow:visible;padding:0}.ui-panel .reader-select-footer{flex:none}.ui-confirm .ui-confirm-body{min-width:0}

body[data-ui-surface] input[type=checkbox]:not(main.reader input):not(.switch-ui):not(.script-beauty-switch input):not(.voice-switch input){display:inline-block!important;width:17px!important;min-width:17px;height:17px!important;min-height:17px;padding:0!important;flex:0 0 17px;vertical-align:middle;box-shadow:none!important;margin:2px 8px 2px 0}

.ui-confirm .ui-button.primary{background:var(--ui-confirm-accent);color:var(--ui-confirm-paper)}

/* 弹窗标题居中，关闭按钮不挤偏标题。 */
dialog .modal-head{display:grid;grid-template-columns:32px minmax(0,1fr) 32px;align-items:center}dialog .modal-head>h2{grid-column:2;grid-row:1;text-align:center;min-width:0}dialog .modal-head>button{grid-column:3;grid-row:1}

/* 广场标签筛选保留原来的紧凑宽度。 */
.sort-bar>.tag-select.ui-input{width:auto;flex:0 1 auto}

body[data-ui-surface=square] .search-bar>#tag-filter.ui-input{width:88px;min-width:0;flex:0 0 88px;padding-inline:8px}
body[data-ui-surface=square] .search-bar>input{min-width:0;flex:1}
body[data-ui-surface=square] .sort-bar{flex-wrap:nowrap}
body[data-ui-surface=square] .sort-bar>.filter-group{width:auto;flex:1;min-width:0}
body[data-ui-surface=square] .sort-bar>.publish-resource{height:var(--ui-button-height);min-height:var(--ui-button-height);padding:3px 12px;display:flex;align-items:center;justify-content:center}
body[data-page=library] #app>.page{padding-top:8px!important}
body[data-ui-surface=reading] .empty-gemini .empty-actions>button.ui-button{padding:3px 12px;line-height:1.4;display:flex;align-items:center;justify-content:center}

/* 删除按钮沿用已有日夜红字，确认按钮也保留红字。 */
:root{--ui-delete-ink:#87534d}
body[data-night=true]{--ui-delete-ink:#d0a29a}
body button.ui-delete,body button.ui-delete strong{color:var(--ui-delete-ink)!important}
body button.ui-delete.primary{background:var(--paper,#fffcf5)!important;border-color:var(--line,#dcded2)!important}

/* 横排分类保留文字宽度，超出时左右滑动。 */
:is(.reader-select-categories,.filter-group,.world-filter,.config-tabs,.voice-library-categories,.voice-chips,.voice-tabs){display:flex;flex-wrap:nowrap!important;justify-content:flex-start!important;gap:var(--ui-gap,8px);overflow-x:auto;overflow-y:hidden;overscroll-behavior-x:contain;-webkit-overflow-scrolling:touch;scrollbar-width:none;min-width:0;max-width:100%;touch-action:pan-x pan-y}
:is(.reader-select-categories,.filter-group,.world-filter,.config-tabs,.voice-library-categories,.voice-chips,.voice-tabs)>:is(button,a){flex:0 0 auto;white-space:nowrap}
.reader-select-categories button{padding-inline:4px;min-height:var(--ui-button-height,28px)}
.inline-tag-filter{position:relative;flex:0 0 88px;width:88px;margin:0!important;border:0!important}
.inline-tag-filter>summary{display:flex;align-items:center;justify-content:space-between;gap:4px;list-style:none;border:1px solid var(--line);border-radius:var(--ui-control-radius,5px);padding:4px 8px;height:var(--ui-input-height,34px);box-sizing:border-box;background:var(--paper);cursor:pointer;font-size:13px;white-space:nowrap;overflow:hidden}
.inline-tag-filter>summary::-webkit-details-marker{display:none}.inline-tag-filter>summary:after{content:'⌄';flex:none}.inline-tag-filter>summary[aria-disabled=true]{cursor:default}
.inline-tag-options{position:absolute;top:calc(100% + 4px);left:0;z-index:30;width:200px;max-width:calc(100vw - 36px);max-height:240px;overflow:auto;display:grid;background:var(--paper);border:1px solid var(--line);border-radius:var(--ui-control-radius,5px);padding:4px;box-shadow:0 4px 12px #0002}
.inline-tag-options button{border:0;background:transparent;color:var(--ink);text-align:left;white-space:normal;min-height:var(--ui-button-height,28px);padding:4px 8px}.inline-tag-options button[aria-pressed=true]{background:var(--soft);color:var(--accent)}
body:is([data-page=entry],[data-page=entry-advanced-page]) .entry-advanced :is(.association-options,.check-row,.entry-media-section,.appearance-complex){border:0!important}
body[data-page=entry] .entry-advanced .association-hint{margin-bottom:var(--ui-gap,8px)}
.appearance-complex-body{padding-top:var(--ui-gap,8px)}.appearance-variable-row{margin-block:var(--ui-gap,8px)}
#profile-form>.form-footer{position:sticky;bottom:0;background:var(--bg);padding-block:var(--ui-gap,8px);margin-top:var(--ui-gap,8px)}#profile-form>.form-footer>button{width:100%;height:var(--ui-button-height,28px);min-height:var(--ui-button-height,28px)}

.inline-tag-filter .ui-disclosure-arrow{display:none!important}

/* 人物高级设定：说明按需查看，操作不再零散放在左侧。 */
body[data-page=entry] .entry-voice-control{margin-block:var(--ui-gap,8px)}
body:is([data-page=entry],[data-page=entry-advanced-page]) :is(.entry-voice-control>button,.appearance-complex .full){display:flex;align-items:center;justify-content:center;width:100%;margin-inline:0}
body:is([data-page=entry],[data-page=entry-advanced-page]) .appearance-complex summary>.appearance-help{margin-left:0}
body:is([data-page=entry],[data-page=entry-advanced-page]) :is(.appearance-help,.appearance-variable-remove){display:grid;place-items:center;flex:none;width:var(--ui-button-height,28px);height:var(--ui-button-height,28px);min-height:var(--ui-button-height,28px);padding:0;margin:0;background:transparent;border:0;box-shadow:none;color:var(--muted)}
body:is([data-page=entry],[data-page=entry-advanced-page]) .appearance-help svg{display:block;width:18px;height:18px}
body:is([data-page=entry],[data-page=entry-advanced-page]) .appearance-variable-remove{font-size:20px;line-height:1}
body:is([data-page=entry],[data-page=entry-advanced-page]) .appearance-variable-row{padding:var(--ui-gap,8px);border:1px solid var(--line);border-radius:var(--ui-control-radius,5px);background:var(--paper)}
body:is([data-page=entry],[data-page=entry-advanced-page]) .appearance-variable-label{display:flex;align-items:center;justify-content:space-between;gap:var(--ui-gap,8px);margin-bottom:4px}
body:is([data-page=entry],[data-page=entry-advanced-page]) .appearance-variable-label>label{margin:0}
body:is([data-page=entry],[data-page=entry-advanced-page]) .appearance-variable-row>.field:last-child{margin-bottom:0}
body:is([data-page=entry],[data-page=entry-advanced-page]) .appearance-complex-body>output:empty{display:none}
body:is([data-page=entry],[data-page=entry-advanced-page]) .appearance-add{margin-block:var(--ui-gap,8px)}

body:is([data-page=entry],[data-page=entry-advanced-page]) [data-appearance-rows]{display:grid;grid-template-columns:minmax(0,1fr);gap:var(--ui-gap,8px);margin-block:var(--ui-gap,8px)}
body:is([data-page=entry],[data-page=entry-advanced-page]) .appearance-variable-row{margin:0;min-width:0}
body:is([data-page=entry],[data-page=entry-advanced-page]) .appearance-variable-row .field{display:grid;grid-template-columns:minmax(0,1fr);min-width:0}
body:is([data-page=entry],[data-page=entry-advanced-page]) .appearance-variable-row .field>label{display:block}
body:is([data-page=entry],[data-page=entry-advanced-page]) .appearance-variable-row input{display:block;width:100%;max-width:none;box-sizing:border-box}
body:is([data-page=entry],[data-page=entry-advanced-page]) .appearance-complex{--appearance-prompt-lines:3;--appearance-prompt-tools:44px}
body:is([data-page=entry],[data-page=entry-advanced-page]) .appearance-complex textarea{height:calc(var(--appearance-prompt-lines) * 1lh + var(--appearance-prompt-tools));min-height:0;max-height:none;resize:vertical}
@media(min-width:761px){body:is([data-page=entry],[data-page=entry-advanced-page]) [data-appearance-rows]{grid-template-columns:repeat(2,minmax(0,1fr))}}

body:is([data-page=entry],[data-page=entry-advanced-page]) #app .appearance-variable-row :is(input,.field>label){width:100%;max-width:none;box-sizing:border-box}

/* 音色入口有独立标题，按钮保留内侧边距。 */
body[data-page=entry] .entry-voice-control{padding:var(--ui-gap,8px);border-radius:var(--ui-control-radius,5px);background:var(--paper)}
body[data-page=entry] .entry-voice-settings{margin:0;border:0}
body[data-page=entry] .entry-voice-heading{display:flex;align-items:center;min-height:var(--ui-button-height,28px)}
body[data-page=entry] .entry-voice-control>button{gap:calc(var(--ui-gap,8px) / 2)}
body[data-page=entry] .entry-voice-control>button>svg{display:block;flex:none;width:16px;height:16px}

/* 每条变量收起后只显示用途，展开时填写。 */
body:is([data-page=entry],[data-page=entry-advanced-page]) .appearance-variable-row>summary{padding-block:0;min-height:var(--ui-control-height,34px)}
body:is([data-page=entry],[data-page=entry-advanced-page]) .appearance-variable-row>summary>[data-appearance-row-title]{flex:1;min-width:0;overflow-wrap:anywhere}
body:is([data-page=entry],[data-page=entry-advanced-page]) .appearance-variable-row>summary>.appearance-variable-remove{margin-left:auto}
body:is([data-page=entry],[data-page=entry-advanced-page]) .appearance-variable-fields{padding-top:var(--ui-gap,8px)}
body:is([data-page=entry],[data-page=entry-advanced-page]) .appearance-ai-form .field{display:grid;margin-bottom:var(--ui-gap,8px)}
body:is([data-page=entry],[data-page=entry-advanced-page]) .appearance-ai-form label{display:block}
body:is([data-page=entry],[data-page=entry-advanced-page]) .appearance-ai-form .check-row{display:flex}
body:is([data-page=entry],[data-page=entry-advanced-page]) .appearance-ai-form textarea{display:block;width:100%;height:calc(2 * 1lh + 16px);min-height:0;resize:vertical}
body #sheet.ui-panel.appearance-ai-panel{height:min(760px,calc(100dvh - 36px));min-height:0;width:min(640px,calc(100vw - 36px));max-height:calc(100dvh - 36px);margin:auto;inset:0;border-radius:10px}
.appearance-ai-reference p{white-space:pre-wrap;overflow-wrap:anywhere}

/* 变量导入和添加沿用共用短按钮，整组居中。 */
body:is([data-page=entry],[data-page=entry-advanced-page]) .appearance-file-picker{display:grid;justify-items:center;gap:var(--ui-gap,8px);padding:var(--ui-gap,8px);border:1px solid var(--line);border-radius:var(--ui-control-radius,5px);background:var(--paper);min-width:0}
body:is([data-page=entry],[data-page=entry-advanced-page]) .appearance-file-picker>[data-appearance-file-name]{margin:0;text-align:center;max-width:100%;overflow-wrap:anywhere}
body:is([data-page=entry],[data-page=entry-advanced-page]) .appearance-add-actions{display:flex;justify-content:center;margin-block:var(--ui-gap,8px)}
body:is([data-page=entry],[data-page=entry-advanced-page]) .appearance-add-actions>.appearance-add{display:inline-flex;align-items:center;justify-content:center;gap:calc(var(--ui-gap,8px) / 2);width:auto;margin:0}
body:is([data-page=entry],[data-page=entry-advanced-page]) .appearance-add>svg{display:block;flex:none;width:14px;height:14px}

/* 粘贴入口放在导入变量标题右侧，填写区沿原位置向下展开。 */
body:is([data-page=entry],[data-page=entry-advanced-page]) .appearance-import-file{position:relative}
body:is([data-page=entry],[data-page=entry-advanced-page]) .appearance-import-heading{display:flex;align-items:center;min-height:calc(var(--ui-button-height,28px) + 2 * var(--ui-gap,8px));padding-right:180px}
body:is([data-page=entry],[data-page=entry-advanced-page]) .appearance-paste-config{margin:0;border:0}
body:is([data-page=entry],[data-page=entry-advanced-page]) .appearance-paste-config>summary{position:absolute;top:0;right:0;padding-block:var(--ui-gap,8px);margin:0;white-space:nowrap}
body:is([data-page=entry],[data-page=entry-advanced-page]) .appearance-paste-body{padding-bottom:var(--ui-gap,8px)}
body:is([data-page=entry],[data-page=entry-advanced-page]) .appearance-paste-body>.appearance-import{margin-top:var(--ui-gap,8px)}

/* 生成结果沿用折叠编辑，完整文字规则单独保留足够高度。 */
body:is([data-page=entry],[data-page=entry-advanced-page]) .appearance-ai-review details{margin-block:var(--ui-gap,8px)}
body:is([data-page=entry],[data-page=entry-advanced-page]) .appearance-ai-review input{width:100%;max-width:none;box-sizing:border-box}
body:is([data-page=entry],[data-page=entry-advanced-page]) .appearance-ai-review textarea{height:calc(3 * 1lh + 16px);min-height:0;overflow-wrap:anywhere}
body:is([data-page=entry],[data-page=entry-advanced-page]) .appearance-ai-review textarea[rows="12"]{height:calc(12 * 1lh + 16px)}

/* 初始两种规则沿用现有折叠控件，填写内容不另加分隔空白。 */
.writing-initial-rules .custom-rule-fixed,[data-page=writing-rule-editor] .custom-rule-fixed{margin:0;padding:0;border:0}
[data-rule-position][hidden]{display:none!important}

/* 高级设定使用现有大项排布，图标尺寸与人物编辑页共用。 */
body[data-page=entry-advanced-page] .entry-advanced-fields>details>summary.entry-advanced-item{position:static;inset:auto;z-index:auto}
body[data-page=entry-advanced-page] .entry-advanced-copy{flex:1;min-width:0}

/* 密钥按钮贴着输入框，展开后可复制，手机仍能完整显示。 */
.ui-key-field{display:flex;align-items:center;gap:var(--ui-gap,8px);min-width:0;width:100%}
.ui-key-field>input{flex:1 1 0;min-width:0;width:0!important}
.ui-key-field>.ui-key-toggle,.ui-key-field>.ui-key-copy{position:static!important;flex:none;display:inline-flex;align-items:center;justify-content:center;width:var(--ui-control-height,36px);min-width:var(--ui-control-height,36px);height:var(--ui-control-height,36px);padding:8px;color:inherit;border:0;background:transparent}
.ui-key-field>button svg{width:18px;height:18px;display:block}
.ui-key-field>.ui-key-copy[hidden]{display:none!important}
@media(max-width:760px){body[data-ui-surface] .ui-key-field>input.ui-input{font-size:16px!important}}

.image-config-save{background:var(--soft,var(--paper));color:var(--ink);border:1px solid var(--line)}
@media(max-width:760px){body[data-page=image-model-settings] #app .image-model-settings :is(input,select,textarea){font-size:16px!important}}

/* 单张图片重生沿用确认弹窗，平台与画风同排，长提示词在框内滚动。 */
body dialog.story-image-prompt-dialog{width:min(640px,calc(100vw - 36px));padding:18px}
.story-image-prompt-dialog form{display:grid;gap:var(--ui-gap,8px);min-width:0}
.story-image-prompt-dialog .field{margin:0!important;gap:4px}
.story-image-prompt-dialog .story-image-choices{display:grid;grid-template-columns:1fr 1fr;gap:var(--ui-gap,8px);min-width:0}
.story-image-prompt-dialog label{margin:0;min-width:0}
.story-image-prompt-dialog select{display:block;width:100%;min-width:0;margin-top:4px}
.story-image-prompt-dialog #story-image-prompt{box-sizing:border-box;width:100%;height:clamp(120px,28dvh,220px);min-height:120px;line-height:1.5;overflow:auto;scrollbar-width:none;resize:vertical}
.story-image-prompt-dialog #story-image-prompt::-webkit-scrollbar{display:none}
.story-image-prompt-dialog .check-row{display:flex;align-items:center;gap:8px;font-size:13px;margin:0;padding:0}
.story-image-prompt-dialog .check-row input{flex:none;width:16px;height:16px;margin:0}
.story-image-prompt-dialog .hint{margin:0;padding:0;border:0;font-size:13px;line-height:1.5}
.story-image-prompt-dialog .form-footer{margin-top:4px}
@media(max-width:760px){body[data-ui-surface] dialog.story-image-prompt-dialog :is(select.ui-input,textarea){font-size:16px!important}}

/* 重新生成图片上下居中，仅NovelAI显示画风，提示词区收紧。 */
body dialog.ui-confirm.story-image-prompt-dialog{width:min(var(--ui-confirm-width,360px),calc(100vw - 48px))!important;margin:auto!important;inset:0!important;padding:18px!important;max-height:calc(100dvh - 36px)!important;overflow-y:auto;scrollbar-width:none}
body dialog.story-image-prompt-dialog::-webkit-scrollbar{display:none}
.story-image-prompt-dialog .story-image-choices{grid-template-columns:minmax(0,1fr)}
.story-image-prompt-dialog .story-image-choices.has-style{grid-template-columns:repeat(2,minmax(0,1fr))}
.story-image-prompt-dialog #story-image-prompt{height:clamp(120px,20dvh,180px)}
.image-current-step{color:var(--accent);font-weight:600}

.story-image-prompt-dialog .story-image-choices>.field[hidden]{display:none!important}

body #sheet>.sheet-pin-footer{flex:none;margin:0;padding:12px 18px calc(12px + env(safe-area-inset-bottom));background:var(--bg);border-top:1px solid var(--line);display:grid;grid-auto-flow:column;grid-auto-columns:minmax(0,1fr);gap:8px}
body #sheet>.sheet-pin-footer>button{width:100%}

.story-image-prompt-dialog.ui-confirm>h2{position:relative;padding-inline:28px}
.story-image-prompt-dialog.ui-confirm>h2>.story-image-prompt-close{position:absolute;right:0;top:50%;transform:translateY(-50%);width:28px;height:28px;min-width:0;padding:0;font-size:24px;line-height:1;font-weight:normal;font-style:normal;font-family:inherit}

/* 阅读设置沿用共用控件和八像素间距，名称与操作靠近。 */
body[data-page=desktop-reading] .desktop-reading-settings .field{grid-template-columns:minmax(0,1fr);align-items:center;gap:var(--ui-gap);margin-bottom:var(--ui-gap)}
[data-image-interval-controls]{flex-wrap:nowrap;min-width:0}
[data-image-interval-controls]>input{width:0;min-width:0;flex:1}
[data-image-interval-controls]>button{flex:none}
[data-image-interval-controls]>input:disabled{color:var(--muted);background:var(--soft);opacity:1}
[data-image-interval-field]>small{grid-column:1/-1;font-size:10px;line-height:1.4;margin-top:calc(var(--ui-gap)*-.75)}
body[data-page=desktop-reading] .desktop-reading-settings .row{gap:var(--ui-gap)}
body[data-page=desktop-reading] .desktop-reading-settings .row.between{justify-content:flex-start;min-height:var(--ui-control-height);gap:var(--ui-gap)}
body[data-page=desktop-reading] .desktop-reading-settings :is(.field label,.row.between>label,.row.between>span){font-size:12px;color:var(--muted)}
body[data-page=desktop-reading] .desktop-reading-settings .separator{margin:var(--ui-gap) 0}
body[data-page=desktop-reading] .desktop-reading-settings .reading-settings-actions{display:flex;flex-wrap:wrap;gap:calc(var(--ui-gap)*3);margin:var(--ui-gap) 0}
body[data-page=desktop-reading] .desktop-reading-settings .check-row{align-items:center;gap:var(--ui-gap);padding:0;border:0;min-height:var(--ui-button-height);font-size:12px}
body[data-page=desktop-reading] .desktop-reading-settings .check-row input{margin:0}
body[data-page=desktop-reading] .desktop-reading-settings .hint{margin:var(--ui-gap) 0 0}

/* 阅读设置按字体、字号与留白、显示、附属开关排列。 */
.reading-options,.reading-layout-options{display:grid;gap:var(--ui-gap)}
body[data-page=desktop-reading] .desktop-reading-settings .reading-options :is(.field,.reading-settings-actions,.hint){margin:0}
.reading-options .reading-settings-actions{display:flex;flex-wrap:nowrap;gap:calc(var(--ui-gap)*3);margin:0}
.reading-options .reading-settings-actions .check-row{align-items:center;gap:var(--ui-gap);padding:0;border:0;min-height:var(--ui-button-height)}
.reading-options .reading-settings-actions input{margin:0}

.reading-font-controls{flex-wrap:nowrap}
.reading-font-controls>select{width:0;min-width:0;flex:1}
.reading-font-controls>button{flex:none;white-space:nowrap}

/* 字号与留白同排，四个加减按钮使用共用小按钮高度。 */
.reading-layout-options{display:flex;flex-wrap:wrap;column-gap:calc(var(--ui-gap)*2);row-gap:var(--ui-gap)}
.reading-layout-options>.row{flex:none}
.reading-layout-options button{width:var(--ui-button-height);min-width:var(--ui-button-height);height:var(--ui-button-height);min-height:var(--ui-button-height);padding:0}

/* 显示方式和全屏阅读居首，主题切换与音效紧随其后。 */
.reading-display-options{display:grid;gap:var(--ui-gap)}
.desktop-reading-settings>section>.reading-display-options{margin-bottom:var(--ui-gap)}
body[data-page=desktop-reading] .desktop-reading-settings .reading-display-options :is(.field,.reading-settings-actions){margin:0}
.reading-display-controls{display:flex;align-items:center;gap:var(--ui-gap)}
.reading-display-controls>select{flex:1;min-width:0;width:0}
.reading-display-controls>.check-row{flex:none;white-space:nowrap}
.reading-display-options .check-row{display:flex;align-items:center;gap:var(--ui-gap);padding:0;border:0;min-height:var(--ui-button-height);font-size:12px}
.reading-display-options .check-row input{margin:0}
.reading-display-options .reading-settings-actions,body[data-page=desktop-reading] .desktop-reading-settings .reading-display-options .reading-settings-actions{display:flex;align-items:center;flex-wrap:nowrap;gap:var(--ui-gap)}
.reading-display-options .reading-settings-actions>span{font-size:12px;color:var(--muted)}
.reading-display-options .reading-settings-actions>.check-row{margin-left:var(--ui-gap)}
body[data-page=desktop-reading] .desktop-reading-settings .reading-display-controls>.check-row{color:var(--ink)}

/* 全屏阅读文字紧贴勾选框，不分散两端。 */
.reading-display-options .reading-display-controls>.check-row,body[data-page=desktop-reading] .desktop-reading-settings .reading-display-controls>.check-row{justify-content:flex-start;gap:calc(var(--ui-gap)/2)}

.reading-display-controls #reading-fullscreen{margin:0}
.reading-layout-options{justify-content:space-between}
.reading-options>.hint,body[data-page=desktop-reading] .desktop-reading-settings .reading-options>.hint{font-size:10px;line-height:1.4;margin-top:calc(var(--ui-gap)*-.75)}

.reading-font-controls #reading-font-family{max-width:none}

/* 小节衔接使用对应美化底色，容纳标题上下空隙。 */
.reading-section-surface{display:contents}
.reading-section-surface[data-themed=true]{display:flow-root;position:relative;isolation:isolate;background:var(--section-paper);color:var(--section-ink)}
.reading-section-surface[data-themed=true]>.section-heading,.reading-section-surface[data-themed=true]>.chapter-version,.reading-section-surface[data-themed=true]>.chapter-version button{color:var(--section-ink);background:transparent}

.reading-section-surface[data-themed=true]::before{content:"";position:absolute;z-index:-1;top:0;bottom:0;left:calc(-1 * var(--section-left,0px));right:calc(-1 * var(--section-right,0px));background:var(--section-paper);pointer-events:none}

/* 单张图片编辑窗口的关闭叉号不带底框，保留原有点击范围。 */
body dialog.story-image-prompt-dialog.ui-confirm>h2>button.story-image-prompt-close.ui-icon{background:transparent!important;border:0!important;border-radius:0;box-shadow:none!important;outline:0!important}
.story-image-prompt-dialog.ui-confirm>h2>.story-image-prompt-close:focus-visible{outline:0;font-weight:700}

/* 普通页面沿用广场的常驻头部；正文阅读保留原有显隐操作。 */
body[data-ui-surface=reading] #app>.top{position:sticky!important;top:0;z-index:100;background:var(--bg);flex-shrink:0}
body[data-ui-surface=reading]{--ui-page-search-top:var(--ui-top-height)}
body[data-ui-surface=reading]:is([data-page=shelf],[data-page=pool]){--ui-page-search-top:var(--ui-shelf-top-height)}
body[data-ui-surface=reading] #app>.page :is(.shelf-book-toolbar,.script-list-filter,.writing-rule-toolbar),
body[data-ui-surface=reading] #app>.page>.ui-search:has(.library-search),
body[data-ui-surface=reading] #app>.page>.desktop-library-actions:has(.library-search){position:sticky;top:var(--ui-page-search-top);z-index:20;background:var(--bg)}

/* 搜索框空着时显示淡放大镜，提示文字在后，输入后恢复原留白。 */
body[data-ui-surface] input:is([type=search],[placeholder^="搜索"],[placeholder^="查找"]):placeholder-shown{background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23838b86' stroke-opacity='.35' stroke-width='1.6' stroke-linecap='round'%3E%3Ccircle cx='10.5' cy='10.5' r='6.5'/%3E%3Cpath d='m15.5 15.5 5 5'/%3E%3C/svg%3E");background-repeat:no-repeat;background-position:10px center;background-size:14px 14px;padding-left:32px}

/* 阅读设置沿用现有开关，两项数量同行。 */
[data-image-interval-field]{display:flex!important;flex-direction:column;align-items:stretch!important;gap:6px}
body [data-image-interval-field] .chapter-image-heading{display:flex;flex-direction:row;justify-content:space-between;align-items:center;width:100%;margin:0;text-align:left}
[data-image-interval-controls].chapter-image-numbers{display:grid;width:100%;grid-template-columns:minmax(0,1fr) minmax(0,1.2fr);gap:8px}
.chapter-image-numbers>label{display:flex!important;align-items:center;gap:3px;width:auto!important;white-space:nowrap;margin:0!important;font-size:13px!important}
body .chapter-image-numbers input[type=number]{width:52px;min-width:52px;flex:1;height:30px;min-height:30px;padding:3px;font-size:16px;appearance:textfield;-moz-appearance:textfield;text-align:center}
.chapter-image-numbers input::-webkit-inner-spin-button,.chapter-image-numbers input::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}
.chapter-image-configure{display:flex;width:100%;justify-content:flex-start}
body [data-image-interval-field] .chapter-image-heading input{appearance:none;width:38px;min-width:38px;height:22px;min-height:22px;border:1px solid #cbd0c5;border-radius:15px;background:#cbd0c5;position:relative;padding:0;margin:0;flex:none}
.chapter-image-heading input:before{content:'';position:absolute;left:2px;top:2px;width:16px;height:16px;border-radius:50%;background:#fffdf5;transition:transform .15s}
body [data-image-interval-field] .chapter-image-heading input:checked{background:var(--accent);border-color:var(--accent)}
.chapter-image-heading input:checked:before{transform:translateX(16px)}

/* 独立生图变量页沿用编辑页控件，图标与文字保持同排。 */
body[data-page=entry-advanced-page] .appearance-complex-body{padding-top:0;--appearance-prompt-lines:3;--appearance-prompt-tools:44px}
body[data-page=entry-advanced-page] .appearance-complex-body textarea{height:calc(3 * 1lh + 44px);min-height:0;resize:vertical}
body[data-page=entry-advanced-page] .appearance-file-picker{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:var(--ui-gap,8px);min-height:112px;padding:16px;box-sizing:border-box;border:1px dashed var(--line);border-radius:var(--ui-control-radius,5px);background:transparent}
body[data-page=entry-advanced-page] .appearance-file-picker>button{flex:none}
body[data-page=entry-advanced-page] .appearance-file-picker>[data-appearance-file-name]{min-width:0;text-align:center}
body[data-page=entry-advanced-page] .appearance-add-actions>.appearance-add{width:100%;height:var(--ui-button-height,28px);padding-block:0;border:1px dashed var(--add-button-line,var(--line));color:var(--add-button-ink,var(--accent));background:var(--add-button-bg,transparent)}
body[data-page=entry-advanced-page] .appearance-add-actions>.appearance-add{background:var(--add-button-bg,transparent)}
body[data-page=entry-advanced-page] .appearance-paste-body>.appearance-import{width:100%}

/* 删除与还原并排，沿用原确认与还原操作。 */
body[data-page=entry] #app .entry-edit-actions{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:var(--ui-gap,8px);margin-top:var(--ui-gap,8px)}
body[data-page=entry] #app .entry-edit-actions>button{width:100%;margin:0;min-width:0}


/* 人物还原收在头像下方，删除放标题右侧。 */
body[data-page=entry] #app .entry-avatar-picker{display:flex;flex-direction:column;align-items:stretch}
body[data-page=entry] #app .entry-avatar-restore{display:flex;align-items:center;justify-content:center;width:100%;height:24px;min-height:24px;margin:4px 0 0;padding:0;border:0;background:transparent;box-shadow:none;color:var(--muted)}
body[data-page=entry] #app .entry-avatar-restore svg{width:16px;height:16px}
body[data-page=entry] #app .top [data-action=entry-delete]{color:var(--muted);background:transparent;border:0;box-shadow:none}
.entry-advanced-label{display:inline-flex;align-items:center;gap:6px}
.entry-advanced-label svg{flex:none;width:16px;height:16px;color:var(--muted)}
body[data-page=entry] #app .person-setting-editor .entry-avatar-restore{width:72px;align-self:center}
body[data-page=entry] #app .person-setting-editor .entry-avatar-restore{background:color-mix(in srgb,var(--muted) 9%,transparent);border:1px solid color-mix(in srgb,var(--muted) 16%,transparent);border-radius:var(--ui-control-radius,5px);box-sizing:border-box}

/* 设定字段标题贴近下方输入框，字段组之间留出间隔。 */
body:is([data-page=entry],[data-page=entry-advanced-page],[data-page=world-set],[data-page=group]) #app .field:has(>label):not(.group-name-field),
body #setting-detail-dialog .field:has(>label),body #sheet .group-choice-scope .field:has(>label):not(.group-name-field){gap:1px;align-content:start;align-items:start;grid-template-rows:min-content min-content;margin-bottom:12px}
body:is([data-page=entry],[data-page=entry-advanced-page],[data-page=world-set],[data-page=group]) #app .field:not(.group-name-field)>label,
body #setting-detail-dialog .field>label,body #sheet .group-choice-scope .field:not(.group-name-field)>label{display:block;align-self:end;height:auto;min-height:0;margin:0;padding:0;line-height:16px}
body:is([data-page=entry],[data-page=entry-advanced-page],[data-page=world-set],[data-page=group]) #app .field:not(.group-name-field)>label:has(>input:not([type=checkbox]):not([type=radio]),>textarea,>select),body #sheet .group-choice-scope .field:not(.group-name-field)>label:has(>input:not([type=checkbox]):not([type=radio]),>textarea,>select){display:flex;flex-direction:column;gap:1px;align-items:stretch}
body[data-page=entry] #app .world-map-data>label{margin:0 0 1px;line-height:16px}

/* 输入和工具同行共用外框，各自占位，滚动文字不会穿过工具行。 */
body .text-tools-inside:is(.script-text-editor,.ui-text-editor){border:1px solid var(--line);border-radius:5px;background:var(--paper);overflow:hidden}
body .text-tools-inside:is(.script-text-editor,.ui-text-editor)>textarea{border:0!important;border-radius:0!important;box-shadow:none!important;margin:0!important;padding-bottom:8px!important;resize:vertical}
body .text-tools-inside:is(.script-text-editor,.ui-text-editor):focus-within{outline:1px solid var(--accent);outline-offset:0}
body .text-tools-inside:is(.script-text-editor,.ui-text-editor)>:is(.script-text-tools,.ui-text-tools){position:static!important;inset:auto!important;display:flex;align-items:center;justify-content:flex-start;gap:4px;box-sizing:border-box;width:100%;height:28px!important;min-height:28px!important;padding:1px 8px;margin:0;background:var(--paper);pointer-events:auto}
body .text-tools-inside>:is(.script-text-tools,.ui-text-tools)>output{order:3;margin-left:auto;padding:0 2px;background:none;font-size:10px;line-height:16px;font-weight:normal;font-style:normal;font-family:inherit;color:var(--muted)}
body .text-tools-inside>:is(.script-text-tools,.ui-text-tools)>button{flex:none;display:inline-flex;align-items:center;justify-content:center;width:24px!important;height:24px!important;min-height:24px!important;padding:3px!important;margin:0;border:0!important;border-radius:3px;background:transparent!important;box-shadow:none!important;color:var(--muted)}
body .text-tools-inside>:is(.script-text-tools,.ui-text-tools)>.text-macro-open{order:0}
body .text-tools-inside .text-macro-open svg{width:16px;height:16px;pointer-events:none}
body .text-tools-inside>textarea[hidden]~:is(.script-text-tools,.ui-text-tools){display:none!important}
.macro-panel{position:relative;width:min(420px,calc(100vw - 28px))!important;padding:16px!important}
.macro-panel .macro-close{position:absolute;right:8px;top:8px;min-height:24px;height:24px;width:24px;padding:0;border:0;background:none;font-size:20px}
.macro-tabs{display:flex;border-bottom:1px solid var(--line);margin-bottom:12px}
.macro-tabs>button{flex:1;border:0;border-radius:0;background:none;min-height:32px}
.macro-tabs>button[aria-selected=true]{color:var(--accent);border-bottom:2px solid var(--accent)}
.macro-panel-body{max-height:55dvh;overflow:auto;display:grid;gap:10px;padding-bottom:12px}
.macro-name-list{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:6px}
.macro-name-list>button{padding:4px;font-size:12px;min-height:32px}
.macro-indexed,.macro-candidate{display:flex;align-items:center;gap:6px}
.macro-indexed input{width:65px}.macro-indexed select{flex:1}.macro-indexed button{flex:none}
.macro-candidates{display:grid;gap:6px}
.macro-remove{flex:none;width:28px;padding:0!important}
.macro-field{display:grid;gap:2px;font-size:12px;color:var(--muted)}
.macro-dice-fields{display:grid;grid-template-columns:1fr 1fr 1.4fr;gap:8px}
.macro-panel .macro-formula{min-height:65px;height:65px;line-height:1.5;font-size:13px}
.macro-panel .macro-error{margin:0;font-size:12px;color:var(--danger,#a34b4b)}
.macro-error:empty{display:none}.macro-trial{font-size:13px;overflow-wrap:anywhere}
body .text-tools-inside>textarea:focus-visible{outline:none!important}
.macro-replacements{display:grid;gap:12px}.macro-replacement{display:flex;gap:6px;align-items:center}.macro-replacement-fields{display:grid;gap:4px;flex:1;min-width:0}.macro-replacement>input[type=checkbox]{width:16px;height:16px;flex:none}.macro-scope{font-size:11px;color:var(--muted)}
body .macro-panel .macro-tabs>button{min-width:0;white-space:nowrap;font-size:12px;padding:4px 2px;border:0;border-radius:0;background:none;box-shadow:none}
body .macro-panel .macro-tabs>button[aria-selected=true]{border-bottom:2px solid var(--accent)}
body .macro-panel .macro-close{border:0;background:none;box-shadow:none;min-height:24px;padding:0;width:24px;height:24px}
body dialog.script-fullscreen>.fullscreen-macro-tools{position:static!important;inset:auto!important;display:flex;justify-content:space-between;align-items:center;width:100%;box-sizing:border-box;pointer-events:auto!important;flex:none}
body .fullscreen-macro-tools>.text-macro-open{width:24px;height:24px;min-height:24px;padding:3px;border:0;box-shadow:none;background:none;color:var(--muted);order:-1}
body .fullscreen-macro-tools>.text-macro-open svg{width:16px;height:16px}

/* 阶段笔记沿用共用表单，避免字段、提示和保存区的间距叠加。 */
form[data-stage-editor]{gap:8px;align-content:start}
form[data-stage-editor]>.field,form[data-stage-editor]>.hint,form[data-stage-editor]>[data-stage-status],form[data-stage-editor]>.form-footer{margin:0}
form[data-stage-editor]>[data-stage-status]:empty{display:none}

/* 宏变量沿用项目米白、森绿和昼夜颜色，按导航、输入、试用、函数分组。 */
body dialog.macro-panel{--macro-soft:color-mix(in srgb,var(--soft) 35%,var(--paper));background:var(--paper);color:var(--ink);font-family:inherit}
body dialog.macro-panel>.macro-close,body dialog.macro-panel .macro-remove{background:transparent!important;border:0!important;border-radius:0;box-shadow:none!important;color:var(--muted)!important;min-width:24px;width:24px;height:28px;min-height:28px;padding:0!important;font-size:20px;line-height:1;font-weight:normal;font-style:normal;font-family:inherit}
body dialog.macro-panel .macro-remove:hover{color:var(--delete-ink,#a34b4b)!important}
body dialog.macro-panel>.macro-close{height:24px;min-height:24px;top:10px;right:10px}
body dialog.macro-panel .macro-tabs{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:3px;padding:4px;margin:0 0 14px;border:0;border-radius:8px;background:var(--macro-soft)}
body dialog.macro-panel .macro-tabs>button{height:30px;min-height:30px;margin:0;padding:3px 2px;border:0!important;border-radius:5px;background:transparent!important;color:var(--muted)!important;font-size:12px;box-shadow:none}
body dialog.macro-panel .macro-tabs>button[aria-selected=true]{background:var(--accent)!important;color:var(--paper)!important;box-shadow:0 1px 3px var(--shadow)}
body dialog.macro-panel .macro-candidates{gap:7px}
body dialog.macro-panel .macro-random-actions{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1.15fr);gap:8px;align-items:start}
body dialog.macro-panel .macro-test-group{display:grid;grid-template-columns:minmax(0,1fr);gap:6px;min-width:0}
body dialog.macro-panel .macro-add,body dialog.macro-panel .macro-test-button{width:100%;height:28px;min-height:28px;margin:0;padding:3px 6px;font-size:13px}
body dialog.macro-panel button.macro-add.ui-button{border:1px dashed var(--accent)!important;background:transparent!important;color:var(--accent)!important}
body dialog.macro-panel button.macro-test-button.ui-button{border:1px solid transparent!important;background:var(--macro-soft)!important;color:var(--accent)!important}
body dialog.macro-panel .macro-trial{display:block;min-width:0;margin:0;padding:4px 8px;border-radius:5px;background:var(--macro-soft);color:var(--ink);font-size:12px;line-height:1.5;overflow-wrap:anywhere}
body dialog.macro-panel .macro-dice-test{grid-template-columns:minmax(0,1fr) minmax(0,1.15fr);align-items:start;gap:8px}
body dialog.macro-panel .macro-dice-test .macro-trial{min-height:28px}
body dialog.macro-panel .macro-function-section{gap:5px;margin-top:5px;padding-top:12px;border-top:1px solid var(--line)}
body dialog.macro-panel .macro-formula{height:54px;min-height:54px;resize:none;background:var(--macro-soft);border:1px solid transparent;box-shadow:none;font-size:13px;line-height:1.65;font-weight:normal;font-style:normal;font-family:inherit;padding:7px 9px}
body dialog.macro-panel .macro-random-actions{grid-template-columns:minmax(0,1fr) minmax(0,2fr)}
body dialog.macro-panel .macro-random-actions .macro-test-group{grid-template-columns:minmax(0,1fr) minmax(0,1.1fr);align-items:start}
body dialog.macro-panel .macro-random-actions .macro-trial{min-height:28px}

/* 阶段笔记边距与规范对齐，宽度与外层完全匹配 */
.story-outline-content[data-outline-panel=stage]:not([hidden]) {
  padding: 2px 16px 8px !important;
  display: flex !important;
  flex-direction: column !important;
}
form[data-stage-editor] {
  gap: 8px;
  align-content: start;
  width: 100% !important;
  display: flex !important;
  flex-direction: column !important;
}
form[data-stage-editor] > .field {
  display: flex !important;
  flex-direction: column !important;
  gap: 2px !important;
  align-items: stretch !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  width: 100% !important;
  font-size: 13px !important;
  font-weight: 400 !important;
  line-height: 16px !important;
  color: var(--muted) !important;
}
form[data-stage-editor] > .field::before {
  display: none !important;
}
form[data-stage-editor] > .field > .ui-text-editor {
  width: 100% !important;
}
body form[data-stage-editor] > .field textarea {
  margin: 0 !important;
  border: 0 !important;
  background: transparent !important;
  border-radius: 0 !important;
  padding: 8px 10px 2px !important;
  font-size: 16px !important;
  font-weight: 400 !important;
  line-height: 1.4 !important;
  color: var(--ink) !important;
  width: 100% !important;
  box-sizing: border-box !important;
  box-shadow: none !important;
}
@media (min-width: 761px) {
  body form[data-stage-editor] > .field textarea {
    font-size: 13px !important;
  }
}
body form[data-stage-editor] .text-tools-inside > :is(.ui-text-tools, .script-text-tools) {
  height: 20px !important;
  min-height: 20px !important;
  padding: 0 6px !important;
  border: 0 !important;
  box-shadow: none !important;
  background: transparent !important;
}
body form[data-stage-editor] .text-tools-inside > :is(.ui-text-tools, .script-text-tools) > button {
  width: 20px !important;
  height: 18px !important;
  min-height: 18px !important;
  padding: 0 !important;
}
body[data-night=true] form[data-stage-editor] > .field textarea {
  background: var(--paper) !important;
  border-color: var(--line) !important;
}
body form[data-stage-editor]>.form-footer{position:static;margin:0;padding:0}
body form[data-stage-editor]>.form-footer::after{display:none}
.story-outline-content[data-outline-panel=stage]{padding-top:2px}

/* 只有两种人物类型，直接在原弹窗内切换，不另开选择页。 */
body dialog.macro-panel .macro-person-kind{display:flex;flex:1;min-width:0;gap:3px;margin:0;padding:3px;border:0;border-radius:5px;background:var(--macro-soft)}
body dialog.macro-panel .macro-person-kind>button{flex:1;min-width:0;margin:0;padding:3px 5px;min-height:26px;border:0;background:transparent;box-shadow:none;color:var(--muted);font-size:13px}
body dialog.macro-panel .macro-person-kind>button[aria-pressed=true]{border-radius:4px;background:var(--accent);color:var(--paper)}
/* 电脑单独放大，手机仍沿用已确认的窗口和控件尺寸。 */
@media(min-width:761px){
 body dialog.macro-panel{width:min(600px,calc(100vw - 64px))!important;padding:24px!important}
 body dialog.macro-panel>h2{font-size:18px!important;margin-bottom:16px}
 body dialog.macro-panel .macro-tabs{margin-bottom:16px}
 body dialog.macro-panel .macro-tabs>button{height:36px;min-height:36px;font-size:14px}
 body dialog.macro-panel .macro-panel-body{gap:12px}
 body dialog.macro-panel .macro-name-list{gap:8px}
 body dialog.macro-panel .macro-name-list>button{font-size:14px;min-height:36px}
 body dialog.macro-panel .ui-input{height:38px;min-height:38px;font-size:14px}
 body dialog.macro-panel .macro-field{font-size:13px}
 body dialog.macro-panel .macro-person-kind>button{font-size:14px;min-height:32px}
 body dialog.macro-panel .macro-indexed>button,body dialog.macro-panel .ui-confirm-actions>button{height:36px;min-height:36px;font-size:14px}
 body dialog.macro-panel .macro-add,body dialog.macro-panel .macro-test-button{height:34px;min-height:34px;font-size:14px}
 body dialog.macro-panel .macro-trial{min-height:34px;font-size:14px;line-height:24px;padding-block:5px}
 body dialog.macro-panel .macro-formula{height:70px;min-height:70px;font-size:14px;padding:10px 12px}
}
/* 底部操作贴近内容，移除共用确认窗在此处叠加的空白。 */
body dialog.macro-panel>.ui-confirm-actions{margin:8px 0 0!important}
body dialog.macro-panel .macro-panel-body{padding-bottom:0}
body dialog.macro-panel .macro-load-status,body dialog.macro-panel .macro-legacy p{margin:0;font-size:12px;line-height:1.6}
body dialog.macro-panel .macro-legacy{font-size:12px;color:var(--muted)}
body dialog.macro-panel .macro-person-row{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:6px;align-items:stretch}
body dialog.macro-panel .macro-person-row .macro-person-kind{height:34px;padding:3px;box-sizing:border-box}
body dialog.macro-panel .macro-person-row .macro-person-kind>button{height:28px;min-height:28px;padding:0 5px}
body dialog.macro-panel .macro-person-number{display:flex;align-items:center;gap:6px;min-width:0;font-size:12px;color:var(--muted)}
body dialog.macro-panel .macro-person-number>input{flex:1;min-width:0;width:0;height:34px;min-height:34px;box-sizing:border-box}
body dialog.macro-panel .macro-person-row+select{width:100%;height:34px;min-height:34px;box-sizing:border-box}
body dialog.macro-panel .macro-function-section{border:0;padding-top:0;margin-top:0;gap:2px}
@media(min-width:768px){body dialog.macro-panel .macro-person-row .macro-person-kind,body dialog.macro-panel .macro-person-number>input,body dialog.macro-panel .macro-person-row+select{height:38px;min-height:38px}body dialog.macro-panel .macro-person-row .macro-person-kind>button{height:32px;min-height:32px}}

/* 还原与已有顶部操作同行，保留页面返回及弹窗关闭。 */
body .ui-static-restore-head{position:relative}
body .ui-restore-actions{position:absolute;right:12px;top:50%;transform:translateY(-50%);display:flex;align-items:center;gap:4px;z-index:2}
body .ui-restore-actions>button.ui-top-restore{position:static!important;transform:none!important;display:inline-flex!important;align-items:center;justify-content:center;width:32px!important;min-width:32px!important;max-width:32px!important;height:32px!important;min-height:32px!important;margin:0!important;padding:6px!important;border:0!important;border-radius:0!important;background:transparent!important;color:var(--muted)!important;box-shadow:none!important;flex:none!important}
body .ui-restore-actions>button.ui-top-restore svg{width:18px;height:18px;pointer-events:none}
body .ui-restore-actions>button:not(.ui-top-restore){position:static!important;transform:none!important;margin:0!important;flex:none}
body [data-restore-empty]{display:none!important}
body .ui-restore-dialog-head{min-height:36px;padding:0 44px;display:flex;align-items:center;justify-content:center;margin-bottom:12px}
body .ui-restore-dialog-head>h2{margin:0;font-size:16px;line-height:24px;font-weight:500;text-align:center}
body .ui-restore-dialog-head .ui-restore-actions{right:0}
body #app>.script-top.ui-has-restore{grid-template-columns:72px minmax(0,1fr) 72px}

/* Background entry: the nested disclosure already supplies its bottom divider. */
body[data-page=entry] form[data-form=entry][data-entry-kind=background] > .entry-advanced.ui-disclosure{border-bottom:0}

/* 领取提示沿共用确认小窗，只给本次奖励和用途安排内容。 */
.peach-welcome .peach-welcome-gift{margin:0 0 14px;padding:10px 12px 11px;border:1px solid color-mix(in srgb,var(--ui-confirm-line) 65%,#d88c9e);border-radius:8px;text-align:center;background:radial-gradient(ellipse at 50% 0%,color-mix(in srgb,var(--ui-confirm-paper) 64%,#edb5c1),color-mix(in srgb,var(--ui-confirm-paper) 91%,#eaa4ad) 76%);color:var(--ui-confirm-ink)}
.peach-welcome-gift>span,.peach-welcome-gift>small{display:block;font-size:12px;line-height:18px}
.peach-welcome-gift>strong{display:block;color:#a33856;font-size:25px;font-weight:650;line-height:32px;font-variant-numeric:tabular-nums}
body[data-night=true] .peach-welcome-gift>strong{color:#ffc1d1}
.peach-welcome-gift>.peach-welcome-emblem{position:relative;display:grid;place-items:center;width:112px;height:48px;margin:0 auto 2px}
.peach-welcome-emblem img{width:42px;height:42px;object-fit:contain;filter:hue-rotate(-105deg) drop-shadow(0 3px 5px #9e546959)}
.peach-welcome-emblem[data-currency="longterm"] img,.peach-welcome-emblem[data-currency="green"] img{filter:drop-shadow(0 3px 5px #59674a55)}
.peach-welcome .peach-gift-message{margin:0;font-size:14px;line-height:1.5;white-space:pre-wrap;overflow-wrap:anywhere}
.peach-welcome-emblem::before,.peach-welcome-emblem::after{content:'✦';position:absolute;color:color-mix(in srgb,var(--ui-confirm-ink) 55%,#cc8298);line-height:1}
.peach-welcome-emblem::before{left:17px;top:14px;font-size:12px}
.peach-welcome-emblem::after{right:15px;top:7px;font-size:17px}
@media(prefers-reduced-motion:no-preference){.peach-welcome-emblem img{animation:peach-welcome-arrive .3s ease-out both}@keyframes peach-welcome-arrive{from{opacity:.5;transform:translateY(4px) scale(.82)}to{opacity:1;transform:none}}}
.peach-welcome .peach-welcome-list{display:grid;gap:8px;list-style:none;margin:0;padding:0}
.peach-welcome-list>li{display:grid;grid-template-columns:28px minmax(0,1fr) max-content;align-items:center;gap:8px;line-height:19px}
.peach-welcome-list .peach-welcome-icon{display:grid;place-items:center;width:28px;height:28px;border-radius:50%;background:color-mix(in srgb,var(--ui-confirm-paper) 83%,var(--peach-welcome-tint))}
.peach-welcome-list img{width:18px;height:18px;object-fit:contain}
.peach-welcome-list .peach-welcome-pink img{filter:hue-rotate(-105deg)}
.peach-welcome-list .peach-welcome-ordinary{--peach-welcome-tint:#e6be72}
.peach-welcome-list .peach-welcome-pink{--peach-welcome-tint:#eaa4ad}
.peach-welcome-list .peach-welcome-green{--peach-welcome-tint:#a2bb8a}
.peach-welcome-list .peach-welcome-label{display:block;font-size:14px;font-weight:600;line-height:19px}
.peach-welcome-list .peach-welcome-purpose{display:block;font-size:13px;color:var(--ui-confirm-ink);opacity:.78}
.peach-welcome-list .peach-welcome-amount{font-size:13px;font-weight:600;font-variant-numeric:tabular-nums}
body dialog.peach-welcome .peach-welcome-feedback{margin:8px 0 0;font-size:13px;line-height:19px}

@media (prefers-reduced-motion:no-preference){button:not(:disabled):not([aria-disabled="true"]):active,[role="button"]:not([aria-disabled="true"]):active{scale:.97}}

.role-opening-panel>.sheet-head{position:relative;z-index:2}

/* 阶段笔记仅在操作当前填写框时显示框内工具，仍保留工具占位。 */
form[data-stage-editor] .ui-text-tools{visibility:hidden;pointer-events:none}
form[data-stage-editor] .ui-text-editor:focus-within .ui-text-tools{visibility:visible;pointer-events:auto}
body form[data-stage-editor]>.field textarea{min-height:76px!important;max-height:none;overflow-y:hidden;resize:none;line-height:1.4!important}

/* 剧目重生图片沿用原画风选择列表，只标记当前默认项。 */
.story-image-style-label{display:inline;overflow-wrap:anywhere;font-weight:400}
.story-image-style-label .story-image-style-current{display:inline;font-size:11px;color:var(--muted);font-weight:400;margin-left:4px;line-height:1.4}
