/* A quiet, living voice: moving light inside a steady, draggable target. */
#tingjian-assistant-launcher {
  position: fixed;
  right: 24px;
  bottom: 28px;
  z-index: 1001;
  display: block;
  width: 56px;
  height: 56px;
  padding: 0;
  box-sizing: border-box;
  border: 0;
  border-radius: 50%;
  overflow: visible;
  -webkit-appearance: none;
  appearance: none;
  -webkit-tap-highlight-color: transparent;
  background: transparent;
  touch-action: none;
  user-select: none;
  cursor: grab;
  isolation: isolate;
}
#tingjian-assistant-launcher::before,
#tingjian-assistant-launcher::after {
  content: "";
  position: absolute;
  pointer-events: none;
  border-radius: 50%;
  z-index: -1;
}
#tingjian-assistant-launcher::before {
  inset: -5px;
  border: 1px solid #6f8d985c;
  animation:
    tingjian-orb-breathe 4.8s ease-in-out infinite,
    tingjian-orb-surf 13.7s ease-in-out -4.1s infinite;
}
#tingjian-assistant-launcher::after {
  inset: -12px;
  background: radial-gradient(circle, #8aa3a34d, #8aa3a300 70%);
  animation: tingjian-orb-breathe 4.8s ease-in-out -1s infinite;
}
#tingjian-assistant-launcher .tingjian-assistant-mark {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  overflow: hidden;
  animation: tingjian-orb-surf 11.3s ease-in-out infinite;
  isolation: isolate;
  background: radial-gradient(
    circle at 30% 20%,
    #f5e8c9 0%,
    #b9c9c3 32%,
    #7296a4 66%,
    #355c74 100%
  );
  box-shadow:
    inset 0 1px 1px #fff3d6b8,
    inset -2px -4px 8px #1c3e5766,
    0 6px 16px #244c6738;
  transform: translateZ(0);
  transition:
    transform 240ms ease,
    box-shadow 240ms ease,
    filter 240ms ease;
}
.tingjian-assistant-mark > span {
  position: absolute;
  pointer-events: none;
}
.tingjian-orb-aurora {
  inset: -35%;
  background:
    radial-gradient(ellipse at 30% 30%, #f5e8c9cc, transparent 42%),
    radial-gradient(ellipse at 75% 65%, #8bb1b6c7, transparent 46%);
  opacity: 0.86;
  animation: tingjian-orb-tide 9s ease-in-out infinite;
}
.tingjian-orb-ribbon {
  inset: 8% -16%;
  border-radius: 50%;
  border: 1px solid #f4e7c382;
  box-shadow:
    0 -4px 12px #c6d6b869,
    inset 0 3px 8px #cedbd649;
  transform: rotate(-32deg) scaleY(0.66);
  animation: tingjian-orb-current 5.4s ease-in-out infinite alternate;
}
#tingjian-assistant-launcher .tingjian-orb-brand {
  position: absolute;
  inset: 18%;
  width: 64%;
  height: 64%;
  pointer-events: none;
  filter: drop-shadow(0 1px 2px #143f5140);
}
.tingjian-orb-brand path {
  stroke: #fff4dc;
  transform-box: fill-box;
  transform-origin: center;
  animation: tingjian-orb-voice 3.2s ease-in-out infinite;
}
.tingjian-orb-brand .brand-voice-0 {
  animation-delay: -0.4s;
}
.tingjian-orb-brand .brand-voice-1 {
  animation-delay: -1.1s;
}
.tingjian-orb-brand .brand-voice-2 {
  animation-delay: -1.8s;
}
.tingjian-orb-brand .brand-voice-3 {
  animation-delay: -2.5s;
}
.tingjian-orb-brand circle {
  fill: #ddbd85;
}
.tingjian-orb-shine {
  inset: 0;
  border-radius: inherit;
  background:
    radial-gradient(ellipse at 36% 9%, #fff3d978, transparent 42%),
    radial-gradient(ellipse at 80% 95%, #83a5b154, transparent 45%);
}
/* The silhouette flows independently of the fixed pointer/drag target. */
@keyframes tingjian-orb-surf {
  0%,
  100% {
    border-radius: 43.25% 56.75% 47.3% 52.7% / 55.4% 42.35% 57.65% 44.6%;
  }
  13% {
    border-radius: 54.95% 45.05% 57.65% 42.35% / 45.95% 53.6% 46.4% 54.05%;
  }
  31% {
    border-radius: 46.4% 53.6% 41% 59% / 41.9% 56.3% 43.7% 58.1%;
  }
  46% {
    border-radius: 58.55% 41.45% 51.35% 48.65% / 53.15% 43.7% 56.3% 46.85%;
  }
  68% {
    border-radius: 41.45% 58.55% 55.4% 44.6% / 48.2% 58.55% 41.45% 51.8%;
  }
  79% {
    border-radius: 51.35% 48.65% 43.7% 56.3% / 58.1% 46.85% 53.15% 41.9%;
  }
  91% {
    border-radius: 55.85% 44.15% 53.6% 46.4% / 43.25% 51.8% 48.2% 56.75%;
  }
}
@keyframes tingjian-orb-surge {
  0%,
  100% {
    border-radius: 40.55% 59.45% 45.5% 54.5% / 57.65% 40.1% 59.9% 42.35%;
  }
  17% {
    border-radius: 58.1% 41.9% 59.9% 40.1% / 43.7% 55.4% 44.6% 56.3%;
  }
  38% {
    border-radius: 44.15% 55.85% 38.75% 61.25% / 40.1% 59% 41% 59.9%;
  }
  57% {
    border-radius: 60.8% 39.2% 53.15% 46.85% / 55.4% 41.45% 58.55% 44.6%;
  }
  73% {
    border-radius: 39.65% 60.35% 57.65% 42.35% / 45.95% 60.8% 39.2% 54.05%;
  }
  89% {
    border-radius: 54.05% 45.95% 41.45% 58.55% / 60.35% 44.6% 55.4% 39.65%;
  }
}
@keyframes tingjian-orb-breathe {
  0%,
  100% {
    transform: scale(0.94);
    opacity: 0.35;
  }
  50% {
    transform: scale(1.14);
    opacity: 0.8;
  }
}
@keyframes tingjian-orb-tide {
  0% {
    transform: rotate(0deg) scale(0.94);
  }
  50% {
    transform: rotate(180deg) scale(1.16);
  }
  100% {
    transform: rotate(360deg) scale(0.94);
  }
}
@keyframes tingjian-orb-current {
  from {
    transform: rotate(-38deg) translateY(15%) scaleY(0.55);
    border-radius: 42% 58% 54% 46%;
    opacity: 0.5;
  }
  to {
    transform: rotate(26deg) translateY(-15%) scaleY(1.08);
    border-radius: 56% 44% 42% 58%;
    opacity: 0.95;
  }
}
@keyframes tingjian-orb-voice {
  0%,
  100% {
    transform: scaleY(0.64);
    opacity: 0.88;
  }
  45% {
    transform: scaleY(1.15);
    opacity: 1;
  }
}
@media (hover: hover) {
  #tingjian-assistant-launcher:hover .tingjian-assistant-mark {
    animation-name: tingjian-orb-surge;
    animation-duration: 7.1s;
    transform: translateY(-4px) scale(1.13);
    filter: brightness(1.08);
    box-shadow:
      inset 0 1px 1px #fff3d6b8,
      inset -2px -4px 8px #1c3e5766,
      0 12px 26px #244c6752,
      0 0 18px #ddcda64d;
  }
}
@media (hover: hover) {
  #tingjian-assistant-launcher:hover::before {
    animation: tingjian-orb-surge 9.7s ease-in-out -2.3s infinite;
    transform: scale(1.2);
    opacity: 1;
    border-color: #c5b58d;
    box-shadow: 0 0 12px #c8b5864d;
  }
  #tingjian-assistant-launcher:hover::after {
    animation: none;
    transform: scale(1.25);
    opacity: 1;
  }
  #tingjian-assistant-launcher:hover .tingjian-orb-brand {
    filter: drop-shadow(0 0 3px #fff0cf85);
  }
}
#tingjian-assistant-launcher:active .tingjian-assistant-mark {
  transform: scale(0.94);
}
html[data-theme="dark"] #tingjian-assistant-launcher::before {
  border-color: #c0d6cc69;
}
html[data-theme="dark"] #tingjian-assistant-launcher .tingjian-assistant-mark {
  background: radial-gradient(
    circle at 30% 20%,
    #3d9aa9 0%,
    #22556e 30%,
    #152c50 65%,
    #0c182e 100%
  );
  box-shadow:
    inset 0 1px 1px #f4e8cd99,
    inset -2px -4px 8px #061b3d80,
    0 6px 20px #0004;
}
/* Night uses cool, submerged light throughout, not just a darker backdrop. */
html[data-theme="dark"] #tingjian-assistant-launcher .tingjian-orb-aurora {
  background:
    radial-gradient(ellipse at 28% 24%, #84e4dc7a, transparent 38%),
    radial-gradient(ellipse at 76% 70%, #507dd691, transparent 48%);
  opacity: 0.72;
}
html[data-theme="dark"] #tingjian-assistant-launcher .tingjian-orb-shine {
  background:
    radial-gradient(ellipse at 36% 9%, #b5f3ec52, transparent 35%),
    radial-gradient(ellipse at 80% 95%, #628bdd70, transparent 48%);
}
html[data-theme="dark"] #tingjian-assistant-launcher .tingjian-orb-ribbon {
  border-color: #94e6df7a;
  box-shadow:
    0 -4px 12px #5cbcd05c,
    inset 0 3px 8px #659bda59;
}
html[data-theme="dark"] #tingjian-assistant-launcher .tingjian-orb-brand path {
  stroke: #d4faf3;
}
html[data-theme="dark"]
  #tingjian-assistant-launcher
  .tingjian-orb-brand
  circle {
  fill: #75ded5;
}
html[data-theme="dark"] #tingjian-assistant-launcher::after {
  background: radial-gradient(circle, #48b6cc55, #306fa900 70%);
}
@media (hover: hover) {
  html[data-theme="dark"]
    #tingjian-assistant-launcher:hover
    .tingjian-assistant-mark {
    box-shadow:
      inset 0 1px 2px #abeee999,
      inset -2px -4px 8px #06152f80,
      0 12px 26px #04122480,
      0 0 22px #65d4e05c;
  }
  html[data-theme="dark"] #tingjian-assistant-launcher:hover::before {
    border-color: #81d9db;
    box-shadow: 0 0 12px #6ecbd866;
  }
  html[data-theme="dark"]
    #tingjian-assistant-launcher:hover
    .tingjian-orb-brand {
    filter: drop-shadow(0 0 3px #a2f2ed85);
  }
}
#tingjian-assistant-launcher.is-dragging *,
#tingjian-assistant-launcher.is-background *,
#tingjian-assistant-launcher.is-dragging::before,
#tingjian-assistant-launcher.is-dragging::after,
#tingjian-assistant-launcher.is-background::before,
#tingjian-assistant-launcher.is-background::after {
  animation-play-state: paused;
}
#tingjian-assistant-launcher[hidden],
#tingjian-assistant-panel[hidden] {
  display: none;
}
#tingjian-assistant-panel {
  position: fixed;
  right: 24px;
  bottom: 94px;
  z-index: 1002;
  width: min(390px, calc(100vw - 32px));
  height: min(600px, calc(100dvh - 118px));
  box-sizing: border-box;
  border: 1px solid var(--line, #ccd4ce);
  border-radius: 18px;
  overflow: hidden;
  background: var(--paper, #faf6eb);
  color: var(--ink, #244c67);
  box-shadow: 0 14px 55px #142e3d30;
  display: flex;
  flex-direction: column;
  text-align: left;
}
#tingjian-assistant-panel .tingjian-assistant-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex: none;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line, #ccd4ce);
  color: var(--ink, #244c67);
  font: 14px system-ui;
  background: var(--paper, #faf6eb);
  cursor: grab;
  touch-action: none;
  user-select: none;
}
#tingjian-assistant-panel .tingjian-assistant-header button {
  font: 23px system-ui;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink, #244c67);
  cursor: pointer;
  padding: 0 4px;
  min-width: 36px;
  min-height: 36px;
}
#tingjian-assistant-panel iframe {
  width: 100%;
  flex: 1;
  min-height: 0;
  border: 0;
  background: var(--paper, #faf6eb);
}
#tingjian-assistant-launcher:focus-visible,
#tingjian-assistant-panel button:focus-visible {
  outline: 2px solid var(--ink, #244c67);
  outline-offset: 3px;
}
#tingjian-assistant-launcher.is-dragging,
#tingjian-assistant-panel.is-dragging .tingjian-assistant-header {
  cursor: grabbing;
}
#tingjian-assistant-panel.is-dragging iframe {
  pointer-events: none;
}
.tingjian-assistant-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}
#tingjian-assistant-panel .tingjian-assistant-actions button:first-child {
  display: none;
  font-size: 13px;
}
@media (max-width: 700px) {
  #tingjian-assistant-launcher {
    right: 16px;
    bottom: max(128px, calc(env(safe-area-inset-bottom) + 120px));
    width: 50px;
    height: 50px;
    font-size: 12px;
  }
  #tingjian-assistant-panel {
    right: 8px;
    bottom: 0;
    width: calc(100vw - 16px);
    height: 64dvh;
    border-radius: 18px 18px 0 0;
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
  #tingjian-assistant-panel .tingjian-assistant-header {
    cursor: default;
  }
  #tingjian-assistant-panel .tingjian-assistant-actions button:first-child {
    display: block;
  }
  #tingjian-assistant-panel .tingjian-assistant-actions button {
    min-width: 44px;
    min-height: 44px;
  }
}
@media (prefers-reduced-motion: reduce) {
  #tingjian-assistant-launcher *,
  #tingjian-assistant-launcher::before,
  #tingjian-assistant-launcher::after {
    animation: none;
    transition: none;
  }
}

