:root {
  font-family: 'Inter', 'Noto Sans SC', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
  line-height: 1.5;
  font-weight: 400;

  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;

  /* 主题色变量 */
  --color-primary-50: #F8FAFC;
  --color-primary-100: #F1F5F9;
  --color-primary-200: #E2E8F0;
  --color-primary-300: #CBD5E1;
  --color-primary-400: #94A3B8;
  --color-primary-500: #64748B;
  --color-primary-600: #475569;
  --color-primary-700: #334155;
  --color-primary-800: #1E293B;
  --color-primary-900: #0F172A;
  --color-primary-950: #020617;

  --color-secondary-500: #10B981;

  --color-gray-50: #F8FAFC;
  --color-gray-100: #F1F5F9;
  --color-gray-200: #E2E8F0;
  --color-gray-300: #CBD5E1;
  --color-gray-400: #94A3B8;
  --color-gray-500: #64748B;
  --color-gray-600: #475569;
  --color-gray-700: #334155;
  --color-gray-800: #1E293B;
  --color-gray-900: #0F172A;

  /* 阴影变量 */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body, #root {
  height: 100%;
  width: 100%;
  overflow: hidden;
}

body {
  margin: 0;
  padding: 0;
  background-color: var(--color-gray-50);
  color: var(--color-gray-800);
}

/* 输入框样式覆盖，确保复制粘贴在移动端正常工作 */
input, textarea, .RNTextInput {
  -webkit-user-select: auto !important;
  user-select: auto !important;
  -webkit-touch-callout: auto !important;
  touch-action: auto !important;
  cursor: text !important;
  font-family: inherit;
  border-radius: 8px;
}

/* 让MUI输入框支持手机粘贴 */
.MuiInputBase-input {
  -webkit-user-select: auto !important;
  user-select: auto !important;
  -webkit-touch-callout: auto !important;
  touch-action: auto !important;
  cursor: text !important;
  font-family: inherit;
}

/* 修复@use-gesture库的touch-action警告 */
[data-gesture] {
  touch-action: none !important;
}

/* 为使用手势的容器添加touch-action */
.gesture-container {
  touch-action: none !important;
}

/* React Native Web TextInput样式增强 */
.RNTextInput {
  -webkit-user-select: auto !important;
  user-select: auto !important;
  -webkit-touch-callout: auto !important;
  touch-action: auto !important;
  cursor: text !important;
  caret-color: var(--color-primary-600);
  border-radius: 8px;
}

/* 移除可能影响输入的全局样式 */
*[contenteditable="true"] {
  -webkit-user-select: auto !important;
  user-select: auto !important;
  -webkit-touch-callout: auto !important;
}

/* 自定义滚动条样式 */
::-webkit-scrollbar {
  width: 4px;
  height: 4px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(100, 116, 139, 0.3);
  border-radius: 2px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(100, 116, 139, 0.5);
}

/* 消息气泡动画 */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.message {
  animation: fadeIn 0.3s ease-out forwards;
}

/* 按钮激活状态 */
.active-button {
  background-color: var(--color-primary-600);
  color: white;
  transform: translateY(1px);
  box-shadow: var(--shadow-sm);
}

/* 卡片样式 */
.card {
  border-radius: 12px;
  background-color: white;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

/* 输入框聚焦效果 */
input:focus, textarea:focus, .RNTextInput:focus {
  outline: 2px solid var(--color-primary-300);
  outline-offset: 0px;
}

/* 🚀 搜索结果折叠UI样式 */
.search-results-collapsible {
  border: 1px solid var(--color-gray-200);
  border-radius: 12px;
  background-color: white;
  margin: 8px 0;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.search-results-summary {
  padding: 12px 16px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  cursor: pointer;
  font-weight: 500;
  font-size: 14px;
  border: none;
  outline: none;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: all 0.2s ease;
  border-radius: 12px 12px 0 0;
}

.search-results-summary:hover {
  background: linear-gradient(135deg, #5a6fd8 0%, #6a4190 100%);
}

/* 当折叠状态时，保持圆角 */
.search-results-collapsible:not([open]) .search-results-summary {
  border-radius: 12px;
}

.search-results-summary::after {
  content: '▼';
  font-size: 12px;
  transition: transform 0.2s ease;
}

.search-results-collapsible[open] .search-results-summary::after {
  transform: rotate(180deg);
}

.search-results-list {
  padding: 16px;
  background-color: #fafbfc;
  border-top: 1px solid var(--color-gray-100);
}

.search-results-list a {
  color: var(--color-gray-700);
  text-decoration: none;
  font-weight: 400;
  line-height: 1.6;
  display: block;
  margin-bottom: 4px;
  padding: 6px 0;
  transition: all 0.2s ease;
  border-bottom: 1px solid transparent;
}

.search-results-list a:hover {
  color: var(--color-primary-600);
  border-bottom-color: var(--color-primary-300);
}

/* 编号样式 */
.search-results-list {
  counter-reset: search-counter;
}

.search-results-list a::before {
  counter-increment: search-counter;
  content: counter(search-counter) ". ";
  color: var(--color-gray-500);
  font-weight: 500;
}

/* 移动端优化 */
@media (max-width: 768px) {
  .search-results-summary {
    padding: 10px 14px;
    font-size: 13px;
  }

  .search-results-list {
    padding: 12px;
  }

  .search-results-list a {
    padding: 6px 10px;
    font-size: 14px;
  }
}

/* 🎨 语法高亮器样式重置 - 修复间距问题 */
.react-syntax-highlighter {
  margin: 0 !important;
  padding: 0 !important;
  overflow: visible !important;
}

.react-syntax-highlighter pre {
  margin: 0 !important;
  padding: 0 !important;
  overflow: visible !important;
  background: transparent !important;
}

.react-syntax-highlighter code {
  margin: 0 !important;
  padding: 0 !important;
  background: transparent !important;
  display: block !important;
}

/* 确保代码块内容不会有额外的间距 */
.react-syntax-highlighter .token-line {
  margin: 0 !important;
  padding: 0 !important;
}

/* 行号样式优化 */
.react-syntax-highlighter .linenumber {
  margin: 0 !important;
  padding: 0 !important;
  padding-right: 1em !important;
  text-align: right !important;
  user-select: none !important;
  opacity: 0.5 !important;
}
