:root {
  --lg-assistant-accent: #a83232;
  --lg-assistant-accent-strong: #8d2727;
  --lg-assistant-paper: #fffdf9;
  --lg-assistant-paper-raised: #ffffff;
  --lg-assistant-ink: #282321;
  --lg-assistant-muted: #746b66;
  --lg-assistant-line: rgba(74, 54, 47, 0.13);
  --lg-assistant-wash: #f5f0e9;
  --lg-assistant-shadow: 0 28px 80px rgba(48, 31, 25, 0.18),
    0 6px 24px rgba(48, 31, 25, 0.1);
}

.dark {
  --lg-assistant-paper: #1c1918;
  --lg-assistant-paper-raised: #24201f;
  --lg-assistant-ink: #f2ece7;
  --lg-assistant-muted: #aaa09a;
  --lg-assistant-line: rgba(255, 242, 232, 0.11);
  --lg-assistant-wash: #2b2624;
  --lg-assistant-shadow: 0 30px 90px rgba(0, 0, 0, 0.5),
    0 8px 26px rgba(0, 0, 0, 0.28);
}

.lg-assistant-root,
.lg-assistant-root * {
  box-sizing: border-box;
}

.lg-assistant-root {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 9998;
  font-family: MiSans, "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--lg-assistant-ink);
}

.lg-assistant-trigger {
  position: relative;
  display: flex;
  min-width: 124px;
  height: 54px;
  align-items: center;
  gap: 10px;
  padding: 6px 15px 6px 7px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 19px;
  color: #fff;
  background: linear-gradient(145deg, #b33d37 0%, #9c2d2d 58%, #842626 100%);
  box-shadow: 0 13px 32px rgba(142, 39, 39, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.19);
  cursor: pointer;
  transition: transform 180ms ease, box-shadow 180ms ease, filter 180ms ease;
}

.lg-assistant-trigger::after {
  position: absolute;
  inset: -5px;
  border: 1px solid rgba(168, 50, 50, 0.16);
  border-radius: 23px;
  content: "";
  pointer-events: none;
}

.lg-assistant-trigger:hover {
  transform: translateY(-2px);
  filter: saturate(1.06);
  box-shadow: 0 17px 38px rgba(142, 39, 39, 0.34),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.lg-assistant-trigger:focus-visible,
.lg-assistant-close:focus-visible,
.lg-assistant-send:focus-visible,
.lg-assistant-suggestion:focus-visible,
.lg-assistant-source:focus-visible {
  outline: 3px solid rgba(193, 72, 72, 0.35);
  outline-offset: 3px;
}

.lg-assistant-trigger-icon {
  display: grid;
  width: 39px;
  height: 39px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 14px;
  color: #8f2929;
  background: rgba(255, 253, 249, 0.94);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.7);
}

.lg-assistant-trigger-icon svg,
.lg-assistant-avatar svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 0;
}

.lg-assistant-trigger-label {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.08;
}