#tingjian-assistant-panel .tingjian-assistant-header {
  padding: 4px 10px;
}
#tingjian-assistant-panel .tingjian-assistant-resize {
  position: absolute;
  right: 6px;
  bottom: 4px;
  z-index: 2;
  width: 18px;
  height: 18px;
  min-height: 18px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  cursor: nwse-resize;
  touch-action: none;
}
#tingjian-assistant-panel .tingjian-assistant-resize::after {
  content: "";
  position: absolute;
  right: 4px;
  bottom: 4px;
  width: 7px;
  height: 7px;
  border-bottom-right-radius: 7px;
  border-right: 2px solid var(--ink, #244c67);
  border-bottom: 2px solid var(--ink, #244c67);
  opacity: 0.35;
}
#tingjian-assistant-panel.is-resizing iframe {
  pointer-events: none;
}
@media (max-width: 700px) {
  #tingjian-assistant-panel .tingjian-assistant-resize {
    display: none;
  }
}

@media (pointer: coarse) and (min-width: 701px) {
  #tingjian-assistant-panel .tingjian-assistant-resize {
    width: 32px;
    height: 32px;
  }
}

#tingjian-assistant-panel .tingjian-assistant-resize.is-left {
  left: 6px;
  right: auto;
  cursor: nesw-resize;
}
#tingjian-assistant-panel .tingjian-assistant-resize.is-left::after {
  left: 4px;
  right: auto;
  border-right: 0;
  border-left: 2px solid var(--ink, #244c67);
  border-bottom-right-radius: 0;
  border-bottom-left-radius: 7px;
}

