/* ============================================================
   智能·人工 HumanGPT — 用户端聊天页样式
   深色主题 / 紫青渐变 / 三栏 → 单栏响应式
   无任何外链资源，字体走 system-ui 栈
   ============================================================ */

:root {
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", "Helvetica Neue",
    Arial, system-ui, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
    "Liberation Mono", "Courier New", monospace;

  --bg: #08080c;
  --bg-sidebar: #0a0a10;
  --panel: #14141d;
  --panel-2: #191925;
  --line: rgba(255, 255, 255, 0.07);
  --line-strong: rgba(255, 255, 255, 0.12);

  --text: #ecedf3;
  --text-dim: #a2a3b3;
  --text-faint: #6f7080;

  --brand-1: #8b5cf6;
  --brand-2: #22d3ee;
  --brand-3: #a78bfa;
  --brand-soft: rgba(139, 92, 246, 0.16);
  --brand-line: rgba(139, 92, 246, 0.32);

  --danger: #f87171;
  --warn: #fbbf24;
  --ok: #34d399;

  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 20px;

  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

/* hidden 属性优先级兜底：避免组件自身的 display 覆盖 UA 的 [hidden] */
[hidden] {
  display: none !important;
}

html {
  height: 100%;
}

body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* 全局氛围光：左上紫、右上青，克制低饱和 */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(900px 520px at 16% -12%, rgba(139, 92, 246, 0.16), transparent 62%),
    radial-gradient(820px 480px at 88% -8%, rgba(34, 211, 238, 0.09), transparent 60%),
    radial-gradient(700px 600px at 50% 120%, rgba(99, 102, 241, 0.07), transparent 65%);
}

button {
  font-family: inherit;
  color: inherit;
}

button:focus-visible,
a:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid rgba(139, 92, 246, 0.65);
  outline-offset: 2px;
}

::selection {
  background: rgba(139, 92, 246, 0.4);
  color: #fff;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.ic {
  width: 16px;
  height: 16px;
  display: block;
  pointer-events: none;
}

/* ---------------- 应用外壳 ---------------- */

.app {
  position: relative;
  z-index: 1;
  display: flex;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

.scrim {
  position: fixed;
  inset: 0;
  z-index: 65;
  background: rgba(4, 4, 8, 0.55);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.scrim.show {
  opacity: 1;
  pointer-events: auto;
}

/* ---------------- 左侧会话侧栏 ---------------- */

.sidebar {
  position: relative;
  z-index: 20;
  flex: 0 0 264px;
  width: 264px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px 12px 12px;
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(13, 13, 20, 0.94), rgba(8, 8, 12, 0.96));
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
}

.sidebar-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 2px 4px 4px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand-mark {
  display: inline-flex;
  flex: 0 0 auto;
}

.brand-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.25;
}

.brand-name {
  font-size: 15px;
  font-weight: 650;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.brand-version {
  margin-top: 1px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  color: var(--text-faint);
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
  transition: background-color 0.16s ease, color 0.16s ease, border-color 0.16s ease;
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.055);
  color: var(--text);
}

.sidebar-close {
  display: none;
  margin-left: auto;
}

.new-chat {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background:
    linear-gradient(180deg, rgba(139, 92, 246, 0.13), rgba(139, 92, 246, 0.04)),
    rgba(255, 255, 255, 0.015);
  color: var(--text);
  font-size: 13px;
  font-weight: 550;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: border-color 0.18s ease, background-color 0.18s ease, transform 0.12s ease;
}

.new-chat:hover {
  border-color: var(--brand-line);
  background:
    linear-gradient(180deg, rgba(139, 92, 246, 0.2), rgba(34, 211, 238, 0.05)),
    rgba(255, 255, 255, 0.02);
}

.new-chat:active {
  transform: scale(0.99);
}

.new-chat-ic {
  display: inline-flex;
  color: var(--brand-3);
}

.new-chat-ic .ic {
  width: 15px;
  height: 15px;
}

.sidebar-section {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sidebar-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 8px 2px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--text-faint);
  text-transform: uppercase;
}

.sidebar-label-count {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0;
  color: var(--text-faint);
  opacity: 0.75;
}

.history {
  flex: 1 1 auto;
  min-height: 0;
  margin: 0;
  padding: 0 2px 6px;
  list-style: none;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.14) transparent;
}

.history::-webkit-scrollbar {
  width: 6px;
}

.history::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 99px;
}

.history-item {
  display: flex;
  align-items: center;
  gap: 9px;
  height: 34px;
  margin: 1px 0;
  padding: 0 9px;
  border: 1px solid transparent;
  border-radius: 10px;
  color: var(--text-dim);
  font-size: 12.5px;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.history-item:hover {
  background: rgba(255, 255, 255, 0.045);
  color: var(--text);
}

.history-item.active {
  background: rgba(139, 92, 246, 0.12);
  border-color: rgba(139, 92, 246, 0.22);
  color: var(--text);
}

.history-item.flash {
  animation: itemFlash 0.7s ease;
}

.history-ic {
  display: inline-flex;
  flex: 0 0 auto;
  color: var(--text-faint);
}

.history-item.active .history-ic {
  color: var(--brand-3);
}

.history-ic .ic {
  width: 14px;
  height: 14px;
}

.history-text {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-time {
  flex: 0 0 auto;
  font-size: 10.5px;
  color: var(--text-faint);
}

.sidebar-foot {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.load-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.025);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.18s ease, background-color 0.18s ease;
}

.load-card:hover {
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.04);
}

.load-card[aria-expanded="true"] {
  border-color: var(--brand-line);
}

.load-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.load-title {
  font-size: 11.5px;
  color: var(--text-dim);
  letter-spacing: 0.02em;
}

.load-value {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--brand-3);
  font-variant-numeric: tabular-nums;
}

.load-track {
  display: block;
  height: 5px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.07);
  overflow: hidden;
}

.load-fill {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, #8b5cf6, #22d3ee);
  box-shadow: 0 0 12px rgba(139, 92, 246, 0.5);
  transition: width 0.6s var(--ease-out), background 0.3s ease;
}

.load-fill[data-level="mid"] {
  background: linear-gradient(90deg, #8b5cf6, #fbbf24);
  box-shadow: 0 0 12px rgba(251, 191, 36, 0.35);
}

.load-fill[data-level="high"] {
  background: linear-gradient(90deg, #f97316, #f87171);
  box-shadow: 0 0 12px rgba(248, 113, 113, 0.4);
}

.load-sub {
  font-size: 10.5px;
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
}

.sidebar-foot-note {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 4px;
  font-size: 10px;
  color: var(--text-faint);
  letter-spacing: 0.03em;
}

.live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 8px rgba(52, 211, 153, 0.7);
  animation: softPulse 2.4s ease-in-out infinite;
}

/* 指标弹层 */
.metrics-panel {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 86px;
  z-index: 30;
  max-height: 46vh;
  overflow-y: auto;
  padding: 12px 12px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  background: #12121b;
  box-shadow: 0 24px 60px -18px rgba(0, 0, 0, 0.85), 0 0 0 1px rgba(0, 0, 0, 0.3);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  animation: popIn 0.2s var(--ease-out);
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.14) transparent;
}

.metrics-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 8px;
  margin-bottom: 2px;
  border-bottom: 1px solid var(--line);
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-dim);
  letter-spacing: 0.06em;
}

.metrics-refresh {
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 400;
  color: var(--text-faint);
  letter-spacing: 0.02em;
}

.metrics-list {
  display: flex;
  flex-direction: column;
}

.metric-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: baseline;
  gap: 2px 10px;
  padding: 6px 0;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.05);
}

.metric-row:last-child {
  border-bottom: 0;
}

.metric-label {
  font-size: 11.5px;
  color: var(--text-dim);
}

.metric-value {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.metric-track {
  grid-column: 1 / -1;
  height: 3px;
  margin-top: 2px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
}

.metric-fill {
  display: block;
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, rgba(139, 92, 246, 0.85), rgba(34, 211, 238, 0.85));
  transition: width 0.6s var(--ease-out);
}

/* ---------------- 主区 ---------------- */

.main {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  flex: 0 0 58px;
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(8, 8, 12, 0.5);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  z-index: 15;
}

.topbar-left,
.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.menu-btn {
  display: none;
}

.ghost-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 34px;
  padding: 0 11px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--text-dim);
  font-size: 12.5px;
  cursor: pointer;
  transition: background-color 0.16s ease, color 0.16s ease, border-color 0.16s ease;
}

.ghost-btn:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--line);
  color: var(--text);
}

.ghost-btn .ic {
  width: 15px;
  height: 15px;
}

.conn-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 48vw;
  padding: 4px 9px;
  border: 1px solid rgba(251, 191, 36, 0.28);
  border-radius: 99px;
  background: rgba(251, 191, 36, 0.07);
  color: #fcd34d;
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  animation: popIn 0.2s var(--ease-out);
}

