:root{--xagent-dock-inset:max(16px,env(safe-area-inset-right),env(safe-area-inset-bottom))}
@media (min-width: 901px) {
  main > .wrap {
    padding-right:max(clamp(28px,4vw,60px),calc(var(--xagent-dock-inset) + 68px));
  }
}
/* XAgent extends the existing site palette; only the assistant occupies this layer. */
.xagent-launcher{--color-brand-red:#c90e35;--color-surface:#fff;position:fixed;right:max(0px,calc(var(--xagent-dock-inset) - var(--xagent-scrollbar-width,0px)));bottom:var(--xagent-dock-inset);z-index:130;width:44px;height:44px;padding:0;border:0;border-radius:50%;background:transparent;box-shadow:none;display:grid;place-items:center;cursor:pointer;color:var(--acc);transition:transform .22s cubic-bezier(.16,1,.3,1),opacity .22s ease;overflow:visible}
.xagent-launcher:hover{transform:scale(1.06)}
.xagent-launcher:active{transform:scale(.96)}
.xagent-launcher:focus{outline:none}
.xagent-launcher[data-keyboard-focus]:focus-visible{outline:2px solid #a84459;outline-offset:4px}
/* The Bloub viewBox includes motion space: 66.044px renders its idle body at 41.8px, 95% of the 44px back button. */
.xagent-launcher svg{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);display:block;width:66.044px;height:66.044px;overflow:visible}
.xagent-fallback{position:relative;display:block;flex:none;width:28px;height:28px;border-radius:50%;background:#c90e35}
.xagent-fallback::before,.xagent-fallback::after{content:"";position:absolute;top:29%;width:9%;height:25%;border-radius:99px;background:#fff}
.xagent-fallback::before{left:30%}.xagent-fallback::after{right:30%}
.xagent-launcher .xagent-fallback{width:41.8px;height:41.8px}
.xagent-launcher:has(svg) .xagent-fallback{display:none}
:root body #top{right:max(0px,calc(var(--xagent-dock-inset) - var(--xagent-scrollbar-width,0px)));bottom:calc(var(--xagent-dock-inset) + 60px);width:44px;height:44px;border:1px solid #e8e8e8;border-radius:50%;background:#fff;color:#242424;box-shadow:0 2px 6px rgba(0,0,0,.04)}
:root body #top:hover{background:#f2f2f2}
body.xagent-open #top{opacity:0!important;pointer-events:none!important}
body.xagent-open .xagent-launcher{visibility:hidden;opacity:0;pointer-events:none;transform:translateY(7px)}
body.xagent-obscured .xagent-launcher{opacity:0;pointer-events:none}
/* Glass panel with a separate opaque matte input surface. */
.xagent-panel{--xagent-composer-top-padding:14px;position:fixed;right:max(16px,env(safe-area-inset-right));bottom:calc(max(16px,env(safe-area-inset-bottom)) + var(--xagent-keyboard-offset,0px));z-index:135;width:min(420px,calc(100vw - 32px));height:min(560px,calc(100dvh - 32px - env(safe-area-inset-bottom)));display:grid;grid-template-rows:auto minmax(0,1fr) auto;max-height:max(0px,calc(var(--xagent-visible-height,100dvh) - 32px - env(safe-area-inset-bottom)));border:0;border-radius:var(--radius-ui,12px);background:rgba(255,255,255,.78);-webkit-backdrop-filter:blur(24px) saturate(120%);backdrop-filter:blur(24px) saturate(120%);box-shadow:inset 0 0 0 1px rgba(255,255,255,.8),0 24px 64px -16px rgba(0,0,0,.24),0 4px 14px rgba(0,0,0,.06);overflow:hidden;transform-origin:bottom right;color:var(--ink)}
.xagent-panel:focus{outline:none}
.xagent-header{display:flex;align-items:center;gap:10px;min-height:64px;padding:10px 20px;border:0;background:transparent}
.xagent-mark{position:relative;--color-brand-red:#c90e35;--color-surface:#fff;width:32px;height:32px;flex:none;display:grid;place-items:center;background:transparent;color:var(--acc)}
.xagent-mark svg{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);display:block;width:44px;height:44px;max-width:none}
.xagent-mark .xagent-fallback{font-size:26px;font-weight:800}
.xagent-mark:has(svg) .xagent-fallback{display:none}
.xagent-heading{min-width:0;flex:1;display:flex;flex-wrap:wrap;align-items:center;column-gap:8px}
.xagent-heading strong{display:block;font-size:16px;font-weight:650;line-height:24px;letter-spacing:-.02em}
.xagent-ai{display:block;margin-left:0;font-size:11px;font-weight:400;line-height:24px;color:#686868;white-space:nowrap}
.xagent-status{display:block;flex:1;min-width:0;min-height:20px;margin-top:0;color:#686868;font-size:11px;line-height:1.4}
.xagent-controls{display:flex;gap:5px}
.xagent-icon-button{display:grid;place-items:center;flex:none;width:44px;height:44px;border:0;border-radius:var(--radius-ui,12px);background:transparent;color:#555;cursor:pointer;font-size:22px;line-height:1}
.xagent-icon-button:hover{background:#f3f3f3;color:#171717}
.xagent-icon-button:focus-visible,.xagent-prompt:focus-visible,.xagent-send:focus-visible,.xagent-send[data-busy="true"]:focus-visible{outline:2px solid #242424;outline-offset:2px}
.xagent-thread-region{position:relative;display:grid;grid-template-rows:minmax(0,1fr);min-height:0}
.xagent-thread{background:transparent;overflow:auto;overscroll-behavior:contain;scrollbar-color:#ccc transparent;padding:28px;min-height:0;display:flex;flex-direction:column;gap:24px}
.xagent-empty{margin:auto 0;display:flex;flex-direction:column;gap:26px;padding:10px 0}
.xagent-empty h2{margin:0;font-size:30px;letter-spacing:-.025em;line-height:1.3;font-weight:600;max-width:100%}
.xagent-greeting{display:block;font-size:18px;font-weight:400;letter-spacing:0;color:#73736e;margin-bottom:8px}
/* The single live character moves between greeting, conversation and dock. */
.xagent-welcome{display:flex;align-items:center;justify-content:space-between;gap:16px;padding:0 2px;overflow:clip}
.xagent-welcome h2{flex:1;min-width:0}
.xagent-welcome-avatar{--color-brand-red:#c90e35;--color-surface:#f7f7f7;position:relative;flex:none;width:112px;height:112px;display:grid;place-items:center}
.xagent-welcome-avatar svg{position:absolute;left:50%;top:50%;width:112px;height:112px;max-width:none;overflow:visible;transform:translate(-50%,-50%)}
.xagent-welcome-avatar .xagent-fallback{width:71px;height:71px}
.xagent-welcome-avatar:has(svg) .xagent-fallback{display:none}
.xagent-panel:has(.xagent-empty:not([hidden])) .xagent-mark{display:none}
.xagent-panel:has(.xagent-empty:not([hidden])) .xagent-header{padding-left:28px}
.xagent-empty p{font-size:13px;line-height:1.7;color:#67635f;max-width:290px}
.xagent-prompts{display:grid;grid-template-columns:1fr 1fr;gap:10px}
.xagent-prompt{display:flex;flex-direction:column;justify-content:space-between;align-items:flex-start;gap:16px;min-width:0;min-height:88px;padding:15px 16px;text-align:left;border:1px solid #e3e3df;border-radius:var(--radius-ui,12px);background:rgba(255,255,255,.7);color:#3d3d39;cursor:pointer;font-size:14px;font-weight:500;line-height:1.5;transition:background .18s,color .18s,border-color .18s,transform .18s}
.xagent-prompt:hover{background:#fff;border-color:#d2d2cc;color:#171717;transform:translateY(-1px)}
.xagent-prompt:active{transform:translateY(0)}
.xagent-prompt:first-child{grid-column:1 / -1;flex-direction:row;align-items:center;gap:12px;min-height:58px;padding:15px 18px;border-color:transparent;background:#232322;color:#fff;font-size:15px}
.xagent-prompt:first-child:hover{background:#343434}
.xagent-prompt span:last-child{align-self:flex-end;font-size:18px;line-height:1;color:#85857f;transition:transform .18s}
.xagent-prompt:first-child span:last-child{align-self:center;color:#fff}
.xagent-prompt:hover span:last-child{transform:translateX(3px)}
.xagent-icon-button svg{width:18px;height:18px;display:block}
.xagent-message{display:flex;flex-direction:column;gap:5px;max-width:88%;min-width:0;overflow-wrap:anywhere;white-space:pre-wrap}
.xagent-message--user{align-self:flex-end;align-items:flex-end}
.xagent-message--assistant{align-self:flex-start;align-items:flex-start;max-width:100%}
.xagent-message__label{display:flex;align-items:center;gap:6px;font-size:11px;font-weight:500;color:#686868;padding:0 2px}
.xagent-message--assistant .xagent-message__label{min-height:20px}
.xagent-message--assistant .xagent-message__label::before{content:"";flex:none;width:6px;height:6px;margin:7px;border-radius:50%;background:#c90e35}
.xagent-message__label:has(.xagent-processing:not([hidden]))::before{display:none}
.xagent-message__body{max-width:100%;padding:11px 14px;border-radius:var(--radius-ui,12px);background:#f3f3f3;color:#242424;font-size:15px;line-height:1.8}
.xagent-message--user .xagent-message__body{border-radius:var(--radius-ui,12px);background:#1f1e1d;color:#fff}
.xagent-message--assistant .xagent-message__body{border-radius:0;border:0;background:transparent;padding:0 2px}
.xagent-message__meta{font-size:11px;color:#686868;padding:0 4px}
.xagent-jump{position:absolute;bottom:calc(9.6px - var(--xagent-composer-top-padding) * .2);left:50%;transform:translateX(-50%);padding:7px 12px;border:1px solid #dedede;border-radius:100px;background:#fff;box-shadow:0 4px 14px rgba(0,0,0,.12);font-size:11px;cursor:pointer;white-space:nowrap}
.xagent-composer{padding:var(--xagent-composer-top-padding) 20px 20px;border:0;background:transparent}
.xagent-input-wrap{display:flex;align-items:center;gap:8px;padding:6px 6px 6px 13px;border:1px solid #dededa;border-radius:28px;background:#fdfdfc;box-shadow:inset 0 1px 3px rgba(30,30,24,.035),0 1px 0 #fff;transition:border-color .2s,box-shadow .2s}
.xagent-input-wrap:focus-within{background:#fff}
.xagent-input{display:block;flex:1;min-width:0;max-height:118px;min-height:44px;padding:10px 0;border:0;outline:0!important;resize:none;background:transparent;color:#191817;font:inherit;font-size:15px;line-height:24px}
.xagent-input::placeholder{color:#707070}
.xagent-send{flex:none;width:44px;height:44px;padding:0;border:0;border-radius:50%;background:#000;color:#fff;display:grid;place-items:center;cursor:pointer}
.xagent-send svg{width:21px;height:21px;display:block}
.xagent-send:disabled{opacity:1;cursor:default}
.xagent-send:not(:disabled):hover,.xagent-send[data-busy="true"]:hover{background:#222}
/* Reserve the status row so blur cannot move Send between pointerdown and click. */
.xagent-composer-note{display:flex;align-items:center;justify-content:space-between;min-height:24px;padding:4px 3px 0;color:#77726c;font-size:10px;line-height:1.3}
.xagent-composer-note:not(:has(.xagent-note:not(:empty),.xagent-count:not([hidden]),.xagent-readiness:not([hidden]))){visibility:hidden}
.xagent-composer-note strong{color:#333}
.xagent-thread{--scroll-track:transparent;scrollbar-width:thin}
.xagent-input{--scroll-track:transparent}
@media(max-width:767px){
  .xagent-launcher{right:max(0px,calc(var(--xagent-dock-inset) - var(--xagent-scrollbar-width,0px)));bottom:var(--xagent-dock-inset);width:44px;height:44px}
  :root body #top{right:max(0px,calc(var(--xagent-dock-inset) - var(--xagent-scrollbar-width,0px)));bottom:calc(var(--xagent-dock-inset) + 60px)}
  .xagent-panel{--xagent-composer-top-padding:10px;position:fixed;left:auto;right:12px;bottom:calc(max(12px,env(safe-area-inset-bottom)) + var(--xagent-keyboard-offset,0px));width:calc(100% - 24px);height:min(680px,calc(var(--xagent-visible-height,100dvh) - 24px - env(safe-area-inset-bottom)));border-radius:var(--radius-ui,12px)}
  .xagent-thread{padding:24px}
  .xagent-empty{margin:auto 0;gap:28px}
  .xagent-resize{display:none}
  .xagent-message{max-width:92%}
  .xagent-message--assistant{max-width:100%}
  .xagent-composer{padding:var(--xagent-composer-top-padding) 16px 16px}
  .xagent-empty h2{font-size:30px}
  .xagent-input{font-size:16px}
}
@media(max-height:560px){.xagent-panel{height:calc(100dvh - 32px)}.xagent-empty{margin:0;gap:20px}.xagent-empty h2{font-size:28px}.xagent-greeting{font-size:18px}}
@media(prefers-reduced-motion:reduce){.xagent-panel,.xagent-launcher,.xagent-prompt,.xagent-prompt span:last-child{animation:none;transition:none}.xagent-prompt:hover,.xagent-prompt:hover span:last-child{transform:none}}
@media print{#xagent-root{display:none!important}}
@media(max-width:360px){
  .xagent-header{gap:7px;padding:9px 10px;min-height:64px}
  .xagent-mark{width:32px;height:32px}
  .xagent-mark svg{width:42px;height:42px}
  .xagent-controls{gap:0}
  .xagent-icon-button{width:44px;height:44px}
  .xagent-heading{column-gap:4px}
  .xagent-ai{font-size:10px}
  .xagent-thread{padding:20px}
  .xagent-empty{gap:24px}
  .xagent-empty h2{font-size:26px}
  .xagent-greeting{font-size:17px}
  .xagent-welcome-avatar{width:96px;height:96px}
  .xagent-welcome-avatar svg{width:96px;height:96px}
  .xagent-welcome-avatar .xagent-fallback{width:62px;height:62px}
  .xagent-prompt{font-size:13px;padding:13px}
}


/* Edge handles enlarge the panel into the open page, without moving its dock. */
.xagent-resize{position:absolute;z-index:2;touch-action:none;border:0;background:transparent;padding:0}
.xagent-resize--left{left:0;top:20px;bottom:20px;width:6px;cursor:ew-resize}
.xagent-resize--top{top:0;left:20px;right:20px;height:6px;cursor:ns-resize}
/* The inset arc shares the panel corner centre and follows its radius token. */
.xagent-resize--corner{left:0;top:0;width:28px;height:28px;cursor:nwse-resize;border-radius:var(--radius-ui,12px) 0 0;color:rgba(0,0,0,.16);transition:color 160ms ease}
.xagent-resize-arc{position:absolute;left:4px;top:4px;width:calc(var(--radius-ui,12px) - 4px);height:calc(var(--radius-ui,12px) - 4px);border-top:1px solid currentColor;border-left:1px solid currentColor;border-top-left-radius:100%;pointer-events:none}
@media(hover:hover){.xagent-resize--corner:hover{color:rgba(0,0,0,.32)}}
.xagent-resize--corner:active,.xagent-panel.is-resizing .xagent-resize--corner{color:rgba(0,0,0,.45)}
.xagent-resize--corner:focus-visible{outline:none;color:#242424}
.xagent-resize--corner:focus-visible .xagent-resize-arc{border-width:2px}
@media(prefers-reduced-motion:reduce){.xagent-resize--corner{transition:none}}
.xagent-panel.is-resizing{animation:none;user-select:none}

/* Transitions.dev card resize: animated discrete changes, direct pointer tracking. */
.xagent-panel.t-resize{
  --resize-dur:300ms;
  --resize-ease:cubic-bezier(.22,1,.36,1);
  max-width:calc(100vw - 24px);
  max-height:max(0px,calc(var(--xagent-visible-height,100dvh) - 32px - env(safe-area-inset-bottom)));
  transition:width var(--resize-dur) var(--resize-ease),height var(--resize-dur) var(--resize-ease);
  will-change:width,height;
}
.xagent-panel.t-resize.is-resizing{transition:none}
@media(prefers-reduced-motion:reduce){.xagent-panel.t-resize{transition:none!important}}
.xagent-message__meta:empty{display:none}
.xagent-retry{align-self:flex-start;border:1px solid #ddd;background:#fff;border-radius:var(--radius-ui,12px);padding:4px 10px;font:inherit;font-size:12px;cursor:pointer}
.xagent-verification{margin-bottom:10px;min-height:65px}

/* Transitions.dev thinking states, scoped to the assistant's real request status. */
.xagent-panel{
  --think-swap:150ms;--think-gap:50ms;--think-distance:8px;--think-blur:2px;
  --think-shimmer:2000ms;--think-base:#686868;--think-highlight:#ddd;
  --stream-fade:350ms;--stream-blur:1px;--stream-ease:cubic-bezier(.22,1,.36,1);
}
.xagent-status.t-think{position:relative;text-align:left;line-height:20px}
.xagent-panel .t-think-sizer{display:block;visibility:hidden;white-space:nowrap}
.xagent-panel .t-think-text{position:absolute;inset:0;display:block;color:var(--think-base);white-space:nowrap}
.xagent-panel .t-think-text::before{
  content:attr(data-text);position:absolute;inset:0;pointer-events:none;
  background:linear-gradient(90deg,transparent 40%,var(--think-highlight) 50%,transparent 60%) 100% 0 / 400% 100% no-repeat;
  -webkit-background-clip:text;background-clip:text;color:transparent;-webkit-text-fill-color:transparent;
  animation:xagent-think-shimmer var(--think-shimmer) linear infinite;
}
.xagent-panel .t-think-text.is-exit{animation:xagent-think-exit var(--think-swap) ease-in-out both}
.xagent-panel .t-think-text.is-exit::before{display:none}
.xagent-panel .t-think-text.is-enter{animation:xagent-think-enter var(--think-swap) ease-in-out var(--think-gap) both}
@keyframes xagent-think-shimmer{to{background-position:0 0}}
@keyframes xagent-think-exit{to{transform:translateY(calc(-1 * var(--think-distance)));filter:blur(var(--think-blur));opacity:0}}
@keyframes xagent-think-enter{from{transform:translateY(var(--think-distance));filter:blur(var(--think-blur));opacity:0}to{transform:translateY(0);filter:blur(0);opacity:1}}
/* Inline text preserves Chinese wrapping, spaces, selection and copy verbatim. */
.xagent-panel .t-stream-w.is-in{animation:xagent-stream-in var(--stream-fade) var(--stream-ease) both}
@keyframes xagent-stream-in{from{opacity:.2;filter:blur(var(--stream-blur))}to{opacity:1;filter:blur(0)}}
.xagent-panel.is-page-hidden .t-think-text::before{animation-play-state:paused}
@media(prefers-reduced-motion:reduce){
  .xagent-panel .t-think-text,.xagent-panel .t-stream-w.is-in{animation:none!important;transform:none!important;filter:none!important;opacity:1!important}
  .xagent-panel .t-think-text::before{display:none!important}
}

/* Adapted from Transitions.dev Icon swap: one control keeps its focus and size. */
.xagent-send.t-icon-swap .t-icon{
  grid-area:1 / 1;
  transition:opacity 180ms ease-in-out,filter 180ms ease-in-out,transform 180ms cubic-bezier(.22,1,.36,1);
}
.xagent-send[data-busy="false"] .xagent-stop-icon,
.xagent-send[data-busy="true"] .xagent-send-icon{opacity:0;filter:blur(2px);transform:scale(.4)}
.xagent-send[data-busy="true"] .xagent-stop-icon,
.xagent-send[data-busy="false"] .xagent-send-icon{opacity:1;filter:blur(0);transform:scale(1)}
.xagent-send{transition:background 150ms ease,scale 120ms ease}
.xagent-send:not(:disabled):active,.xagent-icon-button:active{scale:.94}
.xagent-icon-button{transition:background 150ms ease,color 150ms ease,scale 120ms ease}
.xagent-jump{animation:xagent-jump-in 160ms cubic-bezier(.22,1,.36,1) both}
@keyframes xagent-jump-in{from{opacity:0;translate:0 4px}to{opacity:1;translate:0 0}}
@media(prefers-reduced-motion:reduce){
  .xagent-send.t-icon-swap .t-icon,.xagent-send,.xagent-icon-button{transition:none!important}
  .xagent-jump{animation:none!important}
}

/* The upstream 64px chat preset appears only while awaiting the first text. */
.xagent-processing{display:contents}
.xagent-processing .xagent-status{margin-left:4px;font-size:12px;line-height:20px;flex:none}
.xagent-processing[hidden]{display:none}
.xagent-orb{display:block;order:-1;flex:none;width:20px;height:20px}
.xagent-orb[hidden]{display:none}
/* Transitions.dev badge. Only real unread replies set data-open=true. */
#xagent-root .t-badge{
  --badge-slide-dur:260ms;--badge-pop-dur:500ms;--badge-close-dur:180ms;
  position:absolute;top:-2px;right:-2px;pointer-events:none;
}
#xagent-root .t-badge-dot{
  display:grid;place-items:center;min-width:17px;height:17px;padding:0 4px;
  border-radius:999px;box-shadow:0 0 0 2px #fff;background:#202321;color:#fff;
  font:600 10px/1 var(--sans,sans-serif);font-variant-numeric:tabular-nums;
  opacity:1;transform:scale(1);filter:blur(0);
  transition:transform var(--badge-pop-dur) cubic-bezier(.34,1.36,.64,1),opacity 400ms ease,filter var(--badge-pop-dur) ease;
}
#xagent-root .t-badge[data-open="true"]{animation:xagent-badge-in var(--badge-slide-dur) cubic-bezier(.22,1,.36,1)}
#xagent-root .t-badge[data-open="false"] .t-badge-dot{
  opacity:0;transform:scale(0);filter:blur(2px);
  transition-duration:var(--badge-close-dur);transition-timing-function:cubic-bezier(.4,0,.2,1);
}
.xagent-jump .t-badge{top:-5px!important;right:-5px!important}
@keyframes xagent-badge-in{from{transform:translate(-8.2px,12.4px)}to{transform:translate(0,0)}}
@media(prefers-reduced-motion:reduce){#xagent-root .t-badge,#xagent-root .t-badge-dot{animation:none!important;transition:none!important}}

/* Keep the panel readable when transparency is unavailable or reduced. */
@supports not ((backdrop-filter:blur(1px)) or (-webkit-backdrop-filter:blur(1px))){.xagent-panel{background:#fafafa}}
@media(prefers-reduced-transparency:reduce){.xagent-panel{background:#fafafa;-webkit-backdrop-filter:none;backdrop-filter:none}}

/* Only shown during draft input or actual session restoration. */
.xagent-readiness{display:inline-flex;align-items:center;gap:5px;color:#77726c}
.xagent-readiness[hidden]{display:none}
.xagent-readiness canvas{width:20px;height:20px;flex:none}

/* A brief greeting sits beside the dock without covering the return-to-top control. */
.xagent-dock-hello{position:absolute;right:calc(100% + 12px);top:50%;transform:translateY(-50%);padding:8px 13px;border:1px solid #e5e3df;border-radius:16px;background:#fff;color:#242424;font:500 14px/1.2 -apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;white-space:nowrap;pointer-events:none;animation:xagent-hello-in .24s ease-out both}
.xagent-dock-hello[hidden]{display:none}
@keyframes xagent-hello-in{from{opacity:0;translate:5px 0}to{opacity:1;translate:0 0}}
@media(prefers-reduced-motion:reduce){.xagent-dock-hello{animation:none}}
