/* Site-wide AI assistant — candy kawaii, centered app window */
#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);
  --bai-app-radius: 22px;
  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: 7px;
  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::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--bai-pink);
  box-shadow: 0 0 0 0 rgba(255, 143, 171, 0.55);
  animation: bai-pulse 2.4s infinite;
}

@keyframes bai-pulse {
  0% { box-shadow: 0 0 0 0 rgba(255, 143, 171, 0.5); }
  70% { box-shadow: 0 0 0 10px rgba(255, 143, 171, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 143, 171, 0); }
}

#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;
}

/* —— 中央放大窗口 —— */
body.bai-app-open { overflow: hidden; }

.bai-overlay {
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: grid;
  place-items: center;
  padding: 0;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.28s ease;
}

.bai-overlay.is-open {
  opacity: 1;
  pointer-events: auto;
}

.bai-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background:
    radial-gradient(circle at 50% 38%, rgba(255, 248, 231, 0.30), transparent 40rem),
    rgba(33, 22, 30, 0.42);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  cursor: default;
}

.bai-app {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 268px 1fr;
  width: min(1120px, 94vw);
  height: min(780px, 90vh);
  overflow: hidden;
  border-radius: var(--bai-app-radius);
  background: var(--bai-bg);
  border: 1.5px solid rgba(255, 212, 59, 0.6);
  box-shadow:
    0 40px 120px rgba(78, 45, 60, 0.4),
    0 0 0 6px rgba(255, 255, 255, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
  transform: scale(0.92) translateY(18px);
  opacity: 0;
  transition: transform 0.34s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.28s ease;
}

.bai-overlay.is-open .bai-app {
  transform: scale(1) translateY(0);
  opacity: 1;
}

/* —— 左侧栏 —— */
.bai-aside {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px 16px;
  background:
    linear-gradient(180deg, rgba(255, 243, 191, 0.7) 0%, rgba(255, 216, 232, 0.5) 55%, rgba(208, 235, 255, 0.45) 100%);
  border-right: 1px solid rgba(255, 143, 171, 0.22);
}

.bai-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.bai-brand-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  overflow: hidden;
  background: linear-gradient(145deg, #fff3bf 0%, #ffd8e8 54%, #d0ebff 100%);
  box-shadow: 0 8px 18px rgba(255, 143, 171, 0.3);
}

.bai-brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.bai-brand-text b {
  display: block;
  font-size: 15px;
  font-weight: 800;
}

.bai-brand-text span {
  font-size: 11px;
  color: rgba(43, 43, 43, 0.6);
}

.bai-new-chat {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 11px 12px;
  border: 1.5px dashed rgba(255, 143, 171, 0.5);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.55);
  color: var(--bai-text);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, transform 0.15s;
}

.bai-new-chat:hover {
  background: rgba(255, 255, 255, 0.85);
  border-color: var(--bai-pink);
}

.bai-new-chat:active { transform: scale(0.98); }

.bai-side-label {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(43, 43, 43, 0.45);
  padding: 0 4px;
}

.blog-ai-mode-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 4px;
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.7);
}