#connText {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.conn-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  animation: softPulse 1.4s ease-in-out infinite;
}

/* ---------------- 对话滚动区 ---------------- */

.chat-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.12) transparent;
}

.chat-scroll::-webkit-scrollbar {
  width: 8px;
}

.chat-scroll::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 99px;
}

.chat-inner {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 860px;
  min-height: 100%;
  margin: 0 auto;
  padding: 26px 24px 14px;
}

/* ---------------- 空态 ---------------- */

.empty {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 12px 0 24px;
  text-align: center;
}

.app.chatting .empty {
  display: none;
}

.empty-mark {
  display: grid;
  place-items: center;
  width: 78px;
  height: 78px;
  margin-bottom: 20px;
  border: 1px solid rgba(139, 92, 246, 0.26);
  border-radius: 24px;
  background:
    radial-gradient(circle at 30% 20%, rgba(139, 92, 246, 0.34), transparent 62%),
    radial-gradient(circle at 72% 82%, rgba(34, 211, 238, 0.2), transparent 60%),
    rgba(255, 255, 255, 0.02);
  box-shadow: 0 26px 70px -30px rgba(139, 92, 246, 0.7);
  animation: floatY 7s ease-in-out infinite;
}

.empty-brand {
  margin: 0;
  font-size: 40px;
  font-weight: 700;
  letter-spacing: 0.05em;
  line-height: 1.2;
  background: linear-gradient(115deg, #ddd6fe 0%, #a78bfa 38%, #67e8f9 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.empty-latin {
  margin: 7px 0 0;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.14em;
  color: var(--text-faint);
  text-transform: uppercase;
}

.empty-slogan {
  margin: 16px 0 0;
  font-size: 16px;
  color: var(--text-dim);
  letter-spacing: 0.01em;
}

.empty-sub {
  margin: 5px 0 0;
  font-size: 12px;
  color: var(--text-faint);
  letter-spacing: 0.02em;
}

.empty-hello {
  margin: 26px 0 14px;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text);
}

.suggestions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  width: 100%;
  max-width: 620px;
}

.suggestion {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 13px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.022);
  color: var(--text-dim);
  text-align: left;
  font-size: 12.5px;
  line-height: 1.55;
  cursor: pointer;
  transition: border-color 0.18s ease, background-color 0.18s ease, transform 0.14s ease, color 0.18s ease;
}

.suggestion:hover {
  border-color: var(--brand-line);
  background: rgba(139, 92, 246, 0.07);
  color: var(--text);
  transform: translateY(-1px);
}

.suggestion:active {
  transform: translateY(0);
}

.suggestion-ic {
  flex: 0 0 auto;
  display: inline-flex;
  color: var(--brand-3);
}

.suggestion-ic .ic {
  width: 15px;
  height: 15px;
}

.suggestion-text {
  flex: 1 1 auto;
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.suggestion-arrow {
  flex: 0 0 auto;
  display: inline-flex;
  color: var(--text-faint);
  opacity: 0;
  transform: translateX(-3px);
  transition: opacity 0.16s ease, transform 0.16s ease;
}

.suggestion:hover .suggestion-arrow {
  opacity: 1;
  transform: translateX(0);
}

.suggestion-arrow .ic {
  width: 13px;
  height: 13px;
}

/* ---------------- 消息流 ---------------- */

.messages {
  display: flex;
  flex-direction: column;
  gap: 22px;
  width: 100%;
}

.msg {
  display: flex;
  gap: 12px;
  min-width: 0;
  animation: rise 0.2s var(--ease-out);
}

.msg.user {
  justify-content: flex-end;
}

.bubble {
  max-width: 82%;
  padding: 10px 15px;
  border-radius: 18px 18px 5px 18px;
  border: 1px solid rgba(139, 92, 246, 0.24);
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.17), rgba(34, 211, 238, 0.06));
  font-size: 15px;
  line-height: 1.68;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.msg.user.failed .bubble {
  border-color: rgba(248, 113, 113, 0.5);
  background: rgba(248, 113, 113, 0.08);
  opacity: 0.72;
}

.avatar {
  flex: 0 0 30px;
  width: 30px;
  height: 30px;
  margin-top: 2px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: linear-gradient(135deg, #8b5cf6, #22d3ee);
  box-shadow: 0 7px 18px -8px rgba(139, 92, 246, 0.8);
}

.avatar svg {
  width: 17px;
  height: 17px;
}

.msg.pending .avatar {
  animation: avatarGlow 2.4s ease-in-out infinite;
}

.msg-body {
  flex: 1 1 auto;
  min-width: 0;
}

.msg-sender {
  margin-bottom: 4px;
  font-size: 11.5px;
  color: var(--text-faint);
  letter-spacing: 0.02em;
}

.msg-text {
  font-size: 15px;
  line-height: 1.85;
  color: #e8e9f0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.text-body {
  white-space: pre-wrap;
}

.stream-cursor {
  display: inline-block;
  margin-left: 1px;
  color: var(--brand-3);
  font-size: 14px;
  line-height: 1;
  animation: blink 1s steps(1, end) infinite;
}

/* 等待：三点 + hint */
.waiting {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 24px;
  margin: 2px 0 6px;
  color: var(--text-dim);
  font-size: 13px;
  line-height: 1.5;
}

.waiting[hidden] {
  display: none;
}

.waiting-dots {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex: 0 0 auto;
  height: 14px;
}

.waiting-dots i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--brand-3);
  animation: dotBounce 1.1s ease-in-out infinite;
}

.waiting-dots i:nth-child(2) {
  animation-delay: 0.16s;
}

.waiting-dots i:nth-child(3) {
  animation-delay: 0.32s;
}

.waiting-hint {
  min-width: 0;
  overflow-wrap: anywhere;
  color: var(--text-dim);
  transition: color 0.3s ease;
}

/* 假 CoT 思考块 */
.think-slot:empty {
  display: none;
}

.think-block {
  margin: 4px 0 10px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-left: 2px solid rgba(139, 92, 246, 0.55);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.022);
  overflow: hidden;
}

.think-head {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 7px 10px;
  border: 0;
  background: transparent;
  color: var(--text-dim);
  font-family: inherit;
  font-size: 12.5px;
  text-align: left;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.think-head:hover {
  background: rgba(255, 255, 255, 0.025);
}

.think-glyph {
  display: inline-flex;
  flex: 0 0 auto;
  color: var(--brand-3);
}

.think-glyph .ic {
  width: 14px;
  height: 14px;
}

.think-title {
  color: var(--text-dim);
  white-space: nowrap;
}

.think-elapsed {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
}

.think-toggle-label {
  margin-left: auto;
  font-size: 11px;
  color: var(--text-faint);
  white-space: nowrap;
}

.think-chev {
  display: inline-flex;
  flex: 0 0 auto;
  color: var(--text-faint);
  transition: transform 0.22s var(--ease-out);
}

.think-chev .ic {
  width: 14px;
  height: 14px;
}

.think-block[data-open="0"] .think-chev {
  transform: rotate(-90deg);
}

.think-body {
  display: grid;
  grid-template-rows: 1fr;
  transition: grid-template-rows 0.3s var(--ease-out);
}

.think-block[data-open="0"] .think-body {
  grid-template-rows: 0fr;
}

.think-inner {
  min-height: 0;
  overflow: hidden;
}

.think-content {
  padding: 0 12px 10px 12px;
}

.think-text {
  color: #8e8fa3;
  font-size: 13px;
  line-height: 1.82;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.think-cursor {
  display: inline-block;
  color: #8e8fa3;
  font-size: 12px;
  animation: blink 1s steps(1, end) infinite;
}

.think-block.done .think-cursor {
  display: none;
}

/* done 后的 meta 小字与操作 */
.msg-meta {
  margin-top: 8px;
  font-size: 11px;
  color: var(--text-faint);
  letter-spacing: 0.01em;
  line-height: 1.6;
  overflow-wrap: anywhere;
}

.msg-meta:empty {
  display: none;
}

.msg-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-top: 5px;
  opacity: 0;
  transition: opacity 0.16s ease;
}

.msg:hover .msg-actions,
.msg-actions:focus-within {
  opacity: 1;
}

.msg-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--text-faint);
  cursor: pointer;
  transition: background-color 0.14s ease, color 0.14s ease;
}

.msg-action:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
}

.msg-action .ic {
  width: 14px;
  height: 14px;
}

.msg-action.copied {
  color: var(--ok);
}

/* 前端 system 提示气泡 */
.msg.system {
  justify-content: center;
}

.system-note {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  max-width: 88%;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-faint);
  font-size: 11.5px;
  line-height: 1.55;
}

