.yg-chat {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  font-family: system-ui, Helvetica, sans-serif;
}

body > .yg-chat {
  position: fixed;
  right: 20px;
  bottom: 76px;
  z-index: 10000;
}

.yg-corner .yg-chat-panel {
  position: absolute;
  right: 0;
  bottom: calc(100% + 8px);
}

.yg-chat-toggle {
  width: 47px;
  height: 47px;
  border: 0;
  border-radius: 50%;
  background: #417586;
  color: #fff;
  font: 700 13px/1 system-ui, sans-serif;
  cursor: pointer;
}

.yg-chat-toggle:hover,
.yg-chat-toggle:focus-visible {
  background: #4c889b;
  outline: none;
}

.yg-chat.is-open .yg-chat-toggle {
  background: #2f5c6a;
}

.yg-chat-panel {
  width: min(360px, calc(100vw - 32px));
  max-height: min(520px, calc(100vh - 140px));
  display: flex;
  flex-direction: column;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(0, 0, 0, 0.2);
  border-radius: 14px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.28);
  overflow: hidden;
}

.yg-chat-panel[hidden] { display: none !important; }

.yg-chat-head {
  padding: 10px 12px 8px;
  background: #111;
  color: #ffe566;
}

.yg-chat-head strong { display: block; font-size: 14px; }
.yg-chat-head span { display: block; color: #ccc; font-size: 11px; margin-top: 2px; }

.yg-chat-log {
  flex: 1 1 auto;
  min-height: 180px;
  max-height: 320px;
  overflow-y: auto;
  padding: 10px;
  background: #f4f1fb;
}

.yg-chat-msg {
  margin: 0 0 8px;
  padding: 8px 10px;
  border-radius: 10px;
  font: 13px/1.45 Georgia, serif;
  white-space: pre-wrap;
  word-break: break-word;
}

.yg-chat-msg-bot { background: #fff; border: 1px solid rgba(0,0,0,.12); color: #111; }
.yg-chat-msg-you { background: #417586; color: #fff; margin-left: 28px; }

.yg-chat-showwrap { margin: 8px 0 0; }
.yg-chat-show {
  border: 0;
  border-radius: 999px;
  padding: 7px 12px;
  background: #111;
  color: #ffe566;
  font: 700 12px system-ui, sans-serif;
  cursor: pointer;
}

.yg-chat-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px;
  padding: 8px;
  border-top: 1px solid rgba(0,0,0,.12);
  background: #fff;
}

.yg-chat-form textarea {
  width: 100%;
  resize: none;
  border: 1px solid rgba(0,0,0,.18);
  border-radius: 8px;
  padding: 8px;
  font: 13px/1.35 system-ui, sans-serif;
}

.yg-chat-form button {
  align-self: end;
  border: 0;
  border-radius: 8px;
  padding: 8px 12px;
  background: #417586;
  color: #fff;
  font: 700 13px system-ui, sans-serif;
  cursor: pointer;
}

.yg-chat-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

@media (max-width: 640px) {
  body > .yg-chat {
    right: 12px;
    bottom: 64px;
  }
  .yg-chat-toggle {
    width: 42px;
    height: 42px;
    font-size: 12px;
  }
}