.blog-ai-mode-tab {
  min-height: 34px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: rgba(43, 43, 43, 0.68);
  font-size: 12.5px;
  font-weight: 800;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.blog-ai-mode-tab.is-active {
  background: rgba(255, 255, 255, 0.92);
  color: var(--bai-text);
  box-shadow: 0 8px 18px rgba(116, 192, 252, 0.2);
}

.bai-context-card {
  padding: 11px 12px;
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(255, 212, 59, 0.5);
  font-size: 11.5px;
  line-height: 1.5;
}

.bai-context-card b {
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(43, 43, 43, 0.5);
  display: block;
  margin-bottom: 3px;
}

.blog-ai-page-hint {
  margin: 0;
  font-size: 11.5px;
  line-height: 1.5;
  color: rgba(43, 43, 43, 0.7);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.bai-side-foot {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.bai-quota {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 11px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(255, 212, 59, 0.55);
  font-size: 11.5px;
  font-weight: 700;
  align-self: flex-start;
}

#blog-ai-quota::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--bai-primary);
  box-shadow: 0 0 8px rgba(255, 212, 59, 0.8);
}

.blog-ai-auth-bar {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
  padding: 8px 10px;
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(255, 143, 171, 0.28);
}

.bai-avatar {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  overflow: hidden;
  position: relative;
  border: 1px solid rgba(255, 255, 255, 0.85);
  background: linear-gradient(145deg, #ffd8e8, #d0ebff);
  color: #b5608a;
  font-weight: 800;
  font-size: 14px;
  cursor: default;
  padding: 0;
}

.bai-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.bai-avatar.is-clickable {
  cursor: pointer;
}

.bai-avatar.is-clickable:hover::after {
  content: "换";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(43, 43, 43, 0.55);
  color: #fff;
  font-size: 11px;
}

.bai-avatar-uploading {
  font-size: 10px;
  color: rgba(43, 43, 43, 0.7);
}

.bai-avatar:disabled {
  opacity: 0.7;
  cursor: wait;
}

.blog-ai-auth-user {
  flex: 1 1 auto;
  font-size: 12px;
  font-weight: 600;
  color: rgba(43, 43, 43, 0.8);
  max-width: 120px;
  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);
}

/* —— 主区 —— */
.bai-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: linear-gradient(180deg, #fffdf6 0%, #fff8e7 100%);
}

.bai-topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  background: linear-gradient(120deg, #fff3bf 0%, #ffd8e8 55%, #d0ebff 100%);
  border-bottom: 1px solid rgba(255, 143, 171, 0.22);
}

.bai-topbar h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 800;
  color: var(--bai-text);
}

.bai-topbar p {
  margin: 3px 0 0;
  font-size: 11.5px;
  color: rgba(43, 43, 43, 0.6);
}

.bai-topbar-spacer { flex: 1; }

.bai-win-btn {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  border: 1px solid rgba(255, 255, 255, 0.7);
  background: rgba(255, 255, 255, 0.6);
  color: rgba(43, 43, 43, 0.7);
  font-size: 14px;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background 0.2s, color 0.2s;
}

.bai-win-btn:hover {
  background: rgba(255, 143, 171, 0.22);
  color: var(--bai-text);
}

.bai-win-close:hover {
  background: rgba(229, 77, 66, 0.16);
  color: #e54d42;
}

/* —— 消息区 —— */
#blog-ai-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#blog-ai-messages {
  flex: 1;
  overflow-y: auto;
  padding: 22px clamp(16px, 4vw, 40px);
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: linear-gradient(180deg, #fffdf6 0%, #fff8e7 100%);
  scroll-behavior: smooth;
}

#blog-ai-messages::-webkit-scrollbar { width: 8px; }
#blog-ai-messages::-webkit-scrollbar-thumb {
  background: rgba(255, 143, 171, 0.3);
  border-radius: 99px;
}

.bai-msg {
  display: flex;
  gap: 10px;
  max-width: 78%;
  animation: bai-msg-in 0.3s ease both;
}

@keyframes bai-msg-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.bai-msg.user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.bai-msg-role {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  overflow: hidden;
  font-size: 13px;
  font-weight: 800;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.1);
  background: #fff;
}