.lg-assistant-trigger-label b {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.lg-assistant-trigger-label small {
  margin-top: 4px;
  color: rgba(255, 255, 255, 0.7);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.lg-assistant-panel {
  position: absolute;
  right: 0;
  bottom: 68px;
  display: grid;
  width: min(410px, calc(100vw - 32px));
  height: min(660px, calc(100vh - 112px));
  min-height: 480px;
  min-width: 360px;
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
  border: 1px solid var(--lg-assistant-line);
  border-radius: 25px;
  background: var(--lg-assistant-paper);
  box-shadow: var(--lg-assistant-shadow);
  opacity: 0;
  transform: translateY(12px) scale(0.975);
  transform-origin: right bottom;
  transition: opacity 180ms ease, transform 220ms cubic-bezier(0.22, 0.8, 0.24, 1);
}

.lg-assistant-panel.is-resizing {
  transition: none;
  user-select: none;
}

.lg-assistant-resizing,
.lg-assistant-resizing * {
  user-select: none !important;
}

.lg-assistant-resize-handle {
  position: absolute;
  z-index: 6;
  touch-action: none;
}

.lg-assistant-resize-handle--left {
  top: 20px;
  bottom: 20px;
  left: 0;
  width: 8px;
  cursor: ew-resize;
}

.lg-assistant-resize-handle--top {
  top: 0;
  right: 20px;
  left: 20px;
  height: 8px;
  cursor: ns-resize;
}

.lg-assistant-resize-handle--top-left {
  top: 0;
  left: 0;
  width: 24px;
  height: 24px;
  cursor: nwse-resize;
}

.lg-assistant-resize-handle--top-left::after {
  position: absolute;
  top: 7px;
  left: 7px;
  width: 8px;
  height: 8px;
  border-top: 1.5px solid color-mix(in srgb, var(--lg-assistant-muted) 48%, transparent);
  border-left: 1.5px solid color-mix(in srgb, var(--lg-assistant-muted) 48%, transparent);
  border-radius: 2px 0 0;
  content: "";
  opacity: 0.65;
  transition: opacity 150ms ease, transform 150ms ease;
}

.lg-assistant-resize-handle--top-left:hover::after,
.lg-assistant-resize-handle--top-left:focus-visible::after {
  opacity: 1;
  transform: translate(-1px, -1px);
}

.lg-assistant-resize-handle:focus-visible {
  outline: 2px solid rgba(193, 72, 72, 0.45);
  outline-offset: -2px;
}

.lg-assistant-panel[hidden] {
  display: none;
}

.lg-assistant-panel::before {
  position: absolute;
  top: -90px;
  right: -65px;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(168, 50, 50, 0.11), transparent 68%);
  content: "";
  pointer-events: none;
}

.lg-assistant-panel.is-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.lg-assistant-header {
  position: relative;
  z-index: 1;
  display: flex;
  height: 74px;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  border-bottom: 1px solid var(--lg-assistant-line);
  background: color-mix(in srgb, var(--lg-assistant-paper) 88%, transparent);
  backdrop-filter: blur(18px);
}

.lg-assistant-header-actions {
  display: flex;
  align-items: center;
  gap: 7px;
}

.lg-assistant-quota {
  padding: 5px 8px;
  border: 1px solid color-mix(in srgb, var(--lg-assistant-accent) 16%, var(--lg-assistant-line));
  border-radius: 8px;
  color: var(--lg-assistant-accent);
  background: color-mix(in srgb, var(--lg-assistant-accent) 5%, transparent);
  font-size: 9px;
  font-weight: 700;
  white-space: nowrap;
}

.lg-assistant-identity {
  display: flex;
  align-items: center;
  gap: 11px;
}

.lg-assistant-avatar {
  display: grid;
  width: 39px;
  height: 39px;
  place-items: center;
  border-radius: 14px 14px 14px 5px;
  color: #fff;
  background: var(--lg-assistant-accent);
  box-shadow: 0 8px 20px rgba(168, 50, 50, 0.22);
}

.lg-assistant-title {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.lg-assistant-title strong {
  color: var(--lg-assistant-ink);
  font-size: 14.5px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.lg-assistant-title span {
  color: var(--lg-assistant-muted);
  font-size: 10.5px;
}

.lg-assistant-close {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 0;
  border-radius: 11px;
  color: var(--lg-assistant-muted);
  background: transparent;
  cursor: pointer;
  transition: color 150ms ease, background 150ms ease;
}

.lg-assistant-close:hover {
  color: var(--lg-assistant-ink);
  background: var(--lg-assistant-wash);
}

.lg-assistant-close svg,
.lg-assistant-send svg,
.lg-assistant-source-arrow svg,
.lg-assistant-welcome-mark svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.lg-assistant-conversation {
  position: relative;
  min-height: 0;
  overflow: hidden;
}

.lg-assistant-messages {
  position: absolute;
  inset: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 18px 16px 26px;
  scrollbar-color: rgba(120, 99, 89, 0.25) transparent;
  scrollbar-width: thin;
}

.lg-assistant-welcome {
  position: absolute;
  z-index: 2;
  inset: 0;
  display: flex;
  overflow-y: auto;
  flex-direction: column;
  align-items: center;
  padding: 48px 28px 24px;
  text-align: center;
}

.lg-assistant-welcome[hidden] {
  display: none;
}

.lg-assistant-welcome-mark {
  display: grid;
  width: 51px;
  height: 51px;
  place-items: center;
  border: 1px solid rgba(168, 50, 50, 0.18);
  border-radius: 19px 19px 19px 7px;
  color: var(--lg-assistant-accent);
  background: color-mix(in srgb, var(--lg-assistant-accent) 7%, var(--lg-assistant-paper));
}

.lg-assistant-welcome h2 {
  margin: 18px 0 7px;
  color: var(--lg-assistant-ink);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.lg-assistant-welcome > p {
  max-width: 310px;
  margin: 0;
  color: var(--lg-assistant-muted);
  font-size: 12.5px;
  line-height: 1.7;
}

.lg-assistant-suggestions {
  display: flex;
  width: 100%;
  flex-direction: column;
  gap: 8px;
  margin-top: 27px;
}

.lg-assistant-login-nudge {
  margin-top: 13px;
  padding: 7px 10px;
  border: 0;
  color: var(--lg-assistant-accent);
  background: transparent;
  font: inherit;
  font-size: 10px;
  font-weight: 650;
  cursor: pointer;
}

.lg-assistant-login-nudge:hover { text-decoration: underline; }
.lg-assistant-login-nudge[hidden] { display: none; }

.lg-assistant-suggestion {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--lg-assistant-line);
  border-radius: 12px;
  color: var(--lg-assistant-ink);
  background: var(--lg-assistant-paper-raised);
  font: inherit;
  font-size: 12px;
  text-align: left;
  cursor: pointer;
  transition: border-color 150ms ease, color 150ms ease, transform 150ms ease,
    background 150ms ease;
}

.lg-assistant-suggestion::before {
  margin-right: 8px;
  color: var(--lg-assistant-accent);
  content: "↗";
}

.lg-assistant-suggestion:hover {
  border-color: rgba(168, 50, 50, 0.3);
  color: var(--lg-assistant-accent);
  background: color-mix(in srgb, var(--lg-assistant-accent) 4%, var(--lg-assistant-paper));
  transform: translateX(2px);
}

.lg-assistant-message-row {
  display: flex;
  margin: 0 0 13px;
}

.lg-assistant-message-row--user {
  justify-content: flex-end;
}

.lg-assistant-message-row--assistant {
  justify-content: flex-start;
}

.lg-assistant-message {
  max-width: 91%;
  font-size: 12.5px;
  line-height: 1.72;
}

.lg-assistant-message--user {
  max-width: 82%;
  padding: 10px 13px;
  border-radius: 15px 15px 5px 15px;
  color: #fff;
  background: var(--lg-assistant-accent);
  box-shadow: 0 5px 16px rgba(168, 50, 50, 0.15);
}

.lg-assistant-message--assistant {
  padding: 13px 14px;
  border: 1px solid var(--lg-assistant-line);
  border-radius: 5px 16px 16px 16px;
  color: var(--lg-assistant-ink);
  background: var(--lg-assistant-paper-raised);
  box-shadow: 0 4px 16px rgba(56, 39, 32, 0.045);
}

.lg-assistant-message-body {
  overflow-wrap: anywhere;
}

.lg-assistant-message-row--user .lg-assistant-message-body { white-space: pre-wrap; }
.lg-assistant-message-body > :first-child { margin-top: 0; }
.lg-assistant-message-body > :last-child { margin-bottom: 0; }
.lg-assistant-message-body p { margin: 0.48em 0; }
.lg-assistant-message-body h1,
.lg-assistant-message-body h2,
.lg-assistant-message-body h3,
.lg-assistant-message-body h4 {
  margin: 0.9em 0 0.38em;
  color: inherit;
  font-weight: 760;
  line-height: 1.35;
}
.lg-assistant-message-body h1 { font-size: 1.24em; }
.lg-assistant-message-body h2 { font-size: 1.16em; }
.lg-assistant-message-body h3,
.lg-assistant-message-body h4 { font-size: 1.06em; }
.lg-assistant-message-body ul,
.lg-assistant-message-body ol { margin: 0.58em 0; padding-left: 1.6em; }
.lg-assistant-message-body li { margin: 0.26em 0; padding-left: 0.15em; }
.lg-assistant-message-body strong { font-weight: 760; }
.lg-assistant-message-body a {
  color: var(--lg-assistant-accent);
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--lg-assistant-accent) 35%, transparent);
  text-underline-offset: 2px;
}
.lg-assistant-message-body code {
  padding: 0.12em 0.34em;
  border: 1px solid var(--lg-assistant-line);
  border-radius: 5px;
  background: var(--lg-assistant-wash);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.88em;
}
.lg-assistant-message-body pre {
  overflow-x: auto;
  margin: 0.7em 0;
  padding: 11px 12px;
  border: 1px solid var(--lg-assistant-line);
  border-radius: 10px;
  background: var(--lg-assistant-wash);
  line-height: 1.55;
}
.lg-assistant-message-body pre code { padding: 0; border: 0; background: transparent; }
.lg-assistant-message-body blockquote {
  margin: 0.7em 0;
  padding: 0.2em 0 0.2em 0.9em;
  border-left: 3px solid color-mix(in srgb, var(--lg-assistant-accent) 55%, transparent);
  color: var(--lg-assistant-muted);
}
.lg-assistant-message-body table {
  width: 100%;
  margin: 0.75em 0;
  border-collapse: collapse;
  font-size: 0.92em;
}
.lg-assistant-message-body th,
.lg-assistant-message-body td { padding: 6px 7px; border: 1px solid var(--lg-assistant-line); text-align: left; }
.lg-assistant-message-body th { background: var(--lg-assistant-wash); }

.lg-assistant-sources {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-top: 13px;
  padding-top: 12px;
  border-top: 1px solid var(--lg-assistant-line);
}

.lg-assistant-sources-label {
  color: var(--lg-assistant-muted);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.lg-assistant-source {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) 16px;
  gap: 8px;
  align-items: center;
  padding: 8px;
  border-radius: 10px;
  color: inherit;
  text-decoration: none;
  transition: background 150ms ease, transform 150ms ease;
}

.lg-assistant-source:hover {
  background: var(--lg-assistant-wash);
  transform: translateX(2px);
}

.lg-assistant-source-number {
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  border-radius: 7px;
  color: var(--lg-assistant-accent);
  background: color-mix(in srgb, var(--lg-assistant-accent) 9%, transparent);
  font-size: 9.5px;
  font-weight: 700;
}

.lg-assistant-source-copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 2px;
}