.system-ic {
  display: inline-flex;
  flex: 0 0 auto;
  color: var(--brand-3);
}

.system-ic .ic {
  width: 13px;
  height: 13px;
}

.system-text {
  overflow-wrap: anywhere;
}

/* ---------------- 输入区 ---------------- */

.composer-dock {
  flex: 0 0 auto;
  padding: 8px 24px 12px;
  background: linear-gradient(180deg, rgba(8, 8, 12, 0) 0%, rgba(8, 8, 12, 0.78) 34%, rgba(8, 8, 12, 0.96) 100%);
}

.composer {
  max-width: 800px;
  margin: 0 auto;
  padding: 11px 11px 9px 16px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  background: rgba(21, 21, 31, 0.86);
  box-shadow:
    0 20px 55px -24px rgba(0, 0, 0, 0.85),
    inset 0 1px 0 rgba(255, 255, 255, 0.035);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.composer:focus-within {
  border-color: rgba(139, 92, 246, 0.42);
  box-shadow:
    0 22px 60px -24px rgba(70, 40, 160, 0.55),
    0 0 0 3px rgba(139, 92, 246, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

#composerInput {
  display: block;
  width: 100%;
  max-height: 180px;
  min-height: 27px;
  padding: 2px 0;
  border: 0;
  outline: none;
  resize: none;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 15px;
  line-height: 1.65;
  overflow-y: auto;
  scrollbar-width: thin;
}

#composerInput::placeholder {
  color: #5f606e;
}

.composer-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 5px;
}

.composer-left,
.composer-right {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.composer-tool {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  appearance: none;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text-faint);
  opacity: 0.72;
  cursor: pointer;
  transition: opacity 0.16s ease, color 0.16s ease, background-color 0.16s ease;
}

.composer-tool:hover {
  opacity: 1;
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
}

.composer-tool:focus-visible {
  outline: 2px solid rgba(139, 92, 246, 0.6);
  outline-offset: 1px;
}

.composer-tool .ic {
  width: 15px;
  height: 15px;
}

.composer-hint {
  font-size: 10.5px;
  color: var(--text-faint);
  letter-spacing: 0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.char-count {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
}

.char-count.over {
  color: var(--danger);
}

.send-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: linear-gradient(135deg, #8b5cf6, #22d3ee);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 8px 22px -8px rgba(139, 92, 246, 0.75);
  transition: transform 0.14s ease, opacity 0.16s ease, filter 0.16s ease;
}

.send-btn:hover:not(:disabled) {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

.send-btn:active:not(:disabled) {
  transform: scale(0.94);
}

.send-btn:disabled {
  background: rgba(255, 255, 255, 0.08);
  color: #5a5b68;
  box-shadow: none;
  cursor: default;
}

.send-btn .ic {
  width: 17px;
  height: 17px;
}

.footer-note {
  max-width: 800px;
  margin: 9px auto 0;
  font-size: 10.5px;
  line-height: 1.6;
  color: #565766;
  text-align: center;
  letter-spacing: 0.01em;
}

/* ---------------- 模型详情抽屉 ---------------- */

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 70;
  display: flex;
  flex-direction: column;
  width: 420px;
  max-width: 100%;
  border-left: 1px solid var(--line-strong);
  background: linear-gradient(180deg, #111119 0%, #0a0a10 100%);
  box-shadow: -30px 0 80px -40px rgba(0, 0, 0, 0.9);
  transform: translateX(102%);
  transition: transform 0.32s var(--ease-out);
  will-change: transform;
}

.drawer.open {
  transform: none;
}

.drawer-head {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 15px 18px 14px;
  border-bottom: 1px solid var(--line);
}

.drawer-kicker {
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.16em;
  color: var(--brand-3);
  opacity: 0.8;
}

.drawer-title {
  margin: 2px 0 0;
  font-size: 16px;
  font-weight: 650;
  letter-spacing: 0.02em;
}

.drawer-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 16px 18px 30px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.12) transparent;
}

.drawer-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 16px;
}

.drawer-tab {
  flex: 1 1 0;
  min-width: 0;
  padding: 7px 4px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: transparent;
  color: var(--text-faint);
  font-size: 11.5px;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: border-color 0.16s ease, color 0.16s ease, background-color 0.16s ease;
}

.drawer-tab:hover {
  color: var(--text);
  border-color: var(--line-strong);
}

.drawer-tab.active {
  color: var(--text);
  border-color: rgba(139, 92, 246, 0.42);
  background: rgba(139, 92, 246, 0.1);
}

.drawer-hero {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background:
    radial-gradient(360px 160px at 12% -20%, rgba(139, 92, 246, 0.16), transparent 70%),
    radial-gradient(300px 160px at 100% 120%, rgba(34, 211, 238, 0.08), transparent 70%),
    rgba(255, 255, 255, 0.02);
}

.drawer-model-top {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
}

.drawer-model-name {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.02em;
  background: linear-gradient(110deg, #e9e3ff, #a78bfa 45%, #67e8f9);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.drawer-model-badge {
  padding: 2px 8px;
  border: 1px solid rgba(139, 92, 246, 0.3);
  border-radius: 99px;
  background: rgba(139, 92, 246, 0.1);
  color: #c4b5fd;
  font-size: 10px;
  letter-spacing: 0.03em;
}

.drawer-tagline {
  margin: 8px 0 0;
  font-size: 12.5px;
  color: var(--text-dim);
}

/* 模型详情的「预览」控件：tab 只切详情，不影响当前会话 */
.drawer-actions {
  margin-top: 12px;
}

.drawer-switch {
  appearance: none;
  padding: 7px 13px;
  border: 1px solid rgba(139, 92, 246, 0.45);
  border-radius: 9px;
  background: rgba(139, 92, 246, 0.14);
  color: #ded6ff;
  font: 500 12px/1.2 var(--font, inherit);
  cursor: pointer;
  transition: background-color 0.16s ease, border-color 0.16s ease;
}

.drawer-switch:hover {
  background: rgba(139, 92, 246, 0.24);
  border-color: rgba(139, 92, 246, 0.65);
}

.drawer-status-note {
  margin: 0;
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--text-dim);
}

.drawer-status-note.off {
  color: #f0b25c;
}

.drawer-tab.off {
  opacity: 0.62;
}

.drawer-tab.is-current:not(.active) {
  border-style: dashed;
}

html[data-theme="light"] .drawer-switch {
  color: #5b21b6;
  background: rgba(139, 92, 246, 0.12);
}

html[data-theme="light"] .drawer-status-note.off {
  color: #b45309;
}

@media (max-width: 520px) {
  .drawer-tabs {
    flex-wrap: wrap;
  }

  .drawer-tab {
    flex: 1 1 42%;
  }
}

.drawer-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}

.drawer-chip {
  padding: 3px 9px;
  border: 1px solid var(--line);
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.025);
  color: var(--text-faint);
  font-size: 10.5px;
}

.drawer-section {
  margin-top: 20px;
}

.drawer-h4 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 0 0 10px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: var(--text-faint);
  text-transform: uppercase;
}

.drawer-h4-note {
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 400;
  letter-spacing: 0.02em;
  color: #565766;
  text-transform: none;
}

.radar-wrap {
  padding: 6px 4px 2px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.015);
}

.radar {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

.radar-grid {
  fill: none;
  stroke: rgba(255, 255, 255, 0.07);
  stroke-width: 1;
}

.radar-axis {
  stroke: rgba(255, 255, 255, 0.06);
  stroke-width: 1;
}

.radar-shape {
  fill: url(#radarFill);
  stroke: rgba(167, 139, 250, 0.9);
  stroke-width: 1.4;
  stroke-linejoin: round;
}

.radar-dot {
  fill: #67e8f9;
  stroke: rgba(8, 8, 12, 0.9);
  stroke-width: 1.5;
}

.radar-label {
  fill: #a2a3b3;
  font-size: 11px;
  font-family: var(--font-sans);
}

.radar-score {
  fill: #67e8f9;
  font-size: 10px;
  font-family: var(--font-mono);
}

.radar-note {
  margin: 6px 6px 4px;
  font-size: 10px;
  color: #565766;
  text-align: right;
  letter-spacing: 0.02em;
}

.params {
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.015);
}

.param-row {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 10px;
  padding: 9px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 12px;
  line-height: 1.7;
}

.param-row:last-child {
  border-bottom: 0;
}

.param-key {
  color: var(--text-faint);
  letter-spacing: 0.02em;
}

.param-val {
  color: var(--text);
  overflow-wrap: anywhere;
}

.param-row.accent {
  background: rgba(34, 211, 238, 0.045);
  box-shadow: inset 2px 0 0 rgba(34, 211, 238, 0.55);
}

.param-row.accent .param-key {
  color: #7dd3fc;
}

.param-row.accent .param-val {
  color: #e0f2fe;
}

.traits {
  display: flex;
  flex-direction: column;
  gap: 1px;
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.015);
}

