.library-overlay{z-index:2147483600;-webkit-backdrop-filter:blur(7px);backdrop-filter:blur(7px);color:var(--ui-text);font:13px/1.5 var(--ui-font-family);background:#0000009e;justify-content:center;align-items:center;padding:12px;display:flex;position:fixed;inset:0}.library-overlay:has(>.library-confirm){z-index:2147483645}.library-dialog{border:1px solid var(--ui-border);border-radius:var(--ui-radius-menu);background:var(--ui-surface-menu);width:100%;max-width:1200px;height:100%;box-shadow:var(--ui-menu-shadow);isolation:isolate;outline:none;flex-direction:column;display:flex;overflow:hidden}.library-dialog:is(.history-dialog,.character-library-dialog){border-radius:var(--ui-radius-menu);width:min(1200px,100vw - 80px);height:min(760px,100dvh - 96px)}.library-dialog *{box-sizing:border-box}.library-dialog:where(:not(.trusted-portrait-dialog)) button{border-radius:var(--ui-radius-control);min-height:32px;color:inherit;font:inherit;cursor:pointer;background:0 0;border:1px solid #0000;flex-shrink:0;justify-content:center;align-items:center;gap:8px;padding:6px 12px;display:inline-flex}.library-dialog:where(:not(.trusted-portrait-dialog)) button:hover:not(:disabled){background:var(--ui-hover)}.library-dialog:where(:not(.trusted-portrait-dialog)) button:disabled{opacity:.38;cursor:not-allowed}.library-dialog:where(:not(.trusted-portrait-dialog)) button.primary{color:#171717;background:#f7f7f7;min-height:40px}.library-dialog:where(:not(.trusted-portrait-dialog)) button.danger{color:#ef694e;background:#a53b2726}.library-dialog:where(:not(.trusted-portrait-dialog)) button.danger-primary{color:#fff;background:#ed2a3c}.library-heading{border-bottom:1px solid var(--ui-border);flex-shrink:0;align-items:center;gap:20px;min-height:64px;padding:16px 24px;display:flex}.library-heading h2{font-size:var(--ui-font-heading);flex:1;margin:0;font-weight:550}.library-close{width:32px;height:32px;color:var(--ui-muted)!important;padding:0!important}.library-close>svg{stroke-width:1.8px;width:20px;height:20px;display:block}.history-density{background:var(--ui-surface-panel);border-radius:10px;align-items:center;gap:12px;padding:8px 12px;display:flex}.history-density svg:first-child{width:14px;height:14px}.history-density input{width:112px}.history-body{flex:1;min-width:0;min-height:0;display:flex;position:relative}.history-main{flex-direction:column;flex:1;min-width:0;display:flex}.history-toolbar{flex-wrap:wrap;flex-shrink:0;align-items:center;gap:12px;padding:14px 24px 4px;display:flex}.history-scope{background:var(--ui-surface-panel);border-radius:14px;padding:3px;display:flex}.history-scope button{color:#999;padding:6px 12px}.history-types{border-left:1px solid var(--ui-border);align-items:center;gap:4px;padding-left:10px;display:flex}.history-types button{color:#909090;padding:7px}.history-types small{font:inherit;background:#373737;border-radius:4px;min-width:17px;font-size:11px;line-height:18px}.history-tools{gap:4px;margin-left:auto;display:flex}.history-tools button{padding:6px 9px;font-size:13px}.history-tools button[aria-pressed=true]{background:var(--ui-selected)}.history-scroll{overscroll-behavior:contain;flex:1;min-height:0;padding:14px 24px 28px;overflow:auto}.history-date h3{align-items:center;gap:8px;margin:4px 0 16px;font-size:15px;font-weight:500;display:flex}.history-date+.history-date{margin-top:30px}.history-grid{grid-template-columns:repeat(auto-fill,minmax(0,min(var(--history-thumbnail),100%)));align-items:start;gap:14px;display:grid}.history-grid article{aspect-ratio:1;background:var(--ui-surface-input);border:1px solid #0000;border-radius:12px;width:100%;position:relative;overflow:hidden}.history-grid article.selected{background:var(--ui-selected)}.library-dialog :has(>.history-select:checked){background:var(--ui-selected)}.history-grid .history-preview{text-align:center;border:0;border-radius:10px;width:100%;height:100%;padding:0;display:block;overflow:hidden}.history-preview img{object-fit:cover;width:100%;height:100%}.history-placeholder{color:#aaa;flex-direction:column;justify-content:center;align-items:center;gap:16px;height:100%;padding:15px;display:flex}.history-placeholder svg{width:36px;height:36px}.history-placeholder>span{-webkit-line-clamp:3;-webkit-box-orient:vertical;font-size:12px;display:-webkit-box;overflow:hidden}.history-badge{color:#ccc;pointer-events:none;background:#141414aa;border:1px solid #6668;border-radius:4px;padding:0 4px;font-size:10px;line-height:17px;position:absolute;top:8px;left:8px}.history-badge.rated{color:#ffb746}.library-dialog .history-select{z-index:2;accent-color:#fff;opacity:0;cursor:pointer;width:19px;height:19px;min-height:19px;margin:0;padding:0;position:absolute;top:9px;right:9px}.history-select[data-batch=true],.history-select:focus-visible,.library-dialog :hover>.history-select,.library-dialog :focus-within>.history-select{opacity:1}.history-date input{accent-color:#fff;width:18px;height:18px}.history-hover-actions{opacity:0;pointer-events:none;justify-content:center;gap:4px;display:flex;position:absolute;bottom:7px;left:7px;right:7px}.history-grid article:hover .history-hover-actions,.history-grid article:focus-within .history-hover-actions{opacity:1;pointer-events:auto}.history-hover-actions button{background:#090909b0;flex:1;min-width:32px;min-height:32px;padding:7px}.history-hover-actions button:last-child{color:#ef694e}.history-empty{text-align:center;color:#909090;margin:60px 0;font-size:14px}.history-detail{border-left:1px solid var(--ui-border);flex-direction:column;flex-shrink:0;width:280px;min-height:0;padding:14px 18px 18px;display:flex}.history-detail>header{justify-content:space-between;align-items:center;min-height:42px;margin-bottom:10px;display:flex}.history-detail h3{margin:0;font-size:15px;font-weight:500}.history-detail-scroll{overscroll-behavior:contain;flex:1;min-height:0;overflow:auto}.history-detail-image,.history-detail video{object-fit:contain;background:var(--ui-surface-input);border-radius:12px;width:100%;max-height:220px;display:block}.history-detail .history-detail-image{cursor:zoom-in;padding:0}.history-detail-image img{object-fit:cover;border-radius:12px;width:100%;height:220px;display:block}.history-detail audio{width:100%}.history-audio,.history-document{background:var(--ui-surface-panel);border-radius:12px;flex-direction:column;align-items:center;gap:20px;padding:32px 0;display:flex}.history-audio>svg,.history-document>svg{width:56px;height:56px}.history-detail dl{flex-direction:column;gap:12px;margin:16px 0;display:flex}.history-detail dl>div{align-items:baseline;gap:12px;font-size:13px;display:flex}.history-detail dt{color:#999;min-width:50px}.history-detail dd{text-align:right;overflow-wrap:anywhere;flex:1;margin:0}.history-stars{justify-content:flex-end;gap:0;display:flex}.history-stars button{color:#666;min-height:30px;padding:0 6px;font-size:20px}.history-stars button.filled{color:#ffb746}.history-info-heading{color:#999;justify-content:space-between;align-items:center;margin:18px 0 8px;display:flex}.history-info-heading button{background:var(--ui-surface-panel);width:28px;min-height:28px;padding:0}.history-info{white-space:pre-wrap;overflow-wrap:anywhere;font:inherit;margin:0 0 20px;font-size:13px;line-height:1.6}.history-detail-actions{grid-template-columns:1fr 1fr;gap:8px;padding-top:14px;display:grid}.history-detail-actions button{background:var(--ui-surface-panel);min-height:38px;padding:6px;font-size:13px}.history-batch{border-top:1px solid var(--ui-border);flex-shrink:0;justify-content:space-between;align-items:center;gap:12px;padding:16px 24px;display:flex}.history-batch>span{color:#aaa}.history-batch>div{flex-wrap:wrap;justify-content:flex-end;gap:8px;display:flex}.history-batch button{background:var(--ui-surface-panel)}.library-status{color:#bbb;margin:0;padding:5px 26px;font-size:12px}.history-rating-menu{background:var(--ui-surface-menu)!important;border:1px solid #414141!important;border-radius:18px!important;padding:8px!important}.history-rating-menu button{color:#eee;width:100%;font:inherit;text-align:left;cursor:pointer;background:0 0;border:0;border-radius:10px;align-items:center;gap:8px;padding:13px 12px;font-size:14px;line-height:1.4;display:flex}.history-rating-menu button:hover{background:var(--ui-hover)}.history-rating-menu button>span{color:#ffb746}.history-rating-menu button>svg{color:#a6caff;margin-left:auto}.library-confirm{width:min(440px,100%);height:auto;max-height:90vh;box-shadow:var(--ui-menu-shadow);border-radius:18px;padding:22px}.library-confirm h3{margin:0 0 12px;font-size:17px;font-weight:550}.library-confirm p{color:#aaa;margin:0 0 22px;line-height:1.7}.library-confirm footer{justify-content:flex-end;gap:10px;display:flex}.library-confirm footer button{background:var(--ui-surface-raised)}@media (width<=1000px){.history-toolbar{gap:8px;padding:12px 18px 4px}.history-tools{justify-content:flex-end;width:100%;margin-left:0}.history-scroll{padding:14px 20px}.history-detail{width:290px}}@media (width<=650px){.library-dialog:is(.history-dialog,.character-library-dialog){width:100%;height:calc(100dvh - 24px)}.library-overlay{padding:6px}.library-dialog{border-radius:var(--ui-radius-menu)}.library-heading{gap:8px;min-height:64px;padding:14px 16px}.library-heading h2{font-size:18px}.history-density{gap:5px;padding:5px}.history-density input{width:65px}.history-toolbar{padding:10px 12px}.history-types{border:0;gap:2px;padding-left:0}.history-types button{padding:6px}.history-scroll{padding:14px}.history-grid{grid-template-columns:repeat(auto-fill,minmax(0,min(var(--history-thumbnail),140px)))}.history-detail{background:var(--ui-surface-menu);border:0;width:100%;padding:16px;position:absolute;inset:0}.history-detail-image,.history-detail-image img,.history-detail video{max-height:40vh}.history-batch{flex-direction:column;align-items:flex-start;padding:12px}.history-batch>div{justify-content:flex-start;gap:5px}.history-batch button{padding:6px 9px;font-size:12px}.history-hover-actions{opacity:1;pointer-events:auto}.library-dialog .history-select{opacity:1}}.library-options{box-sizing:border-box;border:1px solid var(--ui-border);background:var(--ui-surface-menu);-webkit-backdrop-filter:blur(18px);backdrop-filter:blur(18px);box-shadow:var(--ui-menu-shadow);color:#eee;font:14px/1.5 var(--ui-font-family);overscroll-behavior:contain;border-radius:18px;padding:8px}.library-options button{box-sizing:border-box;width:100%;min-height:44px;color:inherit;font:inherit;text-align:left;cursor:pointer;background:0 0;border:0;border-radius:11px;justify-content:space-between;align-items:center;gap:14px;padding:11px 14px;display:flex}.library-options button:hover,.library-options button[aria-selected=true]{background:var(--ui-selected)}.library-options button>span{color:#9cc7ff}.history-grid.voice-history-grid article{aspect-ratio:auto;min-height:180px;padding-bottom:12px}.voice-history-grid .history-preview{height:140px}.voice-history-grid .compact-audio-player{width:calc(100% - 24px);margin:0 12px}.voice-history-grid .history-hover-actions{bottom:46px}.history-storage{border-bottom:1px solid var(--ui-border);color:#999;flex-shrink:0;justify-content:space-between;align-items:center;gap:12px;padding:10px 24px;font-size:12px;display:flex}.history-storage p{flex-wrap:wrap;gap:16px;margin:0;display:flex}.history-storage strong{color:#ccc;font-weight:500}.history-storage button{color:#bbb;white-space:nowrap}.history-storage .commerce-storage-error{align-items:center;gap:12px;display:flex}