@media (min-width: 701px) {
  #tingjian-assistant-panel {
    padding-bottom: 12px;
  }
}

/* Glass shell; the conversation remains a separate iframe. */
#tingjian-assistant-panel {
  --assistant-glass: #faf6ebe8;
  --assistant-edge: #ffffffb3;
  border: 1px solid var(--assistant-edge);
  border-radius: 24px;
  background: var(--assistant-glass);
  backdrop-filter: blur(24px) saturate(1.15);
  -webkit-backdrop-filter: blur(24px) saturate(1.15);
  box-shadow:
    0 24px 70px #193b492b,
    0 5px 18px #193b4914,
    inset 0 1px 0 #ffffffb3;
}
html[data-theme="dark"] #tingjian-assistant-panel {
  --assistant-glass: #172630eb;
  --assistant-edge: #b4d9e32b;
  box-shadow:
    0 24px 70px #030e1e66,
    0 5px 18px #030e1e33,
    inset 0 1px 0 #d4f4f012;
}
#tingjian-assistant-panel .tingjian-assistant-header {
  min-height: 42px;
  padding: 3px 12px;
  background: linear-gradient(120deg, #b7d5d014, transparent 65%);
  border-bottom: 1px solid var(--assistant-edge);
  font:
    600 14px system-ui,
    sans-serif;
  letter-spacing: 0.03em;
}
#tingjian-assistant-panel .tingjian-assistant-header button {
  min-width: 34px;
  min-height: 34px;
  padding: 0 4px;
  border-radius: 10px;
  font-size: 19px;
  font-weight: 300;
  opacity: 0.7;
  transition:
    background 0.2s,
    opacity 0.2s;
}
#tingjian-assistant-panel .tingjian-assistant-header button:hover {
  background: #8aafaa1a;
  opacity: 1;
}
#tingjian-assistant-panel iframe {
  background: transparent;
}
@media (max-width: 700px) {
  #tingjian-assistant-panel {
    border-radius: 24px 24px 0 0;
  }
}