.trait {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 12px;
  color: var(--text-dim);
  line-height: 1.65;
}

.trait:last-child {
  border-bottom: 0;
}

.trait::before {
  content: "";
  flex: 0 0 auto;
  width: 5px;
  height: 5px;
  margin-top: 7px;
  border-radius: 50%;
  background: var(--brand-3);
  opacity: 0.7;
}

.disclaimer {
  margin-top: 20px;
  padding: 12px 13px;
  border: 1px solid rgba(251, 191, 36, 0.18);
  border-radius: 12px;
  background: rgba(251, 191, 36, 0.035);
}

.disclaimer-title {
  margin: 0 0 5px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: #fcd34d;
  text-transform: uppercase;
}

.disclaimer-text {
  margin: 0;
  font-size: 11.5px;
  line-height: 1.75;
  color: #b9af92;
  overflow-wrap: anywhere;
}

/* ---------------- 彩蛋横幅 & toast ---------------- */

.easter {
  position: fixed;
  left: 50%;
  bottom: 104px;
  z-index: 80;
  display: flex;
  align-items: center;
  gap: 11px;
  max-width: calc(100vw - 32px);
  padding: 11px 12px 11px 14px;
  border: 1px solid rgba(52, 211, 153, 0.35);
  border-radius: 12px;
  background: #0b1512;
  box-shadow: 0 24px 70px -22px rgba(16, 185, 129, 0.5);
  font-family: var(--font-mono);
  transform: translate(-50%, 0);
  animation: easterIn 0.34s var(--ease-out);
}

.easter[hidden] {
  display: none;
}

.easter-bar {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  flex: 0 0 auto;
}

.easter-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 10px rgba(52, 211, 153, 0.9);
  animation: softPulse 1.6s ease-in-out infinite;
}

.easter-tag {
  padding: 1px 5px;
  border: 1px solid rgba(52, 211, 153, 0.4);
  border-radius: 4px;
  color: var(--ok);
  font-size: 9.5px;
  letter-spacing: 0.08em;
}

.easter-text {
  font-size: 12.5px;
  color: #a7f3d0;
  letter-spacing: 0.02em;
}

.easter-close {
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  color: #6ee7b7;
}

.easter-close .ic {
  width: 13px;
  height: 13px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 34px;
  z-index: 90;
  max-width: calc(100vw - 32px);
  padding: 8px 15px;
  border: 1px solid var(--line-strong);
  border-radius: 99px;
  background: rgba(24, 24, 35, 0.96);
  color: var(--text-dim);
  font-size: 12px;
  box-shadow: 0 18px 44px -16px rgba(0, 0, 0, 0.9);
  transform: translateX(-50%);
  animation: toastIn 0.22s var(--ease-out);
}

.toast[hidden] {
  display: none;
}

/* 一秒弹窗：点附件 / 想看源码时出现 */
.human-popup {
  position: fixed;
  left: 50%;
  top: 44%;
  z-index: 95;
  width: max-content;
  min-width: 220px;
  max-width: min(86vw, 340px);
  padding: 16px 20px 15px;
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  background: rgba(23, 23, 33, 0.97);
  box-shadow: 0 24px 70px -18px rgba(0, 0, 0, 0.95);
  text-align: center;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, -46%) scale(0.96);
  transition: opacity 0.18s var(--ease-out), transform 0.18s var(--ease-out);
}

.human-popup.show {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.human-popup[hidden] {
  display: none;
}

.hp-ic {
  font-size: 22px;
  line-height: 1;
}

.hp-title {
  margin-top: 8px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
}

.hp-sub {
  margin-top: 5px;
  font-size: 11.5px;
  line-height: 1.55;
  color: var(--text-dim);
}

html[data-theme="light"] .human-popup {
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 24px 60px -20px rgba(30, 20, 60, 0.35);
}

/* 加载失败兜底 */
.fatal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--bg);
  color: var(--text-dim);
  font-size: 14px;
  text-align: center;
}

/* ---------------- 动效 ---------------- */

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes dotBounce {
  0%,
  80%,
  100% {
    transform: translateY(0);
    opacity: 0.35;
  }
  40% {
    transform: translateY(-4px);
    opacity: 1;
  }
}

@keyframes blink {
  0%,
  49% {
    opacity: 1;
  }
  50%,
  100% {
    opacity: 0;
  }
}

@keyframes softPulse {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.5;
    transform: scale(0.86);
  }
}

@keyframes avatarGlow {
  0%,
  100% {
    box-shadow: 0 7px 18px -8px rgba(139, 92, 246, 0.8);
  }
  50% {
    box-shadow: 0 7px 26px -4px rgba(34, 211, 238, 0.65);
  }
}

@keyframes floatY {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-5px);
  }
}

