/* Site-wide AI assistant — candy kawaii, no avatar */
#blog-ai-root {
  --bai-bg: #fff8e7;
  --bai-primary: #ffd43b;
  --bai-pink: #ff8fab;
  --bai-blue: #74c0fc;
  --bai-text: #2b2b2b;
  --bai-shadow: 0 12px 40px rgba(255, 143, 171, 0.22);
  font-family: "General Sans", "PingFang SC", "Microsoft YaHei", sans-serif;
  z-index: 99999;
}

#blog-ai-toggle {
  position: fixed;
  right: 20px;
  bottom: 24px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  border: 2px solid var(--bai-primary);
  border-radius: 999px;
  background: linear-gradient(135deg, #fff 0%, var(--bai-bg) 100%);
  color: var(--bai-text);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.02em;
  box-shadow: var(--bai-shadow);
  cursor: pointer;
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
  z-index: 99999;
}

#blog-ai-toggle:hover {
  transform: translateY(-3px);
  border-color: var(--bai-pink);
  box-shadow: 0 16px 44px rgba(116, 192, 252, 0.28);
}

#blog-ai-toggle[aria-expanded="true"] {
  border-color: var(--bai-blue);
  opacity: 0.92;
}

#blog-ai-panel {
  position: fixed;
  right: 20px;
  bottom: 80px;
  width: min(320px, calc(100vw - 32px));
  height: 420px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 2px solid rgba(255, 212, 59, 0.65);
  border-radius: 18px;
  background: var(--bai-bg);
  box-shadow: var(--bai-shadow);
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
  transition: opacity 0.28s ease, transform 0.28s ease;
  z-index: 99999;
}

#blog-ai-panel.is-open {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

#blog-ai-header {
  padding: 14px 16px 10px;
  background: linear-gradient(120deg, #fff3bf 0%, #ffd8e8 55%, #d0ebff 100%);
  border-bottom: 1px solid rgba(255, 143, 171, 0.25);
}

#blog-ai-header h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 800;
  color: var(--bai-text);
}

#blog-ai-header p {
  margin: 4px 0 0;
  font-size: 12px;
  color: rgba(43, 43, 43, 0.72);
}

.blog-ai-page-hint {
  margin-top: 6px !important;
  font-size: 11px !important;
  line-height: 1.4;
  color: rgba(43, 43, 43, 0.65) !important;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

#blog-ai-quota {
  margin-top: 8px;
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.65);
  font-size: 11px;
  color: var(--bai-text);
}

#blog-ai-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#blog-ai-messages {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: linear-gradient(180deg, #fffdf6 0%, #fff8e7 100%);
}

.blog-ai-auth-bar {
  margin-top: 8px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  flex-wrap: wrap;
}

.blog-ai-auth-user {
  flex: 1 1 auto;
  font-size: 11px;
  color: rgba(43, 43, 43, 0.75);
  max-width: 160px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.blog-ai-auth-actions {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
  flex: 0 0 auto;
}

.blog-ai-auth-link {
  border: none;
  background: rgba(255, 255, 255, 0.75);
  color: var(--bai-text);
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  cursor: pointer;
}

.blog-ai-auth-link:hover {
  background: rgba(255, 143, 171, 0.35);
}

/* —— 中央账号登录（QQ/微信风格，与糖果色 AI 面板区分） —— */
body.acct-auth-open {
  overflow: hidden;
}

.acct-auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom));
  box-sizing: border-box;
  background: rgba(0, 0, 0, 0.52);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  font-family: system-ui, -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei",
    sans-serif;
}

.acct-auth-overlay.is-visible {
  display: flex;
}

.acct-auth-modal {
  position: relative;
  box-sizing: border-box;
  width: min(400px, calc(100vw - 32px));
  max-height: min(88vh, 640px);
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.28);
  animation: acct-auth-in 0.28s ease;
}