.lg-assistant-source-title {
  overflow: hidden;
  color: var(--lg-assistant-ink);
  font-size: 11px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lg-assistant-source-snippet {
  overflow: hidden;
  color: var(--lg-assistant-muted);
  font-size: 9.5px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lg-assistant-source-arrow {
  display: grid;
  color: var(--lg-assistant-muted);
  place-items: center;
}

.lg-assistant-source-arrow svg {
  width: 14px;
  height: 14px;
  stroke-width: 1.7;
}

.lg-assistant-typing {
  display: flex;
  gap: 4px;
  align-items: center;
  min-width: 56px;
  min-height: 40px;
}

.lg-assistant-typing i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--lg-assistant-accent);
  animation: lg-assistant-dot 1.05s ease-in-out infinite;
}

.lg-assistant-typing i:nth-child(2) {
  animation-delay: 120ms;
}

.lg-assistant-typing i:nth-child(3) {
  animation-delay: 240ms;
}

@keyframes lg-assistant-dot {
  0%,
  60%,
  100% {
    opacity: 0.28;
    transform: translateY(0);
  }
  30% {
    opacity: 1;
    transform: translateY(-3px);
  }
}

.lg-assistant-composer-wrap {
  position: relative;
  z-index: 2;
  padding: 12px 13px 11px;
  border-top: 1px solid var(--lg-assistant-line);
  background: color-mix(in srgb, var(--lg-assistant-paper) 92%, transparent);
  backdrop-filter: blur(18px);
}