@keyframes popIn {
  from {
    opacity: 0;
    transform: translateY(-4px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translate(-50%, 8px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

@keyframes easterIn {
  from {
    opacity: 0;
    transform: translate(-50%, 16px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

@keyframes itemFlash {
  0% {
    background: rgba(139, 92, 246, 0.22);
  }
  100% {
    background: transparent;
  }
}

/* ---------------- 响应式：<900px 单栏，侧栏抽屉化 ---------------- */

@media (max-width: 899px) {
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 85;
    width: 84vw;
    max-width: 320px;
    border-right: 1px solid var(--line-strong);
    box-shadow: 30px 0 80px -30px rgba(0, 0, 0, 0.9);
    transform: translateX(-104%);
    transition: transform 0.3s var(--ease-out);
    will-change: transform;
  }

  body.sidebar-open .sidebar {
    transform: none;
  }

  .sidebar-close {
    display: inline-flex;
  }

  .sidebar-scrim {
    z-index: 80;
  }

  .menu-btn {
    display: inline-flex;
  }

  .topbar {
    flex-basis: 54px;
    height: 54px;
    padding: 0 12px;
  }

  .ghost-btn-label {
    display: none;
  }

  .ghost-btn {
    padding: 0 9px;
  }

  .chat-inner {
    padding: 18px 14px 8px;
  }

  .empty {
    padding: 6px 0 18px;
  }

  .empty-mark {
    width: 66px;
    height: 66px;
    margin-bottom: 16px;
    border-radius: 20px;
  }

  .empty-mark svg {
    width: 38px;
    height: 38px;
  }

  .empty-brand {
    font-size: 31px;
  }

  .empty-latin {
    font-size: 9px;
    letter-spacing: 0.1em;
  }

  .empty-slogan {
    margin-top: 13px;
    font-size: 14px;
  }

  .empty-hello {
    margin: 20px 0 12px;
    font-size: 15.5px;
  }

  .suggestions {
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
    max-width: 100%;
    padding: 0 2px;
  }

  .suggestion {
    padding: 10px 12px;
    font-size: 12px;
  }

  .messages {
    gap: 18px;
  }

  .msg {
    gap: 9px;
  }

  .avatar {
    flex-basis: 26px;
    width: 26px;
    height: 26px;
    border-radius: 9px;
  }

  .avatar svg {
    width: 15px;
    height: 15px;
  }

  .msg-sender {
    font-size: 11px;
  }

  .msg-text,
  .bubble {
    font-size: 14px;
  }

  .bubble {
    max-width: 88%;
  }

  .composer-dock {
    padding: 6px 12px 8px;
  }

  .composer {
    padding: 10px 9px 8px 13px;
    border-radius: 18px;
  }

  .composer-hint {
    display: none;
  }

  .footer-note {
    margin-top: 6px;
    font-size: 9.5px;
    padding: 0 6px;
  }

  .drawer {
    width: 100%;
    border-left: 0;
  }

  .drawer-body {
    padding: 14px 14px 26px;
  }

  .easter {
    bottom: 112px;
    width: calc(100vw - 24px);
    padding: 10px;
  }

  .easter-text {
    font-size: 11.5px;
    flex: 1 1 auto;
  }
}

@media (min-width: 900px) {
  .menu-btn,
  .sidebar-close,
  .sidebar-scrim {
    display: none !important;
  }
}

/* 短屏：空态收紧一点（保留 logo，只是缩小） */
@media (max-height: 760px) and (max-width: 899px) {
  .empty-mark {
    width: 54px;
    height: 54px;
    margin-bottom: 12px;
    border-radius: 16px;
  }

  .empty-mark svg {
    width: 31px;
    height: 31px;
  }

  .empty-hello {
    margin: 14px 0 10px;
  }
}

/* 减少动效偏好 */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* ============================================================
   主题切换：深色 / 浅色 / 按时间自动
   ============================================================ */

html[data-theme="dark"] {
  color-scheme: dark;
}

html[data-theme="light"] {
  color-scheme: light;
}

.theme-wrap {
  position: relative;
}

.theme-btn {
  height: 34px;
}

.theme-icon {
  display: inline-flex;
}

.theme-icon .ic {
  width: 15px;
  height: 15px;
}

.theme-icon-moon {
  display: none;
}

html[data-theme="light"] .theme-icon-sun {
  display: none;
}

html[data-theme="light"] .theme-icon-moon {
  display: inline-flex;
}

.theme-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 45;
  width: 218px;
  max-width: calc(100vw - 24px);
  padding: 6px;
  border: 1px solid var(--line-strong);
  border-radius: 13px;
  background: var(--panel);
  box-shadow: 0 24px 64px -20px rgba(0, 0, 0, 0.85);
  animation: popIn 0.18s var(--ease-out);
}

.theme-item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 8px 9px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--text-dim);
  font-size: 12.5px;
  text-align: left;
  cursor: pointer;
  transition: background-color 0.14s ease, color 0.14s ease, border-color 0.14s ease;
}

.theme-item:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
}

.theme-item.active {
  background: rgba(139, 92, 246, 0.1);
  border-color: rgba(139, 92, 246, 0.22);
  color: var(--text);
}

.theme-item-ic {
  display: inline-flex;
  flex: 0 0 auto;
  color: var(--text-faint);
}

.theme-item.active .theme-item-ic {
  color: var(--brand-3);
}

.theme-item-ic .ic {
  width: 15px;
  height: 15px;
}

.theme-item-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.theme-item-name {
  font-size: 12.5px;
}

.theme-item-sub {
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.01em;
  color: var(--text-faint);
}

.theme-check {
  display: inline-flex;
  margin-left: auto;
  color: var(--brand-3);
  opacity: 0;
  transition: opacity 0.14s ease;
}

.theme-item.active .theme-check {
  opacity: 1;
}

.theme-check .ic {
  width: 14px;
  height: 14px;
}

/* ---------------- 浅色主题 ---------------- */

html[data-theme="light"] {
  --bg: #f4f5fb;
  --bg-sidebar: #f8f9fd;
  --panel: #ffffff;
  --panel-2: #f1f2f8;
  --line: rgba(17, 24, 39, 0.09);
  --line-strong: rgba(17, 24, 39, 0.16);
  --text: #1b1d2b;
  --text-dim: #4b4e63;
  --text-faint: #7c7f93;
  --brand-1: #7c3aed;
  --brand-2: #0891b2;
  --brand-3: #6d28d9;
  --brand-soft: rgba(139, 92, 246, 0.1);
  --brand-line: rgba(124, 58, 237, 0.34);
  --danger: #dc2626;
  --warn: #b45309;
}

html[data-theme="light"] body {
  background: var(--bg);
}

html[data-theme="light"] body::before {
  background:
    radial-gradient(900px 520px at 16% -12%, rgba(139, 92, 246, 0.13), transparent 62%),
    radial-gradient(820px 480px at 88% -8%, rgba(8, 145, 178, 0.1), transparent 60%),
    radial-gradient(700px 600px at 50% 120%, rgba(99, 102, 241, 0.07), transparent 65%);
}

html[data-theme="light"] ::selection {
  background: rgba(139, 92, 246, 0.22);
  color: #11131c;
}

/* 侧栏 */
html[data-theme="light"] .sidebar {
  background: linear-gradient(180deg, rgba(252, 252, 255, 0.97), rgba(243, 244, 250, 0.98));
}

html[data-theme="light"] .new-chat {
  background:
    linear-gradient(180deg, rgba(139, 92, 246, 0.12), rgba(139, 92, 246, 0.03)),
    #ffffff;
  box-shadow: 0 1px 2px rgba(17, 24, 39, 0.04);
}

html[data-theme="light"] .new-chat:hover {
  background:
    linear-gradient(180deg, rgba(139, 92, 246, 0.18), rgba(34, 211, 238, 0.05)),
    #ffffff;
}

html[data-theme="light"] .icon-btn:hover {
  background: rgba(17, 24, 39, 0.05);
}

html[data-theme="light"] .history-item:hover {
  background: rgba(17, 24, 39, 0.045);
}

html[data-theme="light"] .history-item.active {
  background: rgba(139, 92, 246, 0.1);
}

html[data-theme="light"] .load-card {
  background: rgba(255, 255, 255, 0.72);
}

html[data-theme="light"] .load-card:hover {
  background: #ffffff;
}

html[data-theme="light"] .load-track {
  background: rgba(17, 24, 39, 0.08);
}

html[data-theme="light"] .metrics-panel {
  background: #ffffff;
  box-shadow: 0 24px 60px -18px rgba(15, 23, 42, 0.22), 0 0 0 1px rgba(15, 23, 42, 0.03);
}

html[data-theme="light"] .metric-row {
  border-bottom-color: rgba(17, 24, 39, 0.06);
}

html[data-theme="light"] .metric-track {
  background: rgba(17, 24, 39, 0.07);
}

/* 顶栏 */
html[data-theme="light"] .topbar {
  background: rgba(247, 248, 252, 0.74);
}

html[data-theme="light"] .ghost-btn:hover {
  background: rgba(17, 24, 39, 0.05);
}

html[data-theme="light"] .conn-pill {
  background: rgba(251, 191, 36, 0.16);
  border-color: rgba(180, 83, 9, 0.28);
  color: #a16207;
}

/* 空态 */
html[data-theme="light"] .empty-mark {
  background:
    radial-gradient(circle at 30% 20%, rgba(139, 92, 246, 0.2), transparent 62%),
    radial-gradient(circle at 72% 82%, rgba(34, 211, 238, 0.16), transparent 60%),
    #ffffff;
  border-color: rgba(139, 92, 246, 0.24);
  box-shadow: 0 26px 70px -34px rgba(109, 40, 217, 0.4);
}

html[data-theme="light"] .empty-brand {
  background: linear-gradient(115deg, #5b21b6 0%, #7c3aed 42%, #0e7490 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

html[data-theme="light"] .empty-latin {
  color: var(--text-faint);
}

html[data-theme="light"] .empty-slogan {
  color: var(--text-dim);
}

html[data-theme="light"] .empty-hello {
  color: var(--text);
}

html[data-theme="light"] .suggestion {
  background: rgba(255, 255, 255, 0.75);
}

html[data-theme="light"] .suggestion:hover {
  background: rgba(139, 92, 246, 0.07);
}

/* 消息流 */
html[data-theme="light"] .bubble {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.13), rgba(34, 211, 238, 0.07));
  border-color: rgba(139, 92, 246, 0.22);
}

html[data-theme="light"] .msg.user.failed .bubble {
  background: rgba(220, 38, 38, 0.08);
  border-color: rgba(220, 38, 38, 0.45);
}

html[data-theme="light"] .msg-text {
  color: #242636;
}

html[data-theme="light"] .think-block {
  background: rgba(17, 24, 39, 0.03);
  border-color: rgba(17, 24, 39, 0.08);
  border-left-color: rgba(124, 58, 237, 0.55);
}

html[data-theme="light"] .think-head:hover {
  background: rgba(17, 24, 39, 0.04);
}

html[data-theme="light"] .think-text {
  color: #5f6275;
}

html[data-theme="light"] .think-cursor {
  color: #7c3aed;
}

html[data-theme="light"] .stream-cursor {
  color: #7c3aed;
}

html[data-theme="light"] .system-note {
  background: rgba(17, 24, 39, 0.03);
}

html[data-theme="light"] .msg-action:hover {
  background: rgba(17, 24, 39, 0.06);
  color: var(--text);
}

html[data-theme="light"] .msg.user .bubble,
html[data-theme="light"] .msg-text,
html[data-theme="light"] .think-text {
  -webkit-font-smoothing: antialiased;
}

/* 输入区 */
html[data-theme="light"] .composer-dock {
  background: linear-gradient(180deg, rgba(244, 245, 251, 0) 0%, rgba(244, 245, 251, 0.72) 34%, rgba(244, 245, 251, 0.96) 100%);
}

html[data-theme="light"] .composer {
  background: rgba(255, 255, 255, 0.92);
  box-shadow:
    0 18px 50px -26px rgba(15, 23, 42, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

html[data-theme="light"] .composer:focus-within {
  box-shadow:
    0 20px 55px -26px rgba(109, 40, 217, 0.28),
    0 0 0 3px rgba(139, 92, 246, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

html[data-theme="light"] #composerInput::placeholder {
  color: #9a9dae;
}

html[data-theme="light"] .footer-note {
  color: #8b8e9f;
}

html[data-theme="light"] .composer-tool {
  color: #9a9dae;
}

html[data-theme="light"] .send-btn:disabled {
  background: rgba(17, 24, 39, 0.08);
  color: #a3a5b5;
}

/* 模型详情抽屉 */
html[data-theme="light"] .drawer {
  background: linear-gradient(180deg, #fbfbfe 0%, #eef0f7 100%);
  box-shadow: -30px 0 80px -40px rgba(15, 23, 42, 0.25);
}

html[data-theme="light"] .drawer-head {
  background: rgba(255, 255, 255, 0.55);
}

html[data-theme="light"] .drawer-tab {
  background: rgba(255, 255, 255, 0.5);
}

html[data-theme="light"] .drawer-tab.active {
  background: rgba(139, 92, 246, 0.1);
}

html[data-theme="light"] .drawer-hero {
  background:
    radial-gradient(360px 160px at 12% -20%, rgba(139, 92, 246, 0.12), transparent 70%),
    radial-gradient(300px 160px at 100% 120%, rgba(34, 211, 238, 0.08), transparent 70%),
    rgba(255, 255, 255, 0.72);
}

html[data-theme="light"] .drawer-model-name {
  background: linear-gradient(110deg, #4c1d95, #6d28d9 45%, #0e7490);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

html[data-theme="light"] .drawer-model-badge {
  background: rgba(139, 92, 246, 0.1);
  border-color: rgba(124, 58, 237, 0.3);
  color: #5b21b6;
}

html[data-theme="light"] .drawer-chip,
html[data-theme="light"] .params,
html[data-theme="light"] .traits {
  background: rgba(255, 255, 255, 0.62);
}

html[data-theme="light"] .param-row {
  border-bottom-color: rgba(17, 24, 39, 0.06);
}

html[data-theme="light"] .param-row.accent {
  background: rgba(34, 211, 238, 0.09);
}

html[data-theme="light"] .param-row.accent .param-key {
  color: #0369a1;
}

html[data-theme="light"] .param-row.accent .param-val {
  color: #0c4a6e;
}

html[data-theme="light"] .radar-wrap {
  background: rgba(255, 255, 255, 0.62);
}

html[data-theme="light"] .radar-grid {
  stroke: rgba(17, 24, 39, 0.13);
}

html[data-theme="light"] .radar-axis {
  stroke: rgba(17, 24, 39, 0.1);
}

html[data-theme="light"] .radar-shape {
  stroke: rgba(124, 58, 237, 0.9);
}

html[data-theme="light"] .radar-dot {
  fill: #0e7490;
  stroke: #ffffff;
}

html[data-theme="light"] .radar-label {
  fill: #52556b;
}

html[data-theme="light"] .radar-score {
  fill: #0e7490;
}

html[data-theme="light"] .radar-note {
  color: var(--text-faint);
}

html[data-theme="light"] .drawer-h4-note {
  color: #9fa1b0;
}

html[data-theme="light"] .trait::before {
  background: #7c3aed;
}

html[data-theme="light"] .disclaimer {
  background: rgba(251, 191, 36, 0.09);
  border-color: rgba(180, 83, 9, 0.22);
}

html[data-theme="light"] .disclaimer-title {
  color: #a16207;
}

html[data-theme="light"] .disclaimer-text {
  color: #7c5a12;
}

/* 浮层与横幅 */
html[data-theme="light"] .theme-menu {
  background: #ffffff;
  box-shadow: 0 24px 64px -20px rgba(15, 23, 42, 0.25);
}

html[data-theme="light"] .theme-item:hover {
  background: rgba(17, 24, 39, 0.05);
}

html[data-theme="light"] .theme-item.active {
  background: rgba(139, 92, 246, 0.1);
}

html[data-theme="light"] .scrim {
  background: rgba(15, 23, 42, 0.22);
}

html[data-theme="light"] .toast {
  background: rgba(255, 255, 255, 0.98);
  color: var(--text-dim);
  box-shadow: 0 18px 44px -16px rgba(15, 23, 42, 0.2);
}

html[data-theme="light"] .easter {
  background: #f0fdf9;
  border-color: rgba(5, 150, 105, 0.35);
  box-shadow: 0 24px 70px -22px rgba(16, 185, 129, 0.25);
}

html[data-theme="light"] .easter-text {
  color: #047857;
}

html[data-theme="light"] .easter-tag {
  color: #059669;
  border-color: rgba(5, 150, 105, 0.35);
}

html[data-theme="light"] .easter-close {
  color: #059669;
}

/* 滚动条（浅色） */
html[data-theme="light"] .history,
html[data-theme="light"] .chat-scroll,
html[data-theme="light"] .drawer-body,
html[data-theme="light"] .metrics-panel,
html[data-theme="light"] #composerInput {
  scrollbar-color: rgba(17, 24, 39, 0.18) transparent;
}

html[data-theme="light"] .history::-webkit-scrollbar-thumb,
html[data-theme="light"] .chat-scroll::-webkit-scrollbar-thumb {
  background: rgba(17, 24, 39, 0.16);
}

@media (max-width: 899px) {
  .conn-pill {
    max-width: 34vw;
  }

  .theme-btn {
    padding: 0 8px;
  }
}

/* ============================================================
   趣味细节：反馈按键 / 停止键 / 等待注释 / 许可证 / 员工守则 / 咖啡雨
   ============================================================ */

/* 发送键的「停止」形态 */
.send-btn .icon-stop {
  display: none;
}

.send-btn.is-stop {
  animation: stopPulse 1.6s ease-in-out infinite;
}

.send-btn.is-stop .icon-send {
  display: none;
}

.send-btn.is-stop .icon-stop {
  display: block;
}

@keyframes stopPulse {
  0%,
  100% {
    box-shadow: 0 8px 22px -8px rgba(139, 92, 246, 0.75);
  }
  50% {
    box-shadow: 0 8px 26px -6px rgba(34, 211, 238, 0.8);
  }
}

/* 回答操作：复制 + 赞/踩 */
.msg-action.feedback .ic {
  transition: transform 0.15s ease;
}

.msg-action.feedback-down .ic {
  transform: rotate(180deg);
}

.msg-action.feedback.active {
  color: var(--brand-3);
  background: rgba(139, 92, 246, 0.14);
}

/* 等待行下方的彩蛋注释 */
.waiting-notes {
  margin: -2px 0 7px;
}

.waiting-notes:empty {
  display: none;
}

.waiting-note {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10.5px;
  line-height: 1.55;
  color: var(--text-faint);
  letter-spacing: 0.01em;
  animation: rise 0.2s var(--ease-out);
}

.waiting-note::before {
  content: "";
  flex: 0 0 auto;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--warn);
  opacity: 0.85;
}

/* 指标面板底部注释 */
.metrics-note {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed var(--line);
  font-size: 10px;
  line-height: 1.6;
  color: var(--text-faint);
}

/* 模型许可证（原生 details） */
.license {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.015);
  overflow: hidden;
}

.license summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  color: var(--text-dim);
  font-size: 11.5px;
  letter-spacing: 0.01em;
  cursor: pointer;
  list-style: none;
}

.license summary::-webkit-details-marker {
  display: none;
}

.license summary::before {
  content: "+";
  flex: 0 0 auto;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--brand-3);
}

.license[open] summary::before {
  content: "−";
}

.license-list {
  margin: 0;
  padding: 0 14px 12px 32px;
  color: var(--text-dim);
  font-size: 11.5px;
  line-height: 1.82;
}

.license-list li {
  margin: 3px 0;
}

.license-list li::marker {
  color: var(--brand-3);
  font-family: var(--font-mono);
  font-size: 10px;
}

/* 员工守则弹层（连点 logo 5 次） */
.egg-modal {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(4, 4, 8, 0.66);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}

.egg-modal-card {
  width: min(440px, 100%);
  max-height: 82vh;
  overflow-y: auto;
  padding: 18px 18px 16px;
  border: 1px solid var(--line-strong);
  border-radius: 18px;
  background: var(--panel);
  box-shadow: 0 40px 100px -30px rgba(0, 0, 0, 0.9);
  animation: popIn 0.22s var(--ease-out);
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.14) transparent;
}

.egg-modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.egg-modal-kicker {
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.16em;
  color: var(--brand-3);
  opacity: 0.8;
}

.egg-modal-title {
  margin: 2px 0 0;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.egg-rules {
  margin: 14px 0 0;
  padding-left: 22px;
  color: var(--text-dim);
  font-size: 12.5px;
  line-height: 1.85;
}

.egg-rules li {
  margin: 5px 0;
  padding-left: 2px;
}

.egg-rules li::marker {
  color: var(--brand-3);
  font-family: var(--font-mono);
}

.egg-modal-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.egg-modal-note {
  font-size: 10.5px;
  color: var(--text-faint);
}

.egg-modal-foot .ghost-btn {
  border: 1px solid var(--line-strong);
}

/* Konami 咖啡/摸鱼雨 */
.egg-rain {
  position: fixed;
  inset: 0;
  z-index: 110;
  overflow: hidden;
  pointer-events: none;
}

.egg-rain-item {
  position: absolute;
  top: -10vh;
  display: inline-flex;
  color: var(--brand-3);
  animation-name: rainFall;
  animation-timing-function: linear;
  animation-fill-mode: forwards;
  will-change: transform;
}

.egg-rain-item .ic {
  width: 1em;
  height: 1em;
}

@keyframes rainFall {
  from {
    transform: translate3d(0, -10vh, 0) rotate(0deg);
  }
  to {
    transform: translate3d(0, 115vh, 0) rotate(240deg);
    opacity: 0;
  }
}

/* 浅色主题补充 */
html[data-theme="light"] .license {
  background: rgba(255, 255, 255, 0.62);
}

html[data-theme="light"] .egg-modal {
  background: rgba(15, 23, 42, 0.28);
}

html[data-theme="light"] .egg-modal-card {
  background: #ffffff;
  box-shadow: 0 40px 100px -32px rgba(15, 23, 42, 0.3);
}

html[data-theme="light"] .msg-action.feedback.active {
  background: rgba(139, 92, 246, 0.13);
}

html[data-theme="light"] .egg-rain-item {
  color: #7c3aed;
}

/* ============================================================
   二期：转人工 / 分享 / 掉线 / 撤回 / 重答 / 延迟分布 / 页脚
   ============================================================ */

/* 移动端顶部更紧凑，容纳新增按钮 */
@media (max-width: 899px) {
  .topbar-right {
    gap: 4px;
  }

  .topbar-right .ghost-btn {
    padding: 0 6px;
  }

  .topbar-right .ghost-btn .ic {
    width: 14px;
    height: 14px;
  }

  .topbar-right .theme-btn {
    padding: 0 6px;
  }

  .conn-pill {
    max-width: 22vw;
  }

  .blackout-bar {
    padding: 5px 12px;
    font-size: 10.5px;
  }
}

@media (max-width: 430px) {
  .topbar {
    padding: 0 8px;
    gap: 6px;
  }

  .topbar-left,
  .topbar-right {
    gap: 3px;
  }

  .topbar-right .ghost-btn,
  .topbar-right .theme-btn {
    padding: 0 5px;
  }
}

/* 假装掉线：细长黄条，不遮对话 */
.blackout-bar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 30px;
  padding: 5px 18px;
  border-bottom: 1px solid rgba(251, 191, 36, 0.24);
  background: rgba(251, 191, 36, 0.08);
  color: #fcd34d;
  font-size: 11.5px;
  line-height: 1.5;
  letter-spacing: 0.01em;
}

.blackout-ic {
  flex: 0 0 auto;
  width: 14px;
  height: 14px;
  color: #fbbf24;
}

.blackout-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.blackout-count {
  flex: 0 0 auto;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: #fcd34d;
  opacity: 0.85;
  font-variant-numeric: tabular-nums;
}

/* 撤回动画 */
.msg.recalled {
  opacity: 0;
  transform: translateX(10px) scale(0.99);
  transition: opacity 0.26s ease, transform 0.26s ease;
  pointer-events: none;
}

/* 重新生成按钮 */
.msg-action.regen .ic {
  transition: transform 0.28s ease;
}

.msg-action.regen.cooldown {
  opacity: 0.4;
}

.msg-action.regen.cooldown .ic {
  transform: rotate(-140deg);
}

/* 延迟分布迷你图 */
.latency-wrap {
  padding: 8px 8px 2px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.015);
}

.latency-svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

.latency-bar {
  fill: url(#latencyGrad);
  opacity: 0.9;
}

.latency-axis {
  stroke: rgba(255, 255, 255, 0.1);
  stroke-width: 1;
}

.latency-value {
  fill: var(--brand-3);
  font-family: var(--font-mono);
  font-size: 11px;
}

.latency-label {
  fill: var(--text-faint);
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.04em;
}

.latency-note {
  margin-top: 6px;
  text-align: right;
  font-size: 10px;
  color: var(--text-faint);
  letter-spacing: 0.01em;
}

/* 页脚 made-by：hover 翻转 */
.made-by {
  max-width: 800px;
  margin: 3px auto 0;
  text-align: center;
  font-size: 10px;
  line-height: 1.6;
  color: var(--text-faint);
  letter-spacing: 0.02em;
  cursor: default;
  -webkit-user-select: none;
  user-select: none;
}

.made-by-human {
  display: none;
}

.made-by:hover .made-by-ai {
  display: none;
}

.made-by:hover .made-by-human {
  display: inline;
}

/* 浅色主题补充 */
html[data-theme="light"] .blackout-bar {
  background: rgba(251, 191, 36, 0.14);
  border-bottom-color: rgba(180, 83, 9, 0.24);
  color: #92400e;
}

html[data-theme="light"] .blackout-ic,
html[data-theme="light"] .blackout-count {
  color: #b45309;
}

html[data-theme="light"] .latency-wrap {
  background: rgba(255, 255, 255, 0.62);
}

html[data-theme="light"] .latency-axis {
  stroke: rgba(17, 24, 39, 0.12);
}

html[data-theme="light"] .latency-label {
  fill: #52556b;
}

html[data-theme="light"] .latency-value {
  fill: #5b21b6;
}

html[data-theme="light"] .latency-note {
  color: var(--text-faint);
}

/* ============================================================
   三期：专属人类 / 合规弹窗 / 拉黑提示
   ============================================================ */

.sidebar-human {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 2px 4px;
  font-size: 10.5px;
  line-height: 1.5;
  color: var(--text-faint);
}

.sidebar-human-dot {
  flex: 0 0 auto;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 8px rgba(52, 211, 153, 0.6);
  animation: softPulse 2.6s ease-in-out infinite;
}

.sidebar-human-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-human strong {
  color: var(--text-dim);
  font-weight: 600;
}

.empty-human {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin: 12px 0 0;
  padding: 4px 11px;
  border: 1px solid var(--line);
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.025);
  color: var(--text-faint);
  font-size: 11px;
  line-height: 1.5;
}

.empty-human strong {
  color: var(--text-dim);
  font-weight: 600;
}

.empty-human-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 8px rgba(52, 211, 153, 0.6);
  animation: softPulse 2.6s ease-in-out infinite;
}

