/* Isolated robot portal. Original chest logo remains orange in both themes. */
.sx-mascot { position: fixed; left: max(18px, env(safe-area-inset-left)); bottom: max(var(--mascot-bottom, 20px), env(safe-area-inset-bottom)); z-index: 910; color: var(--sx-fg); font-family: var(--sx-sans); }
.sx-mascot [hidden] { display: none !important; }
.sx-mascot button, .sx-mascot a { -webkit-tap-highlight-color: transparent; }
.sx-mascot-launch { position: relative; display: grid; place-items: center; width: 116px; height: 146px; padding: 0; border: 0; border-radius: 26px; background: transparent; box-shadow: none; cursor: pointer; touch-action: pan-y; }
.sx-mascot-launch-host, .sx-mascot-visual { display: block; width: 116px; height: 146px; }
.sx-mascot-visual { position: relative; filter: drop-shadow(0 7px 5px rgba(6,18,32,.2)); }
.sx-mascot-visual img { visibility: hidden; display: block; width: 100%; height: 100%; object-fit: contain; }
.sx-mascot-canvas { opacity: 0; position: absolute; inset: 0; pointer-events: none; }
.sx-mascot-canvas canvas { display: block; width: 100%; height: 100%; }
.sx-mascot[data-renderer="webgl"] .sx-mascot-canvas { opacity: 1; }
.sx-mascot[data-renderer="svg"] .sx-mascot-visual img { visibility: visible; }
.sx-mascot:not([data-renderer]) .sx-mascot-visual::after { content: ''; position: absolute; width: 22px; height: 22px; left: calc(50% - 12px); top: calc(50% - 12px); border: 2px solid var(--sx-line); border-top-color: var(--sx-action); border-radius: 50%; animation: sx-mascot-loading .9s linear infinite; }
@keyframes sx-mascot-loading { to { transform: rotate(360deg); } }
.sx-mascot-label { position: absolute; left: calc(100% + 2px); top: 40%; display: flex; gap: 8px; align-items: center; padding: 9px 13px; font-size: 12px; font-weight: 600; white-space: nowrap; border-radius: 12px; background: var(--sx-raise); border: 1px solid var(--sx-line); box-shadow: var(--sx-shadow); pointer-events: none; opacity: 0; transition: opacity .2s; }
.sx-mascot-launch:is(:hover,:focus-visible) .sx-mascot-label { opacity: 1; }
.sx-mascot-status-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--sx-action); }
.sx-mascot button:focus-visible, .sx-mascot a:focus-visible { outline: 2px solid var(--sx-action); outline-offset: 3px; }
.sx-mascot-panel { display: flex; flex-direction: column; width: min(370px, calc(100vw - 90px)); max-height: calc(var(--mascot-viewport-height, 100dvh) - var(--mascot-bottom, 20px) - 26px); overflow: hidden; border-radius: 24px; border: 1px solid var(--sx-line); background: var(--sx-raise); box-shadow: 0 18px 70px rgba(0,0,0,.22); }
.sx-mascot-header { display: flex; flex-shrink: 0; align-items: center; gap: 10px; padding: 8px 16px 8px 8px; border-bottom: 1px solid var(--sx-line-soft); }
.sx-mascot-header-host { display: block; width: 61px; height: 75px; flex-shrink: 0; }
.sx-mascot-header-host .sx-mascot-visual { width: 61px; height: 75px; }
.sx-mascot-header strong { display: block; font-size: 20px; font-weight: 700; letter-spacing: -.04em; }
.sx-mascot-header div > span { font-size: 11px; color: var(--sx-fg-2); }
.sx-mascot-close { margin-left: auto; display: grid; place-items: center; width: 40px; height: 40px; flex-shrink: 0; padding: 0; border: 1px solid var(--sx-line-soft); border-radius: 50%; font: 400 25px/1 var(--sx-sans); color: var(--sx-fg); background: transparent; cursor: pointer; }
.sx-mascot-close:hover { background: var(--sx-tint); }
.sx-mascot-content { min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 22px; }
.sx-mascot-eyebrow { color: var(--sx-action); font: 10px/1.5 var(--sx-mono-f); letter-spacing: .1em; }
.sx-mascot-content h2 { font: 600 25px/1.18 var(--sx-sans); letter-spacing: -.04em; margin: 14px 0 12px; color: var(--sx-fg); }
.sx-mascot-content p { font: 400 14px/1.6 var(--sx-sans); margin: 0 0 20px; color: var(--sx-fg-2); }
.sx-mascot-actions { display: grid; gap: 9px; }
.sx-mascot-actions a { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 13px; border: 1px solid var(--sx-line); border-radius: 12px; text-decoration: none; color: var(--sx-fg); font-size: 13px; font-weight: 500; }
.sx-mascot-actions a:hover { border-color: var(--sx-action); background: var(--sx-tint); }
.sx-mascot-actions a span { color: var(--sx-action); }
.sx-mascot-content .sx-mascot-note { margin: 16px 0 0; font-size: 11px; color: var(--sx-fg-3); }
.sx-mascot-composer { display: flex; align-items: center; gap: 6px; flex-shrink: 0; padding: 10px; border-top: 1px solid var(--sx-line-soft); }
.sx-mascot-composer input { min-width: 0; width: 100%; height: 44px; border: 1px solid var(--sx-line); border-radius: 24px; background: var(--sx-tint); color: var(--sx-fg); padding: 0 13px; font: 400 16px/1.4 var(--sx-sans); }
.sx-mascot-composer button { display: grid; place-items: center; width: 44px; height: 44px; flex-shrink: 0; padding: 0; border: 0; border-radius: 50%; background: var(--sx-action); color: #fff; cursor: pointer; }
.sx-mascot-sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.sx-mascot[data-blocked="true"] { visibility: hidden; pointer-events: none; }
.sx-mascot[data-keyboard="true"] { bottom: var(--mascot-keyboard-offset); }
.sx-mascot[data-keyboard="true"] .sx-mascot-panel { max-height: calc(var(--mascot-viewport-height) - 12px); }
@media (max-width: 1024px) {
  .sx-mascot { left: max(12px, env(safe-area-inset-left)); --mascot-bottom: 94px; }
  .sx-mascot-launch, .sx-mascot-launch-host, .sx-mascot-launch-host .sx-mascot-visual { width: 100px; height: 126px; }
  .sx-mascot-label { display: none; }
  .sx-mascot-panel { width: min(370px, calc(100vw - 88px)); }
}
@media (prefers-reduced-motion: reduce) {
  .sx-mascot *, .sx-mascot *::before { animation: none !important; transition: none !important; }
}

@media (max-width: 480px) {
  /* Reference-sized mobile character; keep the viewport/nav positioning unchanged. */
  .sx-mascot { --mascot-bottom: 87.5px; }
  .sx-mascot-launch, .sx-mascot-launch-host, .sx-mascot-launch-host .sx-mascot-visual { width: 100px; height: 126px; }
}

/* Localized greeting accompanies the articulated wave, including touch devices. */
.sx-mascot-label { flex-direction: column; align-items: flex-start; gap: 3px; white-space: normal; width: max-content; max-width: min(210px, calc(100vw - 140px)); line-height: 1.45; text-align: left; }
.sx-mascot-label strong { color: var(--sx-fg); font-size: 13px; }
.sx-mascot-label > span { color: var(--sx-fg-2); }
.sx-mascot[data-state="greeting"] .sx-mascot-label { display: flex; opacity: 1; }
@media (max-width: 1024px) {
  .sx-mascot-label { top: 10%; }
}

/* At the footer end, render and hit-test only the animated head. */
.sx-mascot[data-compact="true"] .sx-mascot-launch,
.sx-mascot[data-compact="true"] .sx-mascot-launch-host,
.sx-mascot[data-compact="true"] .sx-mascot-launch-host .sx-mascot-visual { width: 100px; height: 68px; }
.sx-mascot[data-compact="true"] .sx-mascot-visual { overflow: hidden; }
.sx-mascot[data-compact="true"][data-renderer="svg"] .sx-mascot-visual img { height: auto; object-fit: initial; transform: translateY(-6px); clip-path: inset(0 0 44% 0); }
.sx-mascot[data-compact="true"] .sx-mascot-label { top: auto; bottom: 4px; }

@media (max-width: 767px) {
  .sx-mascot[data-compact="true"] { bottom: max(calc(var(--mascot-bottom, 87.5px) + 12px), env(safe-area-inset-bottom)); }
  .sx-mascot-launch-host { transform-origin: center bottom; }
}

/* Messaging patterns adapted from the read-only Lite reference; colors remain SMARTme tokens. */
.sx-mascot-panel { height: 580px; }
.sx-mascot-header { gap: 8px; padding: 8px 12px 8px 8px; }
.sx-mascot-new { display: grid; place-items: center; width: 32px; height: 36px; flex-shrink: 0; margin-left: auto; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--sx-fg-2); font: 22px/1 var(--sx-sans); cursor: pointer; }
.sx-mascot-new:hover { background: var(--sx-tint); }
.sx-mascot-close { margin-left: 0; }
.sx-mascot-header > div { min-width: 0; }
.sx-mascot-content { flex: 1; padding: 16px 12px; overflow-anchor: none; scroll-behavior: auto; }
.sx-mascot-messages { display: flex; flex-direction: column; gap: 12px; }
.sx-mascot-message { display: flex; align-items: flex-end; gap: 6px; margin: 0; min-width: 0; width: 100%; }
.sx-mascot-message--user { justify-content: flex-end; }
.sx-mascot-bubble { min-width: 44px; max-width: 84%; padding: 9px 11px 5px; border: 1px solid var(--sx-line-soft); border-radius: 13px 13px 13px 3px; background: var(--sx-bg-alt); color: var(--sx-fg); overflow-wrap: anywhere; word-break: normal; }
.sx-mascot-message--user .sx-mascot-bubble { border-radius: 13px 13px 3px 13px; background: color-mix(in srgb, var(--sx-action) 14%, var(--sx-raise)); }
.sx-mascot-message--assistant .sx-mascot-bubble { max-width: calc(100% - 30px); }
.sx-mascot-message-avatar { display: block; flex: 0 0 24px; width: 24px; height: 30px; margin-bottom: 3px; object-fit: contain; }
.sx-mascot-message-body { font: 400 14px/1.5 var(--sx-sans); }
.sx-mascot-message-body p { margin: 0 0 8px; color: inherit; font: inherit; white-space: pre-wrap; }
.sx-mascot-message-body p:last-child { margin-bottom: 0; }
.sx-mascot-message-body ul, .sx-mascot-message-body ol { margin: 6px 0; padding-left: 19px; }
.sx-mascot-message-body ul { list-style: disc; }
.sx-mascot-message-body ol { list-style: decimal; }
.sx-mascot-message-body li + li { margin-top: 4px; }
.sx-mascot-message-body a { color: var(--sx-action); text-decoration: underline; text-underline-offset: 2px; }
.sx-mascot-message-time { display: block; margin-top: 4px; color: var(--sx-fg-2); text-align: right; font: 400 10px/1.3 var(--sx-sans); }
.sx-mascot-message-body > strong { display: block; margin-top: 10px; color: var(--sx-fg-2); font-size: 11px; }
.sx-mascot-message-body .sx-mascot-sources { margin: 4px 0 0; padding-left: 0; list-style: none; font-size: 12px; }
.sx-mascot-typing { display: flex; align-items: flex-end; gap: 6px; }
.sx-mascot-typing-dots { display: flex; align-items: center; gap: 4px; height: 36px; padding: 0 13px; border: 1px solid var(--sx-line-soft); border-radius: 13px 13px 13px 3px; background: var(--sx-bg-alt); }
.sx-mascot-typing-dots i { width: 5px; height: 5px; border-radius: 50%; background: var(--sx-fg-2); animation: sx-mascot-dot 1.1s ease-in-out infinite; }
.sx-mascot-typing-dots i:nth-child(2) { animation-delay: .15s; }
.sx-mascot-typing-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes sx-mascot-dot { 0%, 65%, 100% { transform: translateY(0); opacity: .5; } 30% { transform: translateY(-3px); opacity: 1; } }
.sx-mascot-error { flex-shrink: 0; display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-top: 1px solid var(--sx-line-soft); background: var(--sx-tint); }
.sx-mascot-error .sx-mascot-note { min-width: 0; margin: 0; color: var(--sx-fg-2); font: 400 12px/1.4 var(--sx-sans); }
.sx-mascot-retry { flex-shrink: 0; min-height: 36px; padding: 6px 10px; border: 1px solid var(--sx-line); border-radius: 16px; background: var(--sx-raise); color: var(--sx-action); font: 600 12px/1.3 var(--sx-sans); cursor: pointer; }
.sx-mascot-composer { align-items: flex-end; padding-bottom: max(10px, env(safe-area-inset-bottom)); }
.sx-mascot-composer textarea { display: block; resize: none; min-width: 0; width: 100%; min-height: 44px; max-height: 104px; overflow-y: auto; overscroll-behavior: contain; box-sizing: border-box; border: 1px solid var(--sx-line); border-radius: 22px; background: var(--sx-tint); color: var(--sx-fg); padding: 11px 13px; font: 400 16px/1.3 var(--sx-sans); }
.sx-mascot button:disabled { opacity: .5; cursor: wait; }
@media (prefers-reduced-motion: reduce) { .sx-mascot-typing-dots i { animation: none; } }
