:root{color-scheme:dark;font-family:Inter,Microsoft YaHei UI,system-ui,sans-serif;--ink: #f7f8fb;--muted: #a7adba;--surface: rgba(20, 23, 29, .93);--surface-strong: #171a20;--line: rgba(255, 255, 255, .14);--accent: #65d7c0;--accent-strong: #38bfa5;--danger: #ff776e}*{box-sizing:border-box;letter-spacing:0}html,body,#companion{width:100%;height:100%;margin:0;overflow:hidden;background:transparent}button,input,textarea,select{font:inherit}button{color:inherit}.companion{position:relative;isolation:isolate;user-select:none}.character-stage{position:absolute;inset:0;display:grid;place-items:center;overflow:hidden;cursor:grab;touch-action:none}.character-stage.is-dragging{cursor:grabbing}#live2d-canvas{position:absolute;inset:0;width:100%;height:100%;display:block}.fallback-character{display:none}.has-live2d .fallback-character,.has-live2d .model-notice{opacity:0;pointer-events:none}.model-notice{position:absolute;left:50%;bottom:122px;width:min(330px,calc(100% - 42px));transform:translate(-50%);display:grid;gap:3px;padding:10px 14px;border:1px solid var(--line);border-radius:6px;background:#14171dd6;box-shadow:0 12px 32px #0000003d;text-align:center;backdrop-filter:blur(14px);transition:opacity .18s ease}.companion:not(.has-live2d) .model-notice{top:50%;bottom:auto;transform:translate(-50%,-50%)}.model-notice strong{font-size:13px}.model-notice span{color:var(--muted);font-size:11px;line-height:1.45}.window-tools{position:absolute;z-index:20;top:12px;right:12px;display:flex;gap:6px;opacity:.22;transition:opacity .15s ease}.companion:hover .window-tools,.window-tools:focus-within{opacity:1}.icon-button,.restore-chat,.send-button{display:inline-grid;place-items:center;width:34px;height:34px;flex:0 0 34px;border:1px solid var(--line);border-radius:6px;background:#14171dd1;color:var(--ink);cursor:pointer;backdrop-filter:blur(14px);transition:background .14s ease,border-color .14s ease,color .14s ease}.icon-button:hover,.restore-chat:hover,.send-button:hover{border-color:#65d7c0a3;background:#1d2429f5}.icon-button.is-active{color:var(--accent)}.chat-stack{position:absolute;z-index:12;left:50%;right:auto;bottom:22px;width:min(490px,calc(100% - 48px));transform:translate(-50%);display:grid;gap:8px;transition:opacity .15s ease,transform .15s ease}.chat-stack.is-hidden{opacity:0;pointer-events:none;transform:translate(-50%,10px)}.reply-bubble{max-height:190px;overflow:auto;padding:12px 14px;border:1px solid var(--line);border-radius:6px;background:#14171de6;color:var(--ink);box-shadow:0 16px 42px #00000047;font-size:14px;line-height:1.65;white-space:pre-wrap;user-select:text;backdrop-filter:blur(18px)}.reply-bubble.is-empty{display:none}.chat-form{display:grid;grid-template-columns:minmax(0,1fr) 38px;gap:8px;align-items:end;padding:8px;border:1px solid var(--line);border-radius:6px;background:#14171deb;box-shadow:0 16px 42px #00000047;backdrop-filter:blur(18px)}.chat-form textarea{width:100%;min-height:38px;max-height:126px;resize:none;overflow-y:auto;border:0;outline:0;background:transparent;color:var(--ink);padding:8px 7px 6px;line-height:1.45;user-select:text}.chat-form textarea::placeholder{color:#868d9a}.send-button{width:38px;height:38px;color:#07110f;border-color:transparent;background:var(--accent);font-size:20px;font-weight:800}.send-button:hover{color:#07110f;background:#8be5d2}.send-button:disabled{cursor:wait;opacity:.5}.restore-chat,.restore-chat.is-visible{display:none}.status-pill{position:absolute;z-index:11;left:14px;bottom:14px;max-width:calc(100% - 28px);padding:5px 9px;border:1px solid var(--line);border-radius:5px;background:#14171dc2;color:var(--muted);font-size:11px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;opacity:.58;backdrop-filter:blur(12px)}.settings-panel{position:absolute;z-index:30;top:10px;right:10px;bottom:10px;width:min(390px,calc(100% - 20px));display:grid;grid-template-rows:auto minmax(0,1fr);border:1px solid var(--line);border-radius:7px;background:var(--surface);box-shadow:0 24px 72px #00000061;backdrop-filter:blur(22px);transform:translate(calc(100% + 20px));transition:transform .19s ease}.settings-panel.is-open{transform:translate(0)}.settings-header{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:14px 14px 12px;border-bottom:1px solid var(--line);cursor:grab;touch-action:none}.settings-header:active{cursor:grabbing}.settings-header>div{display:grid;gap:2px}.settings-header strong{font-size:15px}.settings-header span{color:var(--muted);font-size:11px}.settings-scroll{min-height:0;overflow-y:auto}.setting-section{display:grid;gap:11px;padding:15px;border-bottom:1px solid var(--line)}.section-heading{display:flex;align-items:center;justify-content:space-between;gap:12px}.section-heading strong{font-size:13px}.section-heading>span{color:var(--muted);font-size:11px}.setting-section label{display:grid;gap:6px;min-width:0;color:var(--muted);font-size:11px}.setting-section input,.setting-section select,.setting-section textarea{width:100%;min-width:0;border:1px solid var(--line);border-radius:5px;outline:0;background:var(--surface-strong);color:var(--ink);padding:9px 10px;user-select:text}.setting-section input:focus,.setting-section select:focus,.setting-section textarea:focus{border-color:#65d7c0b8}.setting-section textarea{resize:vertical;line-height:1.5}.file-picker{position:relative}.file-picker>span{display:grid;place-items:center;min-height:40px;border:1px dashed rgba(101,215,192,.55);border-radius:5px;color:var(--accent);cursor:pointer}.file-picker input{position:absolute;width:1px;height:1px;opacity:0}.field-row{grid-template-columns:72px minmax(0,1fr) 42px;align-items:center}.inline-command{display:grid;grid-template-columns:minmax(0,1fr) 34px;gap:7px;align-items:end}.inline-command .icon-button{background:#65d7c01a;color:var(--accent)}.field-row input[type=range]{padding:0;accent-color:var(--accent)}.field-row output{text-align:right;color:var(--ink)}.field-grid{display:grid;grid-template-columns:100px minmax(0,1fr);gap:8px}.command-button{min-height:38px;border:1px solid rgba(101,215,192,.55);border-radius:5px;background:#65d7c01a;color:var(--accent);cursor:pointer}.command-button:hover{background:#65d7c02e}.switch{position:relative;display:inline-flex!important;width:38px;height:22px}.switch input{position:absolute;opacity:0}.switch span{width:38px;height:22px;border-radius:999px;background:#444b58;cursor:pointer;transition:background .14s ease}.switch span:after{content:"";display:block;width:16px;height:16px;margin:3px;border-radius:50%;background:#fff;transition:transform .14s ease}.switch input:checked+span{background:var(--accent-strong)}.switch input:checked+span:after{transform:translate(16px)}@keyframes breathe{0%,to{transform:translateY(0) scale(1)}50%{transform:translateY(-5px) scale(1.012)}}@media(max-width:520px){.chat-stack{width:calc(100% - 24px);bottom:12px}.window-tools{top:8px;right:8px}.status-pill{display:none}.field-grid{grid-template-columns:1fr}}@media(prefers-reduced-motion:reduce){*,*:before,*:after{animation-duration:.01ms!important;animation-iteration-count:1!important;transition-duration:.01ms!important}}html,body{background:#edf0ef;color:var(--ink)}body{display:grid;place-items:center;height:100dvh}#companion{width:min(calc(720px * var(--web-scale, 1)),100vw);height:min(calc(820px * var(--web-scale, 1)),100dvh)}.web-brand{position:fixed;z-index:2;left:22px;top:20px;display:grid;gap:3px;color:#232b2b;text-decoration:none;font-size:16px;font-weight:650}.web-brand span{font-size:12px;color:#5b6663;font-weight:400}body:has(.settings-panel.is-open) .web-brand{visibility:hidden}.window-tools{opacity:1}.character-stage.character-hidden{visibility:hidden;pointer-events:none}.settings-panel{position:fixed;top:10px;bottom:10px;right:10px;max-height:calc(100dvh - 20px)}.status-pill{bottom:2px}.restore-chat.is-visible{display:inline-grid;position:absolute;right:14px;bottom:34px;z-index:20}.section-heading strong{flex-shrink:0}#provider-state,#sync-state{overflow-wrap:anywhere;text-align:right}.sync-controls{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:7px}.sync-controls[hidden]{display:none}.command-button:disabled{opacity:.45;cursor:default}.settings-panel:not(.is-open){visibility:hidden;pointer-events:none}.web-note{font-size:11px;line-height:1.65;color:var(--muted);margin:0}.connector-download{display:grid;place-items:center;text-decoration:none}#current-chat{display:block;max-width:100%;border:0;padding:5px 8px;background:#252c30;color:#d7dedf;font-size:12px;text-align:left;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;cursor:pointer}.history-page{position:fixed;inset:0;z-index:100;background:#f4f6f5;color:#26322f;display:grid;grid-template-rows:auto minmax(0,1fr);user-select:text}.history-page[hidden]{display:none}.history-header{display:flex;align-items:center;justify-content:space-between;padding:18px 24px;border-bottom:1px solid #d4dcda;background:#fff;gap:16px}.history-header h1{margin:0 0 4px;font-size:20px}#history-status{color:#52635b;font-size:12px}.history-layout{display:grid;grid-template-columns:300px minmax(0,1fr);min-height:0}.history-sidebar{display:flex;flex-direction:column;min-height:0;padding:16px;gap:12px;border-right:1px solid #d4dcda;background:#eaf0ed}.history-command{display:inline-flex;align-items:center;justify-content:center;gap:8px;min-height:40px;padding:8px 14px;border:1px solid #256f62;border-radius:5px;color:#fff;background:#246d60;cursor:pointer}.history-icon{flex:0 0 36px;width:36px;height:36px;display:inline-grid;place-items:center;border:1px solid #cdd6d3;border-radius:5px;color:#3e5049;background:#fff;cursor:pointer}.history-icon.danger{color:#a83540}.history-page button:disabled{opacity:.45;cursor:default}.history-page button:focus-visible,.history-page input:focus-visible{outline:2px solid #1b8975;outline-offset:2px}#history-search{width:100%;min-height:40px;background:#fff;color:#26322f;border:1px solid #cdd6d3;border-radius:4px;padding:8px 10px}#history-list{overflow-y:auto;min-height:0}.history-item{width:100%;display:grid;gap:7px;padding:14px 10px;border:0;border-bottom:1px solid #d4dcda;background:transparent;color:#293832;text-align:left;cursor:pointer;border-radius:0}.history-item[aria-current=true]{background:#d1e7df;box-shadow:inset 3px 0 #267965}.history-item strong,.history-item span{overflow:hidden;white-space:nowrap;text-overflow:ellipsis;min-width:0}.history-item strong{font-size:14px}.history-item span,.history-item small{font-size:12px;color:#5a6d63}#history-empty{color:#697870;font-size:13px;padding:8px}.history-detail{display:grid;grid-template-rows:auto minmax(0,1fr) auto;min-height:0}.history-detail-header{display:flex;align-items:center;gap:8px;padding:16px 24px;border-bottom:1px solid #d4dcda}.history-detail-header h2{flex:1;min-width:0;overflow-wrap:anywhere;font-size:16px;margin:0;max-height:80px;overflow-y:auto}#history-back{display:none}#history-transcript{padding:20px max(24px,calc((100% - 800px)/2));overflow:auto;min-height:0}#history-transcript article{padding:18px 0;border-bottom:1px solid #e0e5e3}#history-transcript article header{font-size:12px;color:#687570}#history-transcript article[data-role=visitor] header{color:#24796a}#history-transcript article p{font-size:15px;line-height:1.8;white-space:pre-wrap;overflow-wrap:anywhere;margin:10px 0 0}.history-detail footer{padding:14px 24px;border-top:1px solid #d4dcda;text-align:right;background:#fff}.history-more{display:block;border:0;color:#246d60;background:transparent;margin:0 auto;padding:12px;cursor:pointer}@media(max-width:700px){.history-header{padding:12px 16px}.history-layout{grid-template-columns:minmax(0,1fr)}.history-detail,.history-page.show-detail .history-sidebar{display:none}.history-page.show-detail .history-detail{display:grid}.history-detail-header{padding:12px;gap:5px}.history-detail-header h2{font-size:14px}#history-back{display:inline-grid}#history-transcript{padding:10px 18px}.history-detail footer{padding-bottom:max(14px,env(safe-area-inset-bottom))}}@media(max-width:600px){.web-brand{left:12px;top:12px;font-size:13px}.web-brand span{font-size:10px}.chat-stack{width:calc(100% - 24px);bottom:30px}.window-tools{top:12px;right:12px;gap:4px}.status-pill{max-width:calc(100% - 24px)}}.touch-layout,.touch-layout body{overscroll-behavior:none}.touch-layout body{position:fixed;inset:0;width:100%;height:100%;overflow:hidden}.touch-layout .window-tools{position:fixed;top:calc(var(--visible-top, 0px) + 12px);right:12px}.touch-layout.keyboard-open .web-brand{visibility:hidden}.touch-layout .chat-stack{position:fixed;left:0;right:0;margin-inline:auto;top:calc(var(--visible-top, 0px) + 64px);bottom:auto;width:min(490px,calc(100% - 24px));height:calc(var(--visible-height, 100dvh) - 64px - max(12px,env(safe-area-inset-bottom)));display:flex;flex-direction:column;justify-content:flex-end;transform:none;pointer-events:none;transition:opacity .15s ease;overflow-anchor:none}.touch-layout .chat-stack.is-hidden{transform:none}.touch-layout .chat-stack:not(.is-hidden)>*{pointer-events:auto}.touch-layout #current-chat,.touch-layout .chat-form{flex:0 0 auto}.touch-layout .reply-bubble{flex:0 1 auto;min-height:0;overscroll-behavior:contain}.touch-layout .chat-form{grid-template-columns:minmax(0,1fr) 44px}.touch-layout #message-input{font-size:16px;height:60px;min-height:44px;max-height:60px;overflow-y:auto;overscroll-behavior:contain}.touch-layout #send-message{width:44px;height:44px;touch-action:manipulation}.touch-layout input,.touch-layout textarea,.touch-layout select{font-size:16px}.touch-layout.keyboard-open .chat-stack{height:calc(var(--visible-height, 100dvh) - 72px)}.touch-layout.compact-input #message-input{height:44px}.touch-layout.compact-input #current-chat,.touch-layout.tiny-input .reply-bubble{display:none}.touch-layout.keyboard-open .status-pill{visibility:hidden}.touch-layout .settings-panel{top:calc(var(--visible-top, 0px) + 10px);bottom:auto;height:calc(var(--visible-height, 100dvh) - 20px);max-height:calc(var(--visible-height, 100dvh) - 20px)}.touch-layout .settings-scroll{overscroll-behavior:contain;scroll-padding-block:12px}.touch-layout .history-page{top:var(--visible-top, 0px);bottom:auto;height:var(--visible-height, 100dvh)}.touch-layout #history-search{font-size:16px}@media(max-width:600px){.web-brand{top:58px}}