/* 页脚合规链接 */
.footer-link {
  padding: 0 2px;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: inherit;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-color: rgba(255, 255, 255, 0.22);
}

.footer-link:hover {
  color: var(--text-dim);
}

.footer-sep {
  margin: 0 6px;
  opacity: 0.7;
}

/* 合规 / 拉黑弹窗 */
.notice-modal {
  position: fixed;
  inset: 0;
  z-index: 150;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(4, 4, 8, 0.62);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

.notice-card {
  width: min(520px, 100%);
  max-height: 84vh;
  overflow-y: auto;
  padding: 24px 24px 20px;
  border: 1px solid var(--line-strong);
  border-radius: 18px;
  background: var(--panel);
  box-shadow: 0 40px 100px -30px rgba(0, 0, 0, 0.85);
  animation: popIn 0.24s var(--ease-out);
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.14) transparent;
}

.notice-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.notice-ic {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  border: 1px solid rgba(139, 92, 246, 0.22);
  border-radius: 12px;
  background: rgba(139, 92, 246, 0.12);
  color: var(--brand-3);
}

.notice-ic .ic {
  width: 21px;
  height: 21px;
}

.notice-head-text {
  min-width: 0;
}

.notice-kicker {
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.16em;
  color: var(--brand-3);
  opacity: 0.8;
}

