﻿.xw-launcher {
  position: fixed;
  z-index: 1200;
  right: max(18px, env(safe-area-inset-right));
  bottom: max(22px, env(safe-area-inset-bottom));
  display: grid;
  justify-items: center;
  gap: 3px;
  width: 66px;
  padding: 4px 2px 3px;
  border: 0;
  color: #183c34;
  background: transparent;
  cursor: pointer;
  font: inherit;
}
.xw-launcher:focus-visible,
.xw-send:focus-visible,
.xw-action:focus-visible,
.xw-chip:focus-visible {
  outline: 3px solid #438b72;
  outline-offset: 3px;
}
.xw-mascot {
  position: relative;
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border: 2px solid #d7ebe1;
  border-radius: 20px;
  background: #f6fff9;
  box-shadow: 0 5px 18px #183c3433;
  animation: xw-float 2.4s ease-in-out infinite;
}
.xw-mascot::before {
  position: absolute;
  top: -9px;
  width: 2px;
  height: 10px;
  background: #28765e;
  content: "";
}
.xw-mascot::after {
  position: absolute;
  top: -13px;
  width: 7px;
  height: 7px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: #f3ad5e;
  box-shadow: 0 0 0 1px #28765e;
  content: "";
}
.xw-face {
  position: relative;
  display: grid;
  place-items: center;
  width: 36px;
  height: 32px;
  border: 1px solid #c3dfd0;
  border-radius: 13px 13px 11px 11px;
  background: linear-gradient(#fff 42%, #e7f5ec 42%);
}
.xw-face::before {
  position: absolute;
  top: 10px;
  left: 8px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #225c4a;
  box-shadow: 15px 0 #225c4a;
  content: "";
  animation: xw-blink 4s ease-in-out infinite;
}
.xw-face::after {
  position: absolute;
  top: 20px;
  width: 8px;
  height: 3px;
  border-radius: 0 0 7px 7px;
  background: #d57d6c;
  content: "";
}
.xw-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  min-width: 17px;
  height: 17px;
  padding: 0 3px;
  border: 2px solid #fff;
  border-radius: 12px;
  color: #fff;
  background: #cd5147;
  font: 700 10px/13px system-ui, sans-serif;
}
.xw-caption {
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
}
.xw-panel {
  position: fixed;
  z-index: 1201;
  right: max(22px, env(safe-area-inset-right));
  bottom: max(96px, calc(env(safe-area-inset-bottom) + 82px));
  display: flex;
  flex-direction: column;
  width: min(380px, calc(100vw - 28px));
  height: min(590px, calc(100dvh - 128px));
  min-height: 330px;
  overflow: hidden;
  border: 1px solid #d8e6df;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 16px 48px #152d2430;
  color: #20342e;
  font: 14px/1.5 system-ui, sans-serif;
}
.xw-panel[hidden] { display: none; }
.xw-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid #e6eee9;
  background: #f5faf6;
}
.xw-header-mark {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 13px;
  color: #fff;
  background: #20614e;
  font-weight: 800;
}
.xw-header-copy { flex: 1; min-width: 0; }
.xw-header-copy strong, .xw-header-copy small { display: block; }
.xw-header-copy small { color: #70837a; font-size: 11px; }
.xw-close {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 8px;
  color: #496258;
  background: transparent;
  cursor: pointer;
  font-size: 21px;
}
.xw-close:hover { background: #e7f1eb; }
.xw-content {
  flex: 1;
  overflow: auto;
  padding: 13px;
  overscroll-behavior: contain;
}
.xw-message {
  width: fit-content;
  max-width: 92%;
  margin: 0 0 10px;
  padding: 9px 11px;
  border-radius: 11px 11px 11px 3px;
  background: #f1f6f2;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}
.xw-message.user {
  margin-left: auto;
  border-radius: 11px 11px 3px 11px;
  color: #fff;
  background: #21644f;
}
.xw-video-message { width: min(100%, 350px); }
.xw-video-title { display: block; margin-bottom: 8px; }
.xw-video-player { display: block; width: 100%; max-height: 42vh; border-radius: 8px; background: #17211d; }
.xw-video-actions { display: flex; gap: 8px; }
.xw-video-download { display: inline-block; text-decoration: none; }
.xw-video-download:focus-visible { outline: 3px solid #438b72; outline-offset: 3px; }
 .xw-refresh {
  flex: none;
  padding: 6px 9px;
  border: 1px solid #dbe8e0;
  border-radius: 8px;
  color: #23644f;
  background: #fff;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
}
.xw-refresh:disabled { opacity: .55; cursor: wait; }
.xw-task-message { display: block; width: min(100%, 760px); border: 1px solid #deebe3; }
.xw-task-title {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 8px;
  font-weight: 700;
}
.xw-task-detail { margin-top: 5px; color: #667a70; font-size: 12px; font-weight: 400; }
.xw-task-update { margin-top: 4px; color: #23644f; font-size: 11px; }
.xw-status {
  flex: none;
  padding: 2px 7px;
  border-radius: 12px;
  color: #23644f;
  background: #e9f5ee;
  font-size: 11px;
  font-weight: 500;
}
.xw-status.alert { color: #9b3a33; background: #fff0ee; }
.xw-action {
  margin-top: 8px;
  padding: 5px 9px;
  border: 1px solid #d9e8df;
  border-radius: 7px;
  color: #205c49;
  background: #f8fbf9;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
}
.xw-empty, .xw-note { color: #72857c; font-size: 12px; }
.xw-empty { padding: 12px 4px; }
.xw-chips {
  display: flex;
  gap: 6px;
  padding: 8px 12px 4px;
  overflow-x: auto;
  border-top: 1px solid #eef2ef;
}
.xw-chip {
  flex: none;
  padding: 5px 9px;
  border: 1px solid #dbe8e0;
  border-radius: 999px;
  color: #3e6758;
  background: #fff;
  cursor: pointer;
  font: inherit;
  font-size: 11px;
}
.xw-compose {
  display: flex;
  align-items: end;
  gap: 8px;
  padding: 9px 12px 12px;
}
.xw-compose textarea {
  flex: 1;
  min-width: 0;
  min-height: 42px;
  max-height: 100px;
  resize: vertical;
  padding: 9px 10px;
  border: 1px solid #dce8e1;
  border-radius: 9px;
  color: inherit;
  background: #fff;
  font: inherit;
}
.xw-send {
  min-width: 54px;
  height: 38px;
  padding: 0 10px;
  border: 0;
  border-radius: 8px;
  color: #fff;
  background: #20614e;
  cursor: pointer;
  font: inherit;
}
.xw-send:disabled { opacity: .55; cursor: wait; }
.xw-message-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.xw-message .xw-action { margin-right: 6px; }
.xw-thinking { color: #62776d; }
.xw-chip:disabled { opacity: .55; cursor: wait; }
@keyframes xw-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
@keyframes xw-blink { 0%, 44%, 48%, 100% { transform: scaleY(1); } 46% { transform: scaleY(.15); } }
@media (prefers-reduced-motion: reduce) {
  .xw-mascot, .xw-face::before { animation: none; }
}
@media (max-width: 600px) {
  .xw-launcher { right: max(12px, env(safe-area-inset-right)); bottom: max(16px, env(safe-area-inset-bottom)); }
  .xw-launcher[data-role="creator"] { bottom: max(82px, calc(env(safe-area-inset-bottom) + 70px)); }
  .xw-panel {
    right: max(8px, env(safe-area-inset-right));
    bottom: max(82px, calc(env(safe-area-inset-bottom) + 72px));
    width: min(calc(100vw - 16px), 420px);
    height: min(72dvh, calc(100dvh - 104px));
    min-height: 320px;
    border-radius: 13px;
  }
  .xw-panel[data-role="creator"] {
    bottom: max(164px, calc(env(safe-area-inset-bottom) + 150px));
    height: min(70dvh, calc(100dvh - 184px));
  }
}

/* The full conversation shares the current portal and its navigation. */
.xw-launcher[hidden] { display: none; }
.xw-workspace { min-height: 16rem; }
.xw-panel.xw-docked {
  position: relative;
  inset: auto;
  z-index: auto;
  width: 100%;
  height: max(28rem, calc(100dvh - 11rem));
  min-height: 0;
  box-shadow: none;
  background: #fff;
  border-color: #dfe8e2;
}
.xw-docked .xw-header { padding: 12px clamp(14px, 2vw, 24px); background: #f8fbf9; }
.xw-docked :is(.xw-close, .xw-expand) { display: none; }
.xw-new, .xw-expand {
  padding: 6px 10px;
  background: #fff;
  color: #205c49;
  border: 1px solid #dbe8e0;
  border-radius: 8px;
  font: inherit;
  font-size: 12px;
  text-decoration: none;
  cursor: pointer;
}
.xw-docked .xw-content {
  min-height: 0;
  padding: clamp(14px, 2.5vw, 30px) max(16px, calc((100% - 54rem) / 2));
}
.xw-intro { display: none; }
.xw-docked .xw-intro:not([hidden]) { display: block; text-align: center; padding: clamp(28px, 9vh, 100px) 0 30px; }
.xw-intro-mark {
  display: inline-grid;
  place-items: center;
  background: #e6f2eb;
  color: #21644f;
  border-radius: 18px;
  width: 54px;
  height: 54px;
  font-size: 23px;
  font-weight: 750;
}
.xw-intro h2 { margin: 13px 0 7px; color: #172d25; font-size: clamp(23px, 3vw, 34px); }
.xw-intro p { margin: 0; color: #52675d; }
.xw-docked .xw-message { font-size: 15px; line-height: 1.65; padding: 11px 15px; }
.xw-docked .xw-chips { padding: 8px max(14px, calc((100% - 54rem) / 2)); }
.xw-docked .xw-compose { padding: 8px max(14px, calc((100% - 54rem) / 2)) 16px; }
.xw-docked .xw-compose textarea { min-height: 56px; max-height: 22dvh; }
.xw-docked .xw-send { min-width: 66px; }
.xw-docked .xw-header-mark { flex: none; }
@media (max-width: 720px) {
  .xw-panel.xw-docked { height: max(26rem, calc(100dvh - 12rem)); }
  .xw-docked .xw-content { padding: 14px; }
  .xw-docked .xw-message { max-width: 96%; }
}

/* Xiaowei companion: an animated mascot opens a role-aware chat workspace. */
.xw-launcher {
  right: max(16px, env(safe-area-inset-right));
  bottom: max(12px, env(safe-area-inset-bottom));
  z-index: 1202;
  width: 82px;
  height: 108px;
  padding: 0;
}
.xw-mascot {
  width: 66px;
  height: 92px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  animation: none;
}
.xw-mascot::before,
.xw-mascot::after { display: none; content: none; }
.xw-robot {
  position: relative;
  display: block;
  width: 60px;
  height: 88px;
  animation: xw-bob 2.3s ease-in-out infinite;
  transform-origin: 50% 100%;
}
.xw-antenna {
  position: absolute;
  top: 1px;
  left: 29px;
  width: 2px;
  height: 10px;
  border-radius: 2px;
  background: #28765e;
}
.xw-antenna::after {
  position: absolute;
  top: -4px;
  left: -3px;
  width: 8px;
  height: 8px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: #f4b35f;
  box-shadow: 0 0 0 1px #28765e;
  content: "";
  animation: xw-antenna-glow 2.8s ease-in-out infinite;
}
.xw-head {
  position: absolute;
  top: 9px;
  left: 10px;
  z-index: 3;
  width: 40px;
  height: 34px;
  border: 2px solid #bedfce;
  border-radius: 14px 14px 12px 12px;
  background: linear-gradient(#fff 44%, #e7f5ec 44%);
  box-shadow: 0 3px 7px #183c3420;
}
.xw-face {
  position: absolute;
  inset: 0;
  display: block;
  width: auto;
  height: auto;
  border: 0;
  border-radius: inherit;
  background: transparent;
}
.xw-face::before {
  top: 12px;
  left: 8px;
  width: 5px;
  height: 5px;
  background: #225c4a;
  box-shadow: 17px 0 #225c4a;
}
.xw-face::after {
  top: 23px;
  width: 9px;
  height: 4px;
}
.xw-body {
  position: absolute;
  top: 46px;
  left: 16px;
  z-index: 2;
  width: 28px;
  height: 24px;
  border: 2px solid #b8d9c8;
  border-radius: 10px 10px 9px 9px;
  background: linear-gradient(145deg, #fff, #dff1e7);
  box-shadow: 0 3px 7px #183c341c;
}
.xw-body::after {
  position: absolute;
  top: 8px;
  left: 10px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #eab267;
  content: "";
}
.xw-arm {
  position: absolute;
  top: 47px;
  z-index: 1;
  width: 10px;
  height: 20px;
  border: 1px solid #b7d9c7;
  border-radius: 8px;
  background: #dff1e7;
  transform-origin: 50% 4px;
}
.xw-arm::after {
  position: absolute;
  bottom: -4px;
  left: 1px;
  width: 8px;
  height: 8px;
  border: 1px solid #b7d9c7;
  border-radius: 50%;
  background: #fff;
  content: "";
}
.xw-arm-left { left: 8px; transform: rotate(24deg); animation: xw-arm-swing 2.8s ease-in-out infinite; }
.xw-arm-right { right: 8px; transform: rotate(-24deg); animation: xw-wave 3.6s ease-in-out infinite; }
.xw-leg {
  position: absolute;
  top: 68px;
  z-index: 1;
  width: 10px;
  height: 13px;
  border: 1px solid #b7d9c7;
  border-radius: 5px;
  background: #cde7d8;
  transform-origin: 50% 2px;
}
.xw-leg::after {
  position: absolute;
  bottom: -3px;
  left: -4px;
  width: 16px;
  height: 7px;
  border: 1px solid #a9cfba;
  border-radius: 7px 7px 5px 5px;
  background: #fff;
  content: "";
}
.xw-leg-left { left: 19px; animation: xw-step-left 1.1s ease-in-out infinite; }
.xw-leg-right { right: 19px; animation: xw-step-right 1.1s ease-in-out infinite; }
.xw-launcher:hover .xw-arm-right,
.xw-launcher:focus-visible .xw-arm-right { animation: xw-wave-fast .48s ease-in-out 4; }
.xw-launcher.xw-working .xw-robot { animation: xw-work-bob .55s ease-in-out infinite; }
.xw-launcher.xw-working .xw-arm-left { animation-duration: .55s; }
.xw-launcher.xw-working .xw-arm-right { animation-duration: .65s; }
.xw-badge { top: 4px; right: 2px; z-index: 4; }
.xw-caption { margin-top: -2px; padding: 2px 8px; border-radius: 999px; background: #fff; box-shadow: 0 2px 7px #183c341c; }

.xw-panel {
  right: max(16px, env(safe-area-inset-right));
  bottom: max(132px, calc(env(safe-area-inset-bottom) + 118px));
  display: flex;
  flex-direction: row;
  width: min(1000px, calc(100vw - 32px));
  height: min(700px, calc(100dvh - 164px));
  min-height: 420px;
  border-radius: 18px;
  box-shadow: 0 24px 72px #152d2440;
}
.xw-panel.xw-expanded {
  right: max(12px, env(safe-area-inset-right));
  bottom: max(132px, calc(env(safe-area-inset-bottom) + 118px));
  width: min(1440px, calc(100vw - 24px));
  height: min(860px, calc(100dvh - 164px));
}
.xw-sidebar {
  display: flex;
  flex: 0 0 216px;
  flex-direction: column;
  min-width: 0;
  padding: 18px 12px 14px;
  border-right: 1px solid #e6eee9;
  background: #f7faf8;
}
.xw-sidebar-brand { display: flex; align-items: center; gap: 10px; min-width: 0; padding: 2px 6px 20px; }
.xw-sidebar-mark {
  display: grid;
  flex: 0 0 38px;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 13px;
  color: #fff;
  background: #20614e;
  font-size: 18px;
  font-weight: 800;
}
.xw-sidebar-copy { min-width: 0; }
.xw-sidebar-copy strong, .xw-sidebar-copy small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.xw-sidebar-copy strong { color: #1b342c; font-size: 15px; }
.xw-sidebar-copy small { margin-top: 2px; color: #71847a; font-size: 11px; }
.xw-shortcuts { display: grid; align-content: start; gap: 4px; }
.xw-nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 10px 11px;
  border-radius: 10px;
  color: #52685e;
  font: inherit;
  text-decoration: none;
  transition: background .16s ease, color .16s ease, transform .16s ease;
}
.xw-nav-link:hover { color: #185d49; background: #eaf3ed; transform: translateX(2px); }
.xw-nav-link.active { color: #145f49; background: #e4f1e9; font-weight: 700; }
.xw-nav-icon { display: grid; flex: 0 0 22px; place-items: center; width: 22px; height: 22px; color: #36745d; font-size: 17px; font-weight: 700; }
.xw-nav-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.xw-sidebar-foot { margin-top: auto; padding: 12px 7px 0; border-top: 1px solid #e4ece7; color: #8a9a92; font-size: 11px; }
.xw-main { display: flex; flex: 1 1 auto; flex-direction: column; min-width: 0; min-height: 0; background: #fff; }
.xw-header { flex: none; min-height: 58px; }
.xw-header-mark { display: none; }
.xw-header-copy small { font-size: 12px; }
.xw-content { display: flex; flex-direction: column; flex: 1 1 auto; gap: 12px; min-height: 0; overflow: hidden; padding: 18px 22px; }
.xw-transcript { flex: 1 1 auto; min-height: 0; overflow: auto; overscroll-behavior: contain; scrollbar-gutter: stable; }
.xw-message { max-width: min(84%, 680px); padding: 11px 14px; font-size: 14px; line-height: 1.55; }
.xw-video-message { width: min(100%, 420px); }
.xw-video-player { max-height: 36vh; }
.xw-chips { flex: none; padding: 10px 18px 6px; }
.xw-chip { padding: 7px 11px; font-size: 12px; }
.xw-compose { flex: none; align-items: center; padding: 10px 18px 16px; }
.xw-compose textarea { min-height: 50px; max-height: 22dvh; padding: 12px 14px; border-radius: 14px; }
.xw-send { min-width: 68px; height: 42px; border-radius: 11px; }
.xw-expand { font-size: 12px; }
.xw-nav-link:focus-visible, .xw-expand:focus-visible, .xw-close:focus-visible { outline: 3px solid #438b72; outline-offset: 2px; }
.xw-expanded .xw-video-player { max-height: 48vh; }

@keyframes xw-bob { 0%, 100% { transform: translateY(0) rotate(0); } 25% { transform: translateY(-2px) rotate(-1deg); } 72% { transform: translateY(-5px) rotate(1deg); } }
@keyframes xw-arm-swing { 0%, 100% { transform: rotate(24deg); } 50% { transform: rotate(40deg); } }
@keyframes xw-wave { 0%, 72%, 100% { transform: rotate(-24deg); } 78% { transform: rotate(-78deg); } 84% { transform: rotate(-36deg); } 90% { transform: rotate(-74deg); } }
@keyframes xw-wave-fast { 0%, 100% { transform: rotate(-24deg); } 50% { transform: rotate(-82deg); } }
@keyframes xw-step-left { 0%, 100% { transform: rotate(7deg) translateY(0); } 50% { transform: rotate(-12deg) translateY(-2px); } }
@keyframes xw-step-right { 0%, 100% { transform: rotate(-7deg) translateY(-2px); } 50% { transform: rotate(12deg) translateY(0); } }
@keyframes xw-work-bob { 0%, 100% { transform: translateY(0) rotate(-2deg); } 50% { transform: translateY(-4px) rotate(2deg); } }
@keyframes xw-antenna-glow { 0%, 100% { box-shadow: 0 0 0 1px #28765e; } 50% { box-shadow: 0 0 0 2px #28765e, 0 0 9px #f4b35f; } }

@media (max-width: 760px) {
  .xw-launcher { right: max(8px, env(safe-area-inset-right)); bottom: max(10px, env(safe-area-inset-bottom)); transform: scale(.88); transform-origin: right bottom; }
  .xw-launcher[data-role="creator"] { bottom: max(76px, calc(env(safe-area-inset-bottom) + 66px)); }
  .xw-panel,
  .xw-panel.xw-expanded {
    right: max(8px, env(safe-area-inset-right));
    bottom: max(132px, calc(env(safe-area-inset-bottom) + 118px));
    width: min(calc(100vw - 16px), 620px);
    height: min(74dvh, calc(100dvh - 158px));
    min-height: 0;
    border-radius: 15px;
  }
  .xw-panel[data-role="creator"],
  .xw-panel[data-role="creator"].xw-expanded {
    bottom: max(198px, calc(env(safe-area-inset-bottom) + 182px));
    height: min(69dvh, calc(100dvh - 224px));
  }
  .xw-sidebar { flex-basis: 104px; padding: 12px 7px; }
  .xw-sidebar-brand { justify-content: center; padding: 2px 0 12px; }
  .xw-sidebar-mark { flex-basis: 32px; width: 32px; height: 32px; border-radius: 11px; }
  .xw-sidebar-copy { display: none; }
  .xw-shortcuts { gap: 3px; }
  .xw-nav-link { flex-direction: column; gap: 2px; min-height: 50px; justify-content: center; padding: 5px 2px; text-align: center; }
  .xw-nav-link:hover { transform: none; }
  .xw-nav-icon { flex-basis: auto; height: 19px; font-size: 16px; }
  .xw-nav-label { max-width: 100%; white-space: normal; font-size: 10px; line-height: 1.2; }
  .xw-sidebar-foot { padding: 9px 0 0; text-align: center; font-size: 9px; }
  .xw-header { gap: 7px; padding: 9px 10px; }
  .xw-header-copy small { font-size: 10px; }
  .xw-new, .xw-expand { padding: 6px 7px; font-size: 10px; white-space: nowrap; }
  .xw-close { flex: 0 0 30px; width: 30px; height: 30px; }
  .xw-content { padding: 12px 10px; }
  .xw-message { max-width: 96%; padding: 9px 10px; font-size: 13px; }
  .xw-chips { gap: 5px; padding: 8px 9px 4px; }
  .xw-chip { padding: 5px 8px; font-size: 10px; }
  .xw-compose { gap: 6px; padding: 8px 9px 10px; }
  .xw-compose textarea { min-height: 42px; padding: 9px 10px; }
  .xw-send { min-width: 52px; height: 38px; padding: 0 7px; font-size: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  .xw-robot, .xw-antenna::after, .xw-arm, .xw-leg { animation: none !important; }
}

