/* Scoped to the five v4.4 additions. Existing PC and rc18 detail controls retain their rules. */
body.h5-ui #template-results>[data-count].catalog-result-count{display:block;font-size:11px;margin:8px 0 0}
.template-library-entry{display:block;margin:0 0 8px auto;padding:0;background:none;border:0;color:#0A7AFF;font-size:12px;min-height:28px}
body.h5-ui[data-page=editor] main{padding-top:0}
.editor-signals{margin:0 -12px 10px}
.extraction-signal{height:40px;display:flex;align-items:center;gap:8px;padding:0 12px;font-size:13px;background:#FFF7E8;color:#B25E00;border-bottom:1px solid #FFE1B3}
.extraction-signal>i{width:8px;height:8px;border-radius:50%;background:#FF8F1F;flex:none}
.signal-text{flex:1;font-weight:500}.signal-count{font-size:12px;white-space:nowrap}
.extraction-engine{height:28px;display:flex;align-items:center;justify-content:space-between;gap:8px;padding:0 12px;font-size:12px;background:#FBFBFB;border-bottom:1px solid #ECECEC;color:#8A8A8A}
.extraction-engine>span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.extraction-engine>b{font-weight:600;flex:none;color:#B25E00}
.extraction-progress{height:3px;background:#FFE1B3}.extraction-progress>i{display:block;width:62%;height:100%;background:#FF8F1F;animation:extraction-grow 8s ease-out infinite}
@keyframes extraction-grow{from{width:8%}to{width:96%}}
.editor-signals[data-state=success] .extraction-signal{background:#E8F8EF;color:#07A353;border-color:#C6EED7}
.editor-signals[data-state=success] .extraction-signal>i{background:#07C160}
.editor-signals[data-state=success] .extraction-engine>b{color:#07A353}
.editor-signals[data-state=failure] .extraction-signal{background:#FFECEC;color:#E64340;border-color:#FFC9C9}
.editor-signals[data-state=failure] .extraction-signal>i{background:#FA5151}
.editor-signals[data-state=failure] .extraction-engine>b{color:#E64340}
.editor-signals[data-state=empty] .extraction-signal{background:#F5F5F5;color:#8A8A8A;border-color:#ECECEC}
.editor-signals[data-state=empty] .extraction-signal>i{background:#B2B2B2}
.editor-signals:not([data-state=pending]) .extraction-progress{display:none}
.extraction-lock{margin:10px 0 0;padding:8px 10px;border-radius:4px;background:#F5F5F5;color:#8A8A8A;font-size:12px}
.extraction-failure{margin-top:8px;background:white;border:1px solid #FFC9C9;border-radius:8px;padding:10px 12px}
.extraction-failure>strong{font-size:14px;font-weight:600;color:#E64340}.extraction-failure>p{font-size:12px;color:#8A8A8A;margin-top:4px;line-height:1.6}
#force-cloud-extraction{height:44px;min-height:44px;border-radius:8px;background:#FF8F1F;color:white;font-size:16px;font-weight:600;margin-top:10px;border:0;width:100%}
main[data-extraction=pending] #slot-cards,main[data-extraction=failure] #slot-cards,main[data-extraction=pending]>.panel:has(#quality-mode),main[data-extraction=failure]>.panel:has(#quality-mode){opacity:.45;pointer-events:none}
main[data-extraction=empty] #slot-cards,main[data-extraction=empty]>.panel:has(#quality-mode){opacity:.45;pointer-events:none}
main[data-extraction=failure] #slot-board{filter:grayscale(.9) opacity(.45)}
main[data-extraction=pending] .panel:has(#slot-board){position:relative}
main[data-extraction=pending] .panel:has(#slot-board):after{content:'正在识别字坑 / 图坑…';position:absolute;left:8px;right:8px;top:8px;height:180px;background:rgba(11,31,58,.42);display:flex;align-items:center;justify-content:center;color:white;font-size:14px;font-weight:600;border-radius:6px}
body.h5-ui[data-page=editor] #slot-board{height:180px}
body.h5-ui[data-page=editor] .source-preview-bar #original-view{min-height:24px}
.generation-engines{display:flex;gap:6px;flex-wrap:wrap;margin-top:10px}.generation-engines>span{font-size:11px;padding:2px 8px;border-radius:4px;background:#EEF4FF;color:#0A7AFF;overflow-wrap:anywhere}
.generation-engines [data-engine-status]{background:#E8F8EF;color:#07A353}.generation-engines [data-engine-status=bad]{background:#FFECEC;color:#E64340}
.slot-picker-mask{position:fixed;inset:0;background:rgba(0,0,0,.45);z-index:120;display:flex;align-items:flex-end}
.slot-picker-sheet{width:min(100%,430px);margin:0 auto;background:white;border-radius:16px 16px 0 0;padding:14px 12px max(16px,env(safe-area-inset-bottom));max-height:78dvh;overflow-y:auto;color:#111}
.sheet-grab{width:36px;height:4px;background:#E2E2E2;border-radius:2px;margin:0 auto 12px}
.slot-picker-sheet h3{text-align:center;font-size:16px;font-weight:600;margin:0}.sheet-sub{text-align:center;font-size:12px;color:#8A8A8A;margin-top:4px}
.picker-tabs{display:flex;background:#F5F5F5;border-radius:4px;padding:3px;gap:3px;margin-top:12px}
.picker-tabs button{flex:1;text-align:center;padding:7px 0;font-size:14px;border:0;border-radius:3px;color:#8A8A8A;background:none;min-height:34px}
.picker-tabs [aria-pressed=true]{background:white;color:#0A7AFF;font-weight:600;box-shadow:0 1px 3px rgba(0,0,0,.08)}
#picker-query{margin-top:10px;height:36px;min-height:36px;border-radius:8px;padding:8px 12px;background:#F7F7F7;border:1px solid #ECECEC;font-size:16px;width:100%}
.picker-goods{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px;margin-top:10px;max-height:184px;overflow:auto}
.picker-goods button{background:#F7F7F7;border:2px solid transparent;border-radius:4px;padding:8px;text-align:center;min-width:0}
.picker-goods button[aria-pressed=true]{border-color:#0A7AFF;background:#EEF4FF}
.picker-goods img{height:64px;width:100%;object-fit:contain;border-radius:4px}.picker-goods span{display:block;font-size:11px;color:#111;margin-top:6px;font-weight:500;overflow-wrap:anywhere}
.picker-fit{display:inline-block;margin-top:4px;font-size:9px;color:#0A7AFF;background:#EEF4FF;padding:1px 4px;border-radius:3px}
.picker-hint{margin-top:12px;padding:8px 10px;background:#EEF4FF;border-radius:4px;font-size:12px;color:#0A7AFF}
.picker-actions{display:flex;gap:10px;margin-top:12px}.picker-actions button{flex:1;height:42px;min-height:42px;font-size:15px;border-radius:8px;padding:0}
.picker-actions .secondary{background:white;border:1px solid #ECECEC;color:#111}.picker-actions .primary{background:#0A7AFF;color:white;border:0}
.picker-status{font-size:12px;color:#E64340;margin:6px 0 0}.picker-status:empty{display:none}
.picker-upload-actions{display:flex;gap:12px;margin-top:16px}.picker-upload-actions label{position:relative;flex:1;padding:20px 8px;background:#EEF4FF;border:1px solid #D7E8FF;border-radius:8px;text-align:center;color:#0A7AFF;font-size:14px}
.picker-upload-actions input{position:absolute;inset:0;opacity:0;width:100%;height:100%;cursor:pointer}#adhoc-preview img{display:block;max-height:140px;max-width:100%;object-fit:contain;margin:12px auto 0}#adhoc-preview p{text-align:center;font-size:12px;color:#0A7AFF}
#picker-more{display:block;margin:4px auto;min-height:26px;background:none;border:0;color:#0A7AFF;font-size:11px}
body.h5-ui[data-page=library] main{padding-top:6px}body.h5-ui[data-page=library] .top h1{font-size:17px}
.library-sticky{position:sticky;top:44px;z-index:25;background:#F7F7F7;padding-bottom:6px}
.library-search{display:flex;align-items:center;gap:6px;padding:0 12px;border-radius:8px;background:white;border:1px solid #ECECEC;height:36px}
.library-search input{width:100%;padding:0;border:0;background:none;min-height:34px;font-size:16px}.library-search>span{color:#8A8A8A;font-size:24px}
.library-filters{display:flex;flex-direction:column;gap:6px;margin-top:8px}.library-filter-row{display:flex;gap:6px;overflow-x:auto;scrollbar-width:none;-webkit-overflow-scrolling:touch}
.library-chip{flex:none;display:inline-flex;align-items:center;gap:3px;padding:5px 10px;border-radius:14px;background:white;border:1px solid #ECECEC;font-size:12px;color:#111;min-height:28px;line-height:18px}
.library-chip small{font-size:10px;color:#8A8A8A}.library-chip[aria-pressed=true]{background:#0A7AFF;border-color:#0A7AFF;color:white}.library-chip[aria-pressed=true] small{color:rgba(255,255,255,.85)}
.library-result{margin-top:4px;display:flex;align-items:center;justify-content:space-between;gap:6px;font-size:12px;color:#8A8A8A}#library-total{color:#0A7AFF;font-weight:600;flex:none}
#library-sort{display:block;margin:4px 0 0 auto;padding:0 4px;font-size:11px;min-height:24px;height:24px;width:auto;border:0;background:transparent;color:#8A8A8A}
.library-grid{display:grid;grid-template-columns:1fr 1fr;gap:8px;margin-top:2px}
.library-template{background:white;border-radius:8px;box-shadow:var(--shadow-card);overflow:hidden;border:0;padding:0;text-align:left;align-self:start;min-width:0}
.library-thumb{height:150px;position:relative;overflow:hidden}.library-thumb img{width:100%;height:150px;object-fit:cover;display:block}
.library-card-tag{position:absolute;left:6px;top:6px;font-size:9px;background:rgba(0,0,0,.5);color:white;padding:1px 6px;border-radius:3px;max-width:90%;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}
.library-thumb>small{position:absolute;right:6px;bottom:6px;font-size:9px;color:rgba(255,255,255,.85);background:rgba(0,0,0,.45);padding:1px 6px;border-radius:3px}
.library-name{padding:6px 8px;font-size:12px;color:#111;font-weight:500;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.library-meta{padding:0 8px 7px;font-size:10px;color:#8A8A8A;display:flex;gap:4px;flex-wrap:wrap}.library-meta b{color:#0A7AFF;font-weight:500}
#library-state,#library-more{font-size:12px;color:#8A8A8A;text-align:center;padding:10px 0;background:none;border:0;width:100%;margin:0}.library-empty{grid-column:1/-1;text-align:center;color:#8A8A8A;padding:48px 0}
.library-grid.library-recent-row{display:flex;overflow-x:auto;scroll-snap-type:x mandatory}.library-recent-row .library-template{min-width:172px;max-width:172px;scroll-snap-align:start}
.library-preview{position:fixed;inset:0;z-index:120;background:#101012;color:white;display:grid;grid-template-rows:56px minmax(0,1fr) auto}.library-preview header{display:flex;align-items:center;justify-content:space-between;padding:0 12px}.library-preview header button{background:none;color:white;border:0;min-height:44px}.library-preview .material-detail-image{display:flex;align-items:center;justify-content:center;min-height:0}.library-preview img{max-width:100%;max-height:100%;object-fit:contain}.library-preview footer{padding:12px;text-align:center}
[hidden]{display:none!important}

body.h5-ui[data-page=library] #nav{display:none}body.h5-ui[data-page=library] main{padding-bottom:12px}

.extraction-placeholder label{display:block;color:#8A8A8A;font-size:12px;margin:6px 0 4px}.extraction-placeholder input:not([type=range]){height:34px;min-height:34px;border:1px solid #ECECEC;border-radius:4px;padding:0 10px;font-size:16px;width:100%;background:#FBFBFB}.placeholder-colors{display:flex;gap:8px}.placeholder-colors i{width:24px;height:24px;border:1px solid #ECECEC;border-radius:50%;background:#fff}.placeholder-colors i:nth-child(2){background:#111}.placeholder-colors i:nth-child(3){background:#0A7AFF}.placeholder-colors i:nth-child(4){background:#E8571F}.placeholder-colors i:nth-child(5){background:#07C160}.placeholder-goods{display:flex;gap:8px;margin-top:6px}.placeholder-goods i{width:56px;height:42px;background:#EEE;border-radius:6px}

body.h5-ui[data-page=editor] #slot-board{width:auto;max-width:100%;margin:0 auto;display:block}
body.h5-ui[data-page=editor] .additional-copy>summary,body.h5-ui[data-page=editor] .slot-more>summary{min-height:0;line-height:18px}
.picker-goods span{display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;line-height:15px;max-height:30px}

/* Updated delivery source: extraction is card 1 below the poster. */
body.h5-ui[data-page=editor] .editor-signals{margin:8px 0;padding:9px 12px;border-radius:8px;background:#fff;box-shadow:var(--shadow-card)}
.editor-signals h3{display:flex;align-items:center;font-size:15px;font-weight:600;margin:0!important}
.editor-signals .extraction-signal{height:auto;min-height:18px;margin-top:8px;padding:0;gap:6px;font-size:12px;border:0;background:none!important}
.editor-signals .signal-text{font-weight:600}.editor-signals .signal-count{font-weight:400;font-size:11px;color:#8A8A8A}
.editor-signals .extraction-engine{height:auto;min-height:28px;margin-top:8px;padding:6px 8px;border:1px solid #ECECEC;border-radius:4px;font-size:11px}
.editor-signals .extraction-progress{margin-top:6px;border-radius:2px;overflow:hidden}
.extraction-actions{display:flex;gap:8px;margin-top:8px}
body.h5-ui .extraction-actions :is(button.primary,button.secondary,#force-cloud-extraction){flex:1;height:34px;min-height:34px;margin:0;padding:0;border-radius:8px;font-size:13px;font-weight:400;width:auto}
body.h5-ui .extraction-actions .secondary{background:#fff;border:1px solid #ECECEC;color:#111}
body.h5-ui .extraction-actions .primary{background:#0A7AFF;color:#fff;border:0}
.editor-signals .extraction-failure{border:0;padding:0;margin-top:8px}.editor-signals .extraction-failure>strong{display:none}.editor-signals .extraction-failure>p{margin:0;font-size:12px}
main[data-extraction]:not([data-extraction=success]) #slot-cards>section{opacity:.45;pointer-events:none}
.library-tabs{display:flex;background:#fff;border-bottom:1px solid #ECECEC;margin:4px -12px 6px}
.library-tabs button{flex:1;text-align:center;padding:10px 0;font-size:15px;color:#8A8A8A;position:relative;background:none;border:0;border-radius:0;min-height:40px}
.library-tabs [aria-pressed=true]{color:#0A7AFF;font-weight:600}.library-tabs [aria-pressed=true]:after{content:'';position:absolute;left:50%;transform:translateX(-50%);bottom:0;width:44px;height:3px;background:#0A7AFF;border-radius:2px}
.library-tabs small{font-size:10px;color:#8A8A8A;margin-left:2px;font-weight:400}
.library-product .library-thumb img{object-fit:contain}.library-product .library-name{font-size:11px}
.library-preview .material-detail-image,#owner-material-detail:has([data-hd-state]) .material-detail-image{overflow:hidden;touch-action:none}
.library-preview .material-detail-image img,#owner-material-detail:has([data-hd-state]) .material-detail-image img{will-change:transform}
.library-preview .hint,#owner-material-detail [data-hd-state]{font-size:11px;color:#8A8A8A}
body.h5-ui:is([data-page=create],[data-page=editor],[data-page=library],[data-page=generation]){color-scheme:light;--bg:#F7F7F7;--card:#fff;--ink:#111;--ink2:#8A8A8A;--mut:#8A8A8A;--muted:#8A8A8A;--line:#ECECEC;--hair:#ECECEC;background:#F7F7F7;color:#111}
body.h5-ui:is([data-page=create],[data-page=editor],[data-page=library],[data-page=generation]) .top{background:#fff;color:#111}
/* Keep the delivery colours visible when the OS uses a dark appearance. */
body.h5-ui[data-page=library] #library-query::placeholder,body.h5-ui .slot-picker-sheet #picker-query::placeholder{color:#8A8A8A;opacity:1}
body.h5-ui[data-page=editor] #editor-submit{background:#0A7AFF}
body.h5-ui .slot-picker-sheet .picker-actions button{height:42px;min-height:42px;padding:0;border-radius:8px;font-size:15px}
body.h5-ui .slot-picker-sheet .picker-actions .primary{background:#0A7AFF;color:#fff;border:0}
body.h5-ui .slot-picker-sheet .picker-actions .secondary{background:#fff;color:#111;border:1px solid #ECECEC}