.lg-assistant-composer {
  display: flex;
  min-height: 47px;
  align-items: flex-end;
  gap: 8px;
  padding: 6px 6px 6px 13px;
  border: 1px solid var(--lg-assistant-line);
  border-radius: 15px;
  background: var(--lg-assistant-paper-raised);
  box-shadow: inset 0 1px 2px rgba(47, 33, 27, 0.025);
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.lg-assistant-composer:focus-within {
  border-color: rgba(168, 50, 50, 0.38);
  box-shadow: 0 0 0 3px rgba(168, 50, 50, 0.07);
}

.lg-assistant-input {
  width: 100%;
  min-height: 32px;
  max-height: 112px;
  resize: none;
  overflow-y: auto;
  border: 0;
  outline: 0;
  color: var(--lg-assistant-ink);
  background: transparent;
  font: inherit;
  font-size: 12.5px;
  line-height: 1.55;
}

.lg-assistant-input::placeholder {
  color: color-mix(in srgb, var(--lg-assistant-muted) 72%, transparent);
}

.lg-assistant-send {
  display: grid;
  width: 35px;
  height: 35px;
  flex: 0 0 auto;
  place-items: center;
  border: 0;
  border-radius: 11px;
  color: #fff;
  background: var(--lg-assistant-accent);
  cursor: pointer;
  transition: transform 150ms ease, background 150ms ease, opacity 150ms ease;
}

.lg-assistant-send:hover:not(:disabled) {
  background: var(--lg-assistant-accent-strong);
  transform: translateY(-1px);
}

.lg-assistant-send:disabled {
  cursor: wait;
  opacity: 0.42;
}

.lg-assistant-disclaimer {
  margin-top: 7px;
  color: var(--lg-assistant-muted);
  font-size: 9px;
  text-align: center;
}

@media (max-width: 640px) {
  .lg-assistant-root {
    right: 14px;
    bottom: 14px;
  }

  .lg-assistant-trigger {
    min-width: 52px;
    width: 52px;
    height: 52px;
    padding: 6px;
    border-radius: 18px;
  }

  .lg-assistant-trigger-label {
    display: none;
  }

  .lg-assistant-panel {
    position: fixed;
    right: 8px;
    bottom: 8px;
    width: calc(100vw - 16px);
    height: min(720px, calc(100dvh - 16px));
    min-height: 0;
    min-width: 0;
    border-radius: 24px;
    transform-origin: center bottom;
  }

  html[data-banner-state="visible"] .lg-assistant-panel {
    height: min(720px, calc(100dvh - var(--banner-height, 2.5rem) - 16px));
  }

  .lg-assistant-resize-handle { display: none; }

  .lg-assistant-quota { display: none; }

  .lg-assistant-open {
    overflow: hidden;
  }

  .lg-assistant-open .lg-assistant-trigger {
    visibility: hidden;
  }

  .lg-assistant-message {
    max-width: 94%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .lg-assistant-panel,
  .lg-assistant-trigger,
  .lg-assistant-suggestion,
  .lg-assistant-source,
  .lg-assistant-send {
    transition: none !important;
  }

  .lg-assistant-typing i {
    animation: none;
    opacity: 0.65;
  }
}

@media print {
  .lg-assistant-root {
    display: none !important;
  }
}
