/* ============================================================
   Kimi 主题 — 对照 kimi.com 网页版浅色首页
   浅色侧栏 + 纯白主区 / 黑色强调色 / 大圆角输入框 /
   黑色圆形发送键 / 底部快捷入口
   ============================================================ */
body.theme-kimi {
  --font-body: -apple-system, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --font-display: inherit;

  --bg-main: #ffffff;
  --bg-sidebar: #ffffff;
  --bg-panel: #ffffff;
  --bg-menu: #ffffff;
  --bg-topbar: #ffffff;
  --fg: #1a1a1a;
  --fg-dim: #6b6b6b;
  --border: #ececf1;
  --accent: #1a1a1a;

  --sidebar-w: 280px;
  --chat-w: 768px;
  --provider-sidebar-width: 280px;
  --provider-content-width: 768px;

  --item-hover: rgba(0, 0, 0, .04);
  --item-active: rgba(0, 0, 0, .08);
  --radius-btn: 12px;
  --radius-item: 10px;

  --newchat-fg: #1a1a1a;
  --newchat-bg: #f5f5f7;
  --newchat-bg-hover: #ebebef;
  --newchat-border: 1px solid #e6e6eb;

  --avatar-bg: #f2f2f5;
  --avatar-fg: #1a1a1a;
  --avatar-radius: 50%;
  --avatar-ai-bg: #1a1a1a;
  --avatar-ai-fg: #ffffff;

  --user-bubble: #f2f3f7;
  --user-bubble-fg: #1a1a1a;
  --user-bubble-radius: 18px;
  --user-bubble-pad: 10px 16px;

  --composer-bg: #ffffff;
  --composer-border: 1px solid #e6e6eb;
  --composer-radius: 24px;
  --composer-shadow: 0 4px 24px rgba(0, 0, 0, .06);
  --composer-focus: #d1d1d6;

  --send-bg: #1a1a1a;
  --send-fg: #ffffff;
  --send-radius: 50%;

  --search-bg: #f5f5f7;

  --welcome-size: 48px;
  --welcome-weight: 700;

  --code-bg: #f7f7f9;
  --code-bar-bg: #ededf1;
  --code-inline-bg: rgba(26, 26, 30, .07);
  --scrollbar: rgba(26, 26, 30, .16);
}

