.jg-chat, .jg-chat *, .jg-chat *::before, .jg-chat *::after { box-sizing: border-box; }
.jg-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.jg-chat { position: fixed; right: 16px; bottom: 16px; z-index: 90; font-family: Inter, system-ui, sans-serif; }
.jg-chat-open {
  position: relative;
  width: 60px;
  height: 60px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #171512;
  cursor: pointer;
  box-shadow: 0 0 0 1px rgba(212, 175, 122, 0.45), 0 12px 30px rgba(12, 11, 10, 0.45);
  animation: jg-breathe 7.5s ease-in-out infinite;
}
.jg-chat-mark {
  position: absolute;
  right: 72px;
  top: 50%;
  transform: translateY(-50%);
  color: #D4AF7A;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  white-space: nowrap;
  text-shadow: 0 0 12px rgba(212, 175, 122, 0.45);
  pointer-events: none;
}
.jg-chat.is-open .jg-chat-mark { display: none; }
.jg-chat-open img, .jg-chat-face {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}
.jg-chat-open::after {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 1px solid rgba(212, 175, 122, 0.28);
  animation: jg-pulse 7.5s ease-in-out infinite;
  pointer-events: none;
}
.jg-chat-open:focus-visible, .jg-chat-new:focus-visible, .jg-chat-x:focus-visible, .jg-chat-form button:focus-visible,
.jg-chat-chips button:focus-visible, .jg-chat-log a:focus-visible, .jg-chat-form input:focus-visible {
  outline: 2px solid #D4AF7A;
  outline-offset: 2px;
}
.jg-chat-panel {
  position: absolute;
  right: 0;
  bottom: 72px;
  width: min(360px, calc(100vw - 32px));
  max-height: min(560px, calc(100dvh - 110px));
  display: flex;
  flex-direction: column;
  background: #141210;
  color: #F0EDE6;
  border: 1px solid rgba(212, 175, 122, 0.35);
  border-radius: 20px;
  box-shadow: 0 24px 60px rgba(12, 11, 10, 0.5);
  overflow: hidden;
  transform-origin: 90% 100%;
  animation: jg-pop 0.38s cubic-bezier(0.16, 1, 0.3, 1);
}
.jg-chat-panel[hidden] { display: none; }
.jg-chat-head {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  column-gap: 8px;
  align-items: center;
  padding: 10px 12px 8px;
  border-bottom: 1px solid rgba(240, 237, 230, 0.08);
}
.jg-chat-face { grid-column: 1; width: 48px; height: 48px; box-shadow: none; }
.jg-chat-face[data-mood="glad"] { box-shadow: 0 0 0 1px #D4AF7A, 0 0 16px rgba(212, 175, 122, 0.55); }
.jg-chat-face[data-mood="think"] { animation: jg-nod 1.4s ease-in-out infinite; }
.jg-chat-face[data-mood="sorry"] { filter: saturate(0.7); }
.jg-chat-id { grid-column: 2; min-width: 0; }
.jg-chat-head h2 { margin: 0; font-family: Inter, system-ui, sans-serif; font-size: 18px; font-weight: 600; line-height: 1.2; }
.jg-chat-head p { margin: 2px 0 0; color: #A39E94; font-size: 12px; font-weight: 500; line-height: 1.35; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.jg-chat-tools { grid-column: 3; justify-self: end; display: flex; align-items: center; gap: 6px; }
.jg-chat-new[hidden] { display: none !important; }
.jg-chat-new, .jg-chat-x {
  min-height: 44px;
  min-width: 44px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(240, 237, 230, 0.38);
  background: transparent;
  color: #F0EDE6;
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  line-height: 1.2;
}
.jg-chat-log {
  flex: 1;
  overflow: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.jg-msg { max-width: 92%; }
.jg-msg p { margin: 0 0 8px; line-height: 1.45; font-size: 14.5px; }
.jg-msg-sheet { align-self: stretch; max-width: 100%; }
.jg-msg-h {
  margin: 2px 0 8px;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: #E8C592;
}
.jg-msg-h + .jg-msg-h { margin-top: 12px; }
.jg-msg-list {
  margin: 0 0 10px;
  padding: 0 4px 0 1.15em;
  text-align: left;
}
.jg-msg-list li {
  margin: 0 0 4px;
  font-size: 14.5px;
  line-height: 1.4;
}
.jg-msg-list li:last-child { margin-bottom: 0; }
.jg-msg-bot {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  align-self: flex-start;
  max-width: 100%;
}
.jg-msg-ava {
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  margin-top: 1px;
  border-radius: 50%;
  object-fit: cover;
}
.jg-msg-body { min-width: 0; flex: 1; }
.jg-msg-me { align-self: flex-end; background: rgba(212, 175, 122, 0.16); border-radius: 14px 14px 4px 14px; padding: 8px 10px; }
.jg-msg-me p { margin: 0; }
.jg-msg-links { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; }
.jg-msg-links a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: #1a140c;
  background: #D4AF7A;
  text-decoration: none;
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 600;
}
.jg-typing { display: flex; gap: 5px; padding: 4px 0; }
.jg-typing i {
  width: 7px; height: 7px; border-radius: 50%; background: #D4AF7A;
  animation: jg-dot 1s ease-in-out infinite;
}
.jg-typing i:nth-child(2) { animation-delay: 0.15s; }
.jg-typing i:nth-child(3) { animation-delay: 0.3s; }
.jg-chat-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 12px 10px; }
.jg-chat-chips:empty { display: none; }
.jg-chat-chips button, .jg-chat-form button {
  min-height: 44px;
  border-radius: 999px;
  border: 1px solid rgba(212, 175, 122, 0.75);
  background: transparent;
  color: #F0EDE6;
  padding: 8px 12px;
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  line-height: 1.3;
  white-space: normal;
}
.jg-chat-form { display: flex; gap: 8px; padding: 0 12px 12px; align-items: center; }
.jg-chat-form input {
  flex: 1;
  min-width: 0;
  min-height: 44px;
  border-radius: 12px;
  border: 1px solid rgba(240, 237, 230, 0.55);
  background: #0C0B0A;
  color: #F0EDE6;
  padding: 8px 12px;
  font: inherit;
  font-size: 15px;
}
.jg-chat-form input::placeholder { color: #C4BEB4; opacity: 1; }
.jg-chat-form button { flex-shrink: 0; background: #D4AF7A; color: #1a140c; border-color: #D4AF7A; font-weight: 700; }
html.theme-light .jg-chat-open { background: #fffaf4; }
html.theme-light .jg-chat-panel { background: #fffaf4; color: #211c17; }
html.theme-light .jg-chat-new, html.theme-light .jg-chat-x,
html.theme-light .jg-chat-chips button { color: #211c17; border-color: rgba(33, 28, 23, 0.28); }
html.theme-light .jg-chat-form input { background: #fff; color: #211c17; border-color: rgba(33, 28, 23, 0.2); }
html.theme-light .jg-chat-form input::placeholder { color: #6e6256; }
@keyframes jg-pop {
  from { opacity: 0; transform: translateY(10px) scale(0.96); }
  to { opacity: 1; transform: none; }
}
@keyframes jg-pulse {
  0%, 100% { opacity: 0.2; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(1.015); }
}
@keyframes jg-breathe {
  0%, 100% { transform: scale(1); box-shadow: 0 0 0 1px rgba(212, 175, 122, 0.3), 0 8px 22px rgba(12, 11, 10, 0.4); }
  50% { transform: scale(1.015); box-shadow: 0 0 0 1px rgba(212, 175, 122, 0.42), 0 0 8px rgba(212, 175, 122, 0.08); }
}
@keyframes jg-nod {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-2px); }
}
@keyframes jg-dot {
  0%, 100% { opacity: 0.3; transform: translateY(0); }
  50% { opacity: 1; transform: translateY(-3px); }
}
@media (max-width: 640px) {
  .jg-chat { right: 12px; bottom: 12px; }
  .jg-chat-mark { letter-spacing: 0.12em; right: 68px; font-size: 11px; }
  .jg-chat-panel { width: calc(100vw - 24px); right: 0; max-height: min(560px, calc(100dvh - 96px)); }
  .jg-chat-head { padding: 10px 12px 8px; column-gap: 8px; }
}
@media (prefers-reduced-motion: reduce) {
  .jg-chat-open, .jg-chat-open::after, .jg-chat-face, .jg-typing i, .jg-chat-panel { animation: none; }
}