@keyframes acct-auth-in {
  from {
    opacity: 0;
    transform: scale(0.94) translateY(12px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.acct-auth-close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.06);
  color: #666;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.acct-auth-close:hover {
  background: rgba(0, 0, 0, 0.1);
}

.acct-auth-brand {
  padding: 36px 28px 16px;
  text-align: center;
}

.acct-auth-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  margin: 0 auto 14px;
  border: 1px solid rgba(255, 143, 171, 0.35);
  border-radius: 22px;
  background:
    radial-gradient(circle at 30% 22%, rgba(255, 255, 255, 0.95) 0 18%, transparent 19%),
    linear-gradient(145deg, #fff3bf 0%, #ffd8e8 54%, #d0ebff 100%);
  color: #ff8fab;
  font-size: 30px;
  font-weight: 800;
  line-height: 1;
  text-shadow: 0 2px 0 rgba(255, 255, 255, 0.85);
  box-shadow: 0 12px 28px rgba(255, 143, 171, 0.28);
}

.acct-auth-title {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  color: #111;
  letter-spacing: 0.02em;
}

.acct-auth-subtitle {
  margin: 8px 0 0;
  font-size: 13px;
  color: #888;
  line-height: 1.5;
}

.acct-auth-tabs {
  display: flex;
  margin: 0 28px;
  border-bottom: 1px solid #e8e8e8;
}

.acct-auth-tab {
  flex: 1;
  padding: 12px 0;
  border: none;
  background: transparent;
  font-size: 15px;
  color: #888;
  cursor: pointer;
  position: relative;
}

.acct-auth-tab.is-active {
  color: #12b7f5;
  font-weight: 600;
}

.acct-auth-tab.is-active::after {
  content: "";
  position: absolute;
  left: 20%;
  right: 20%;
  bottom: -1px;
  height: 2px;
  background: #12b7f5;
  border-radius: 2px;
}

.acct-auth-body {
  padding: 20px 28px 28px;
}

.acct-auth-label {
  display: block;
  margin-top: 14px;
  font-size: 13px;
  font-weight: 500;
  color: #333;
}

.acct-auth-body .acct-auth-label:first-child {
  margin-top: 0;
}

.acct-auth-input {
  width: 100%;
  box-sizing: border-box;
  margin-top: 8px;
  padding: 11px 12px;
  border: 1px solid #dcdcdc;
  border-radius: 8px;
  font-size: 15px;
  color: #111;
  background: #fafafa;
  transition: border-color 0.2s, background 0.2s;
}

.acct-auth-input:focus {
  outline: none;
  border-color: #12b7f5;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(18, 183, 245, 0.15);
}

.acct-auth-hint {
  margin: 8px 0 0;
  font-size: 12px;
  color: #999;
  line-height: 1.45;
}

.acct-auth-error {
  margin: 10px 0 0;
  font-size: 13px;
  color: #e54d42;
  line-height: 1.4;
}

.acct-auth-primary {
  width: 100%;
  margin-top: 22px;
  padding: 12px 16px;
  border: none;
  border-radius: 8px;
  background: #07c160;
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: background 0.2s, transform 0.15s;
}

.acct-auth-primary:hover {
  background: #06ad56;
}

.acct-auth-primary:active {
  transform: scale(0.98);
}

.acct-auth-text-btn {
  display: block;
  width: 100%;
  margin-top: 14px;
  padding: 8px;
  border: none;
  background: transparent;
  font-size: 14px;
  color: #576b95;
  cursor: pointer;
}

.acct-auth-text-btn:hover {
  color: #12b7f5;
}

.acct-auth-foot {
  margin: 16px 0 0;
  font-size: 11px;
  color: #bbb;
  text-align: center;
  line-height: 1.5;
}

.bai-msg {
  max-width: 88%;
  padding: 9px 12px;
  border-radius: 14px;
  font-size: 13px;
  line-height: 1.55;
  word-break: break-word;
  white-space: pre-wrap;
}

.bai-msg.user {
  align-self: flex-end;
  background: rgba(116, 192, 252, 0.35);
  border: 1px solid rgba(116, 192, 252, 0.45);
  color: var(--bai-text);
  border-bottom-right-radius: 4px;
}

.bai-msg.bot {
  align-self: flex-start;
  background: rgba(255, 143, 171, 0.22);
  border: 1px solid rgba(255, 143, 171, 0.35);
  color: var(--bai-text);
  border-bottom-left-radius: 4px;
}

.bai-msg.system {
  align-self: center;
  max-width: 95%;
  background: rgba(255, 255, 255, 0.7);
  border: 1px dashed rgba(255, 212, 59, 0.6);
  font-size: 12px;
  text-align: center;
}

#blog-ai-form {
  display: flex;
  gap: 8px;
  padding: 10px 12px 12px;
  border-top: 1px solid rgba(255, 143, 171, 0.2);
  background: #fff;
}

#blog-ai-input {
  flex: 1;
  resize: none;
  min-height: 38px;
  max-height: 80px;
  padding: 8px 10px;
  border: 1.5px solid rgba(116, 192, 252, 0.45);
  border-radius: 12px;
  font-size: 13px;
  color: var(--bai-text);
  background: #fffefb;
  outline: none;
}

#blog-ai-input:focus {
  border-color: var(--bai-pink);
  box-shadow: 0 0 0 3px rgba(255, 143, 171, 0.15);
}

#blog-ai-send {
  flex-shrink: 0;
  padding: 0 14px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--bai-primary), #ffb347);
  color: var(--bai-text);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

#blog-ai-send:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

#blog-ai-send:not(:disabled):hover {
  transform: scale(1.04);
}

@media (max-width: 768px) {
  #blog-ai-toggle {
    right: 16px;
    bottom: calc(24px + env(safe-area-inset-bottom, 0px));
    font-size: 13px;
    padding: 8px 14px;
  }

  #blog-ai-panel {
    right: 16px;
    bottom: calc(76px + env(safe-area-inset-bottom, 0px));
    height: min(400px, 58vh);
  }
}