/* ---- 模型选择器图标配色 ---- */
body.theme-kimi .mi-icon.skin-kimi { background: #f2f2f5; color: #1a1a1a; }

/* ---- 侧栏浅色文字与交互 ---- */
body.theme-kimi .sidebar { color: #1a1a1a; border-right: 1px solid var(--border); }
body.theme-kimi .sidebar .icon-btn { color: #6b6b6b; }
body.theme-kimi .sidebar .icon-btn:hover { background: var(--item-hover); }
body.theme-kimi .session-list-title { color: #9a9a9a; }
body.theme-kimi .session-item { color: #1a1a1a; }
body.theme-kimi .session-item:hover { background: var(--item-hover); }
body.theme-kimi .session-item.active { background: var(--item-active); }
body.theme-kimi .sidebar-footer { border-top: 1px solid var(--border); }
body.theme-kimi .user-chip-name { color: #1a1a1a; }
body.theme-kimi .user-chip-balance { color: #6b6b6b; }
body.theme-kimi .user-chip-balance b { color: #1a1a1a; }
body.theme-kimi .user-chip:hover { background: var(--item-hover); }
body.theme-kimi .sidebar-search { color: #6b6b6b; background: var(--search-bg); }
body.theme-kimi .brand-name { color: #1a1a1a; font-weight: 700; }
body.theme-kimi .brand-icon { color: #1a1a1a; }

/* ---- Kimi logo 尺寸 ---- */
body.theme-kimi .brand-icon .kimi-logo-img { width: 22px; height: 22px; border-radius: 6px; display: block; }
body.theme-kimi .welcome-icon .kimi-logo-img { width: 48px; height: 48px; border-radius: 10px; display: block; margin: 0 auto; }
body.theme-kimi .mi-icon.skin-kimi .kimi-logo-img { width: 20px; height: 20px; border-radius: 5px; display: block; }
body.theme-kimi .msg-avatar .kimi-logo-img { width: 18px; height: 18px; border-radius: 4px; display: block; }

/* ---- 顶栏模型选择器保留 ---- */
body.theme-kimi .composer-picker { display: none; }

/* ---- 问候语 KIMI 大字标 ---- */
body.theme-kimi .welcome { padding-top: 20vh; }
body.theme-kimi .welcome-icon { margin-bottom: 18px; }
body.theme-kimi .welcome-title {
  font-size: 48px;
  font-weight: 700;
  letter-spacing: 4px;
  color: #1a1a1a;
}
body.theme-kimi .welcome-sub { font-size: 14.5px; color: #6b6b6b; }

/* ---- 新建会话按钮 ---- */
body.theme-kimi .new-chat-btn {
  position: relative;
  margin: 8px 12px 14px;
  padding: 10px 42px 10px 12px;
  background: #f5f5f7;
  border: 1px solid #e6e6eb;
  border-radius: 10px;
  color: #1a1a1a;
  font-weight: 500;
}
body.theme-kimi .new-chat-btn:hover { background: #ebebef; }
body.theme-kimi .new-chat-btn::after {
  content: "K";
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  font-size: 11px; color: #9a9a9a; padding: 2px 5px;
  border: 1px solid #e6e6eb; border-radius: 5px; background: #fff;
}

/* ---- 侧栏导航项 ---- */
body.theme-kimi .snav-item { color: #1a1a1a; border-radius: 8px; padding: 8px 10px; }
body.theme-kimi .snav-item svg { color: #6b6b6b; }
body.theme-kimi .snav-item:hover { background: var(--item-hover); }

/* ---- 输入框大圆角卡片 ---- */
body.theme-kimi .composer-wrap { padding: 8px 20px calc(14px + env(safe-area-inset-bottom)); }
body.theme-kimi .composer {
  max-width: var(--chat-w, 760px);
  background: #ffffff;
  border: 1px solid #e6e6eb;
  border-radius: 24px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, .06);
  padding: 12px 14px 10px;
}
body.theme-kimi .composer:focus-within {
  border-color: #d1d1d6;
  box-shadow: 0 4px 28px rgba(0, 0, 0, .09);
}
body.theme-kimi .composer textarea {
  padding: 6px 4px 10px;
  font-size: 15px;
  line-height: 1.6;
}
body.theme-kimi .composer textarea::placeholder { color: #9a9a9a; }
body.theme-kimi .send-btn { width: 36px; height: 36px; background: #1a1a1a; }
body.theme-kimi .send-btn:hover { opacity: .85; }
body.theme-kimi .attach-btn { color: #6b6b6b; }
body.theme-kimi .attach-btn:hover { background: var(--item-hover); }

/* ---- 输入框下方快捷入口 ---- */
body.theme-kimi .kimi-quick-bar {
  display: none;
  max-width: var(--chat-w, 760px);
  margin: 16px auto 0;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
}
body.theme-kimi.empty-chat .kimi-quick-bar { display: flex; }
body.theme-kimi .kimi-quick-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: #6b6b6b;
  font-size: 13px;
  cursor: pointer;
}
body.theme-kimi .kimi-quick-item:hover { background: rgba(0,0,0,.04); color: #1a1a1a; }
body.theme-kimi .kimi-quick-item svg { color: #6b6b6b; }

/* ---- composer-hint ---- */
body.theme-kimi .composer-hint { color: #9a9a9a; margin-top: 10px; }

/* ---- 弹层按钮 ---- */
body.theme-kimi .primary-btn, body.theme-kimi .login-card button:not(.auth-tab) { background: #1a1a1a; }
body.theme-kimi .login-logo { color: #1a1a1a; }

/* ---- 顶栏 ---- */
body.theme-kimi .topbar { border-bottom: none; }
body.theme-kimi .topbar-wordmark { color: #1a1a1a; }

/* ---- 消息气泡 ---- */
body.theme-kimi .msg-user .msg-content { border: none; }
body.theme-kimi .msg-assistant .msg-avatar { background: #1a1a1a; color: #fff; }

@media (max-width: 720px) {
  body.theme-kimi .welcome-title { font-size: 38px; letter-spacing: 2px; }
}

/* ---- Provider adapter capability states ---- */
/* Kimi 的 external 外链能力已按需求移除，仅保留焦点样式。 */
body.theme-kimi :is(button, a, [role="button"]):focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 3px;
}

@media (max-width: 680px) {
  body.theme-kimi .snav-list,
  body.theme-kimi .kimi-quick-bar {
    flex-wrap: nowrap;
    justify-content: flex-start;
    max-width: 100%;
    overflow-x: auto;
    padding-inline: max(12px, env(safe-area-inset-left)) max(12px, env(safe-area-inset-right));
    scrollbar-width: thin;
  }
}

@media (prefers-reduced-motion: reduce) {
  body.theme-kimi *,
  body.theme-kimi *::before,
  body.theme-kimi *::after {
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
  }
}

@media (forced-colors: active) {
  body.theme-kimi :is(button, a, [role="button"]):focus-visible {
    outline: 2px solid Highlight;
  }
}

/* Official Kimi wait: a status orb with an expanding pulse ring. */
body.theme-kimi .waiting-kimi {
  position: relative;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #1a1a1a;
}
body.theme-kimi .waiting-elapsed {
  font-size: 12px;
  color: #8f8f8f;
}
body.theme-kimi .waiting-kimi::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: rgba(26, 26, 26, .45);
  animation: kimi-waiting-ring 1.5s infinite ease-in-out;
}
@keyframes kimi-waiting-ring {
  0% { transform: scale(1); opacity: .55; }
  70% { transform: scale(2.1); opacity: 0; }
  100% { transform: scale(2.1); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  body.theme-kimi .waiting-kimi::after { animation: none; opacity: 0; }
}