#tingjian-assistant-panel .tingjian-assistant-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}
#tingjian-assistant-panel .tingjian-assistant-actions button:first-child {
  font-size: 11px;
}
#tingjian-assistant-panel .tingjian-assistant-header button:focus-visible {
  outline-offset: -2px;
  outline-width: 1px;
}

#tingjian-assistant-panel .tingjian-assistant-header {
  gap: 8px;
}
#tingjian-assistant-panel .tingjian-assistant-header strong {
  flex-shrink: 0;
}
#tingjian-assistant-panel .tingjian-assistant-expiry {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font:
    10px system-ui,
    sans-serif;
  opacity: 0.65;
  letter-spacing: 0;
}
#tingjian-assistant-panel .tingjian-assistant-expiry[hidden] {
  display: none;
}
#tingjian-assistant-panel .tingjian-assistant-actions {
  margin-left: auto;
  flex-shrink: 0;
}
#tingjian-assistant-panel.is-fullscreen {
  max-width: none;
  max-height: none;
  border: 0;
  border-radius: 0;
  padding: 0;
  background: var(--paper);
}
#tingjian-assistant-panel.is-fullscreen .tingjian-assistant-header,
#tingjian-assistant-panel.is-fullscreen .tingjian-assistant-resize {
  display: none;
}
#tingjian-assistant-panel.is-fullscreen iframe {
  border-radius: 0;
}