.bai-msg.bot .bai-msg-role {
  background: linear-gradient(145deg, #fff3bf, #ffd8e8 55%, #d0ebff);
}

.bai-msg.user .bai-msg-role {
  background: linear-gradient(145deg, #b3dcff, #74c0fc);
  color: #1f6aa0;
}

.bai-msg-role img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.bai-msg.user .bai-msg-role.is-clickable {
  cursor: pointer;
  position: relative;
}

.bai-msg.user .bai-msg-role.is-clickable:hover::after {
  content: "换";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(31, 106, 160, 0.6);
  color: #fff;
  font-size: 11px;
}

.bai-msg-bubble {
  padding: 11px 14px;
  border-radius: 16px;
  font-size: 13.5px;
  line-height: 1.65;
  word-break: break-word;
  white-space: pre-wrap;
}

.bai-msg.bot .bai-msg-bubble {
  background: rgba(255, 143, 171, 0.16);
  border: 1px solid rgba(255, 143, 171, 0.3);
  border-top-left-radius: 5px;
}

.bai-msg.user .bai-msg-bubble {
  background: rgba(116, 192, 252, 0.32);
  border: 1px solid rgba(116, 192, 252, 0.42);
  border-top-right-radius: 5px;
}

.bai-msg.system {
  align-self: center;
  max-width: 90%;
}

.bai-msg.system .bai-msg-role { display: none; }

.bai-msg.system .bai-msg-bubble {
  background: rgba(255, 255, 255, 0.7);
  border: 1px dashed rgba(255, 212, 59, 0.6);
  font-size: 12px;
  text-align: center;
}

/* —— 中央账号登录（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;
}

body.blog-ai-image-open {
  overflow: hidden;
}

.blog-ai-image-overlay {
  position: fixed;
  inset: 0;
  z-index: 999998;
  display: grid;
  place-items: center;
  padding: max(18px, env(safe-area-inset-top)) 18px max(18px, env(safe-area-inset-bottom));
  box-sizing: border-box;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.26s ease;
}

.blog-ai-image-overlay.is-open {
  opacity: 1;
  pointer-events: auto;
}

.blog-ai-image-backdrop {
  position: absolute;
  inset: 0;
  border: none;
  background:
    radial-gradient(circle at 50% 42%, rgba(255, 248, 231, 0.22), transparent 34rem),
    rgba(33, 24, 36, 0.48);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  cursor: default;
}

.blog-ai-image-card {
  position: relative;
  isolation: isolate;
  display: grid;
  gap: 0.75rem;
  width: fit-content;
  max-width: 94vw;
  max-height: 90vh;
  padding: clamp(0.52rem, 1.4vw, 0.9rem);
  border: 1px solid rgba(255, 255, 255, 0.68);
  border-radius: clamp(1.2rem, 3vw, 2rem);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.78), rgba(255, 231, 239, 0.38)),
    linear-gradient(135deg, rgba(255, 225, 154, 0.36), rgba(178, 224, 255, 0.3));
  box-shadow:
    0 2rem 5rem rgba(45, 35, 55, 0.38),
    0 0 0 0.5rem rgba(255, 255, 255, 0.13),
    inset 0 1px 0 rgba(255, 255, 255, 0.86);
  transform: perspective(1100px) rotateX(2deg) rotateY(-3deg) translateY(6px);
  animation: blogAIImageCardIn 0.34s ease forwards;
}

.blog-ai-image-card::before,
.blog-ai-image-card::after {
  content: "";
  pointer-events: none;
  position: absolute;
  inset: clamp(0.52rem, 1.4vw, 0.9rem);
  z-index: 1;
  border-radius: clamp(0.9rem, 2.4vw, 1.45rem);
}

.blog-ai-image-card::before {
  mix-blend-mode: screen;
  background:
    linear-gradient(115deg, transparent 0 28%, rgba(255, 255, 255, 0.5) 38%, transparent 52%),
    conic-gradient(from 140deg at 52% 48%, rgba(255, 143, 171, 0.22), rgba(255, 232, 126, 0.18), rgba(131, 217, 255, 0.2), rgba(202, 168, 255, 0.18), rgba(255, 143, 171, 0.22));
  opacity: 0.68;
}

.blog-ai-image-card::after {
  border: 1px solid rgba(255, 255, 255, 0.58);
  box-shadow:
    inset 0 0 2rem rgba(255, 255, 255, 0.24),
    inset 0 -1.4rem 2rem rgba(255, 180, 211, 0.16);
}

.blog-ai-image-media {
  position: relative;
  z-index: 2;
  display: grid;
  place-items: center;
  width: min(
    calc(min(72vh, 38rem) * var(--blog-ai-result-aspect, 1)),
    calc(92vw - clamp(1.2rem, 4vw, 3rem))
  );
  aspect-ratio: var(--blog-ai-result-aspect, 1);
  max-width: 100%;
  max-height: min(72vh, 38rem);
  overflow: hidden;
  border-radius: clamp(0.9rem, 2.4vw, 1.45rem);
  background:
    radial-gradient(circle at 22% 18%, rgba(255, 255, 255, 0.72), transparent 9rem),
    linear-gradient(135deg, rgba(255, 246, 232, 0.82), rgba(232, 246, 255, 0.78));
}

.blog-ai-image-media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: 0;
  border-radius: inherit;
  background: rgba(255, 250, 241, 0.42);
  box-shadow:
    0 1.1rem 2.2rem rgba(62, 45, 54, 0.22),
    inset 0 0 0 1px rgba(255, 255, 255, 0.45);
  transition: opacity 360ms ease;
}

.blog-ai-image-media img.is-loaded {
  opacity: 1;
}

.blog-ai-image-copy {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  min-width: min(22rem, 84vw);
  padding: 0 0.2rem 0.1rem;
  color: rgba(60, 45, 55, 0.9);
}

.blog-ai-image-kicker {
  margin: 0 0 0.12rem;
  color: rgba(107, 71, 82, 0.58);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.blog-ai-image-copy h3 {
  margin: 0;
  font-size: clamp(1rem, 2.8vw, 1.28rem);
  font-weight: 900;
}

.blog-ai-image-actions {
  display: inline-flex;
  flex: 0 0 auto;
  gap: 0.45rem;
}

.blog-ai-image-action,
.blog-ai-image-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  box-sizing: border-box;
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: 999px;
  background: rgba(255, 250, 245, 0.84);
  color: rgba(43, 43, 43, 0.86);
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
  box-shadow: 0 0.8rem 1.8rem rgba(62, 45, 54, 0.14);
  cursor: pointer;
}

.blog-ai-image-action {
  padding: 0 0.86rem;
}

.blog-ai-image-close {
  position: absolute;
  right: clamp(0.8rem, 2vw, 1.15rem);
  top: clamp(0.8rem, 2vw, 1.15rem);
  z-index: 4;
  padding: 0 0.82rem;
}

.blog-ai-image-action:hover,
.blog-ai-image-close:hover {
  border-color: rgba(255, 143, 171, 0.55);
  background: rgba(255, 255, 255, 0.94);
}

.blog-ai-image-action:disabled {
  cursor: wait;
  opacity: 0.7;
}

@keyframes blogAIImageCardIn {
  to {
    transform: perspective(1100px) rotateX(2deg) rotateY(-3deg) translateY(0);
  }
}

/* —— 输入区 —— */
.bai-composer {
  padding: 14px clamp(16px, 4vw, 24px) 18px;
  border-top: 1px solid rgba(255, 143, 171, 0.2);
  background: #fff;
}

.bai-composer-shell {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 8px 8px 8px 14px;
  border: 1.5px solid rgba(116, 192, 252, 0.45);
  border-radius: 16px;
  background: #fffefb;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.bai-composer-shell:focus-within {
  border-color: var(--bai-pink);
  box-shadow: 0 0 0 3px rgba(255, 143, 171, 0.15);
}

#blog-ai-input {
  flex: 1;
  resize: none;
  min-height: 26px;
  max-height: 140px;
  padding: 6px 0;
  border: none;
  outline: none;
  font-family: inherit;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--bai-text);
  background: transparent;
}