.notice-title {
  margin: 3px 0 0;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.notice-body {
  margin: 16px 0 0;
  color: var(--text-dim);
  font-size: 13px;
  line-height: 1.9;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.notice-footer {
  margin: 12px 0 0;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  color: var(--text-faint);
  font-size: 11px;
  line-height: 1.7;
}

.notice-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 20px;
}

.notice-ok {
  min-width: 132px;
  height: 38px;
  padding: 0 18px;
  border: 0;
  border-radius: 10px;
  background: linear-gradient(135deg, #8b5cf6, #22d3ee);
  color: #fff;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  box-shadow: 0 10px 26px -10px rgba(139, 92, 246, 0.7);
  transition: filter 0.15s ease, transform 0.12s ease;
}

.notice-ok:hover {
  filter: brightness(1.08);
}

.notice-ok:active {
  transform: scale(0.98);
}

/* 拉黑变体：红色警示，但仍是正规弹窗 */
.notice-modal[data-variant="ban"] .notice-ic {
  border-color: rgba(248, 113, 113, 0.28);
  background: rgba(248, 113, 113, 0.12);
  color: #f87171;
}

.notice-modal[data-variant="ban"] .notice-kicker {
  color: #f87171;
}

.notice-modal[data-variant="ban"] .notice-ok {
  background: linear-gradient(135deg, #ef4444, #f97316);
  box-shadow: 0 10px 26px -10px rgba(239, 68, 68, 0.6);
}

/* 被拉黑后的输入区 */
.is-banned .composer {
  border-color: rgba(248, 113, 113, 0.35);
  background: rgba(248, 113, 113, 0.04);
}

.is-banned #composerInput {
  color: var(--text-faint);
}

.is-banned .composer-tool {
  opacity: 0.3;
}

/* 浅色主题 */
html[data-theme="light"] .sidebar-human {
  color: var(--text-faint);
}

html[data-theme="light"] .empty-human {
  background: rgba(255, 255, 255, 0.7);
}

html[data-theme="light"] .footer-link {
  text-decoration-color: rgba(17, 24, 39, 0.25);
}

html[data-theme="light"] .notice-modal {
  background: rgba(15, 23, 42, 0.3);
}

html[data-theme="light"] .notice-card {
  background: #fff;
  box-shadow: 0 40px 100px -32px rgba(15, 23, 42, 0.3);
}

html[data-theme="light"] .notice-body {
  color: var(--text-dim);
}

@media (max-width: 899px) {
  .notice-modal {
    padding: 16px;
  }

  .notice-card {
    max-height: 86vh;
    padding: 20px 18px 16px;
  }

  .notice-title {
    font-size: 18px;
  }

  .notice-body {
    font-size: 12.5px;
  }

  .notice-actions {
    margin-top: 18px;
  }

  .notice-ok {
    width: 100%;
    min-width: 0;
  }

  .empty-human {
    font-size: 10.5px;
  }
}

/* ============================================================
   输入框弹层定位：composer 位于独立层，向上展开不裁切
   ============================================================ */

.composer-dock {
  position: relative;
  z-index: 30;
}

.composer {
  position: relative;
}

/* ============================================================
   六期：发送键左边的「模型 · 推理等级」合并胶囊 + 向上弹层
   ============================================================ *//* ============================================================
   五期：发送键左边的「推理等级」胶囊 + 向上弹层
   ============================================================ */

.level-wrap {
  position: relative;
  flex: 0 0 auto;
}

.level-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 30px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-dim);
  font-family: inherit;
  font-size: 11px;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  transition: border-color 0.16s ease, background-color 0.16s ease, color 0.16s ease;
}