#blog-ai-send {
  flex: 0 0 auto;
  padding: 9px 18px;
  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);
}

.bai-composer-hint {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
  padding: 0 4px;
  font-size: 11px;
  color: rgba(43, 43, 43, 0.5);
}

.bai-count {
  margin-left: auto;
}

.bai-count span {
  font-weight: 700;
}

/* —— 移动端：侧栏折叠为顶部条，窗口接近全屏 —— */
@media (max-width: 768px) {
  #blog-ai-toggle {
    right: 14px;
    bottom: calc(20px + env(safe-area-inset-bottom, 0px));
    font-size: 13px;
    padding: 8px 14px;
    max-width: calc(100vw - 28px);
    box-sizing: border-box;
  }

  .bai-overlay {
    padding: max(8px, env(safe-area-inset-top, 0px)) 8px max(8px, env(safe-area-inset-bottom, 0px));
    box-sizing: border-box;
  }

  .bai-app {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
    width: min(100%, calc(100vw - 16px));
    height: min(100vh, calc(100vh - 16px));
    height: min(100dvh, calc(100dvh - 16px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)));
    min-width: 0;
    border-radius: 18px;
    border: 1px solid rgba(255, 212, 59, 0.52);
  }

  .bai-aside {
    flex-direction: row;
    align-items: center;
    gap: 10px;
    max-width: 100%;
    min-width: 0;
    padding: 10px 12px;
    border-right: 0;
    border-bottom: 1px solid rgba(255, 143, 171, 0.22);
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .bai-aside::-webkit-scrollbar {
    display: none;
  }

  .bai-brand,
  .bai-new-chat,
  .blog-ai-mode-tabs {
    flex: 0 0 auto;
  }

  .bai-brand-mark {
    width: 34px;
    height: 34px;
    border-radius: 12px;
  }

  .bai-brand-text,
  .bai-side-label,
  .bai-context-card,
  .bai-side-foot {
    display: none;
  }

  .bai-new-chat {
    padding: 8px 12px;
    white-space: nowrap;
  }

  .blog-ai-mode-tabs {
    grid-auto-flow: column;
    grid-template-columns: none;
    max-width: max-content;
  }

  #blog-ai-messages {
    padding: 14px;
  }

  .bai-msg {
    max-width: 92%;
  }

  .bai-topbar {
    gap: 8px;
    padding: 12px 14px;
  }

  .bai-topbar h2 {
    font-size: 15px;
  }

  .bai-topbar p {
    max-width: 58vw;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .bai-win-btn {
    width: 28px;
    height: 28px;
    border-radius: 8px;
  }

  .bai-composer {
    padding: 10px 10px calc(12px + env(safe-area-inset-bottom, 0px));
  }

  .bai-composer-shell {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
    gap: 8px;
    padding: 7px 7px 7px 12px;
    border-radius: 14px;
  }

  #blog-ai-input {
    min-width: 0;
    font-size: 13px;
  }

  #blog-ai-send {
    min-width: 4.25rem;
    padding: 8px 12px;
    border-radius: 11px;
    font-size: 12.5px;
  }

  .bai-composer-hint {
    gap: 6px;
    font-size: 10px;
  }

  .blog-ai-image-card {
    max-width: 94vw;
    max-height: 84vh;
    padding: 0.42rem;
    border-radius: 1.1rem;
    transform: perspective(900px) rotateX(1.5deg) rotateY(-2deg) translateY(5px);
  }

  .blog-ai-image-card::before,
  .blog-ai-image-card::after {
    inset: 0.42rem;
    border-radius: 0.82rem;
  }

  .blog-ai-image-media {
    width: min(82vw, calc(72vh * var(--blog-ai-result-aspect, 1)));
    max-height: 66vh;
    border-radius: 0.82rem;
  }

  .blog-ai-image-copy {
    align-items: stretch;
    flex-direction: column;
    gap: 0.55rem;
    min-width: 0;
    width: min(82vw, 22rem);
    padding: 0 0.24rem 0.18rem;
  }

  .blog-ai-image-actions {
    width: 100%;
  }

  .blog-ai-image-action {
    flex: 1;
  }

  @keyframes blogAIImageCardIn {
    to {
      transform: perspective(900px) rotateX(1.5deg) rotateY(-2deg) translateY(0);
    }
  }
}