.level-btn:hover {
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
}

.level-btn[aria-expanded="true"] {
  border-color: var(--brand-line);
  background: rgba(139, 92, 246, 0.1);
  color: var(--text);
}

.level-btn-model,
.level-btn-model-short {
  max-width: 132px;
  overflow: hidden;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--text-dim);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.level-btn-model-short {
  display: none;
}

.level-btn-sep {
  color: var(--text-faint);
  opacity: 0.6;
}

.level-btn-value {
  max-width: 110px;
  overflow: hidden;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-dim);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.level-btn[aria-expanded="true"] .level-btn-value {
  color: var(--brand-3);
}

.level-btn-chev {
  display: inline-flex;
  color: var(--text-faint);
  transition: transform 0.18s ease;
}

.level-btn[aria-expanded="true"] .level-btn-chev {
  transform: rotate(180deg);
}

.level-btn-chev .ic {
  width: 12px;
  height: 12px;
}

/* 面板向上展开，z-index 在输入框之上、抽屉之下 */
.level-menu {
  position: absolute;
  right: 0;
  bottom: calc(100% + 10px);
  z-index: 62;
  width: 340px;
  max-width: calc(100vw - 24px);
  max-height: min(64vh, 520px);
  overflow-y: auto;
  padding: 6px;
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  background: #12121b;
  box-shadow: 0 26px 70px -20px rgba(0, 0, 0, 0.9);
  animation: popIn 0.18s var(--ease-out);
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.14) transparent;
}

.level-summary {
  display: flex;
  flex-direction: column;
}

.level-summary-group {
  min-width: 0;
}

.level-summary-group + .level-summary-group {
  border-top: 1px solid var(--line);
}

.level-summary-row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 54px;
  padding: 8px 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition: background-color 0.14s ease;
}

.level-summary-row:hover {
  background: rgba(255, 255, 255, 0.05);
}

.level-summary-row[aria-expanded="true"] {
  background: rgba(139, 92, 246, 0.1);
}

.level-summary-row:focus-visible {
  outline: 2px solid rgba(139, 92, 246, 0.65);
  outline-offset: -2px;
}

.level-summary-label {
  font-size: 11.5px;
  letter-spacing: 0.02em;
  color: var(--text-faint);
  white-space: nowrap;
}

.level-summary-value {
  margin-left: auto;
  overflow: hidden;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-dim);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.level-summary-row[aria-expanded="true"] .level-summary-value {
  color: var(--brand-3);
}

.level-summary-chev {
  display: inline-flex;
  flex: 0 0 auto;
  color: var(--text-faint);
  transition: transform 0.18s ease;
}

.level-summary-chev .ic {
  width: 14px;
  height: 14px;
}

.level-summary-row[aria-expanded="true"] .level-summary-chev {
  transform: rotate(90deg);
}

.level-expand {
  padding: 0 2px 4px;
}

.level-expand .level-menu-list {
  padding-top: 2px;
}

.level-menu::-webkit-scrollbar {
  width: 6px;
}

.level-menu::-webkit-scrollbar-thumb {
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.16);
}

.level-menu-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-top: 4px;
}

.level-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--text-dim);
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition: background-color 0.14s ease, border-color 0.14s ease;
}

.level-item:hover {
  background: rgba(255, 255, 255, 0.05);
}

.level-item:focus-visible {
  outline: 2px solid rgba(139, 92, 246, 0.65);
  outline-offset: -2px;
}

.level-item.active {
  background: rgba(139, 92, 246, 0.12);
  border-color: rgba(139, 92, 246, 0.22);
}

.level-item-main {
  display: flex;
  flex-direction: column;
  gap: 1px;
  flex: 1 1 auto;
  min-width: 0;
}

.level-item-name {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
}

.level-item.active .level-item-name {
  color: var(--brand-3);
}

.level-item-desc {
  font-size: 10.5px;
  line-height: 1.5;
  color: var(--text-faint);
}

.level-item-check {
  display: inline-flex;
  flex: 0 0 auto;
  color: var(--brand-3);
  opacity: 0;
}

.level-item.active .level-item-check {
  opacity: 1;
}

.level-item-check .ic {
  width: 15px;
  height: 15px;
}

/* 模型行：名称 + badge + tagline */
.model-choice-top {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.level-item-badge {
  flex: 0 0 auto;
  padding: 1px 6px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 99px;
  font-size: 9px;
  line-height: 1.5;
  color: var(--text-faint);
  white-space: nowrap;
}

.level-item.model-choice .level-item-desc {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.level-item.pro {
  opacity: 0.55;
  border-style: dashed;
  border-color: var(--line);
}

.level-item.pro:hover {
  opacity: 0.72;
  background: rgba(255, 255, 255, 0.03);
}

/* 浅色主题 */
html[data-theme="light"] .level-btn {
  background: rgba(255, 255, 255, 0.82);
}

html[data-theme="light"] .level-btn:hover {
  background: #ffffff;
}

html[data-theme="light"] .level-btn[aria-expanded="true"] {
  background: rgba(139, 92, 246, 0.1);
}

html[data-theme="light"] .level-menu {
  background: #ffffff;
  box-shadow: 0 26px 70px -20px rgba(15, 23, 42, 0.25);
}

html[data-theme="light"] .level-item:hover {
  background: rgba(17, 24, 39, 0.05);
}

html[data-theme="light"] .level-item.active {
  background: rgba(139, 92, 246, 0.1);
}

html[data-theme="light"] .level-summary-row:hover {
  background: rgba(17, 24, 39, 0.05);
}

html[data-theme="light"] .level-summary-row[aria-expanded="true"] {
  background: rgba(139, 92, 246, 0.1);
}

html[data-theme="light"] .level-item-badge {
  border-color: rgba(17, 24, 39, 0.14);
}

html[data-theme="light"] .level-menu::-webkit-scrollbar-thumb {
  background: rgba(17, 24, 39, 0.16);
}

@media (max-width: 599px) {
  .level-btn {
    height: 28px;
    padding: 0 8px;
    gap: 4px;
  }

  .level-btn-model {
    display: none;
  }

  .level-btn-model-short {
    display: inline;
    max-width: 52px;
  }

  .level-btn-value {
    max-width: 92px;
    font-size: 10.5px;
  }

  .level-menu {
    width: min(340px, calc(100vw - 20px));
  }
}
