/* 全局基础样式 */
* { -webkit-tap-highlight-color: transparent; }

html, body {
  font-feature-settings: 'cv02', 'cv03', 'cv04', 'cv11';
  text-rendering: optimizeLegibility;
}

/* 暗色 / 浅色主题切换 */
html:not(.dark) body {
  background: #f4f6f9;
  color: #1f2937;
}
html:not(.dark) .bg-\[\#020403\] { background-color: #f4f6f9 !important; }
html:not(.dark) .bg-\[\#020403\]\/80 { background-color: rgba(255,255,255,0.85) !important; }
html:not(.dark) .bg-gray-900\/40 { background-color: rgba(0,0,0,0.04) !important; }
html:not(.dark) .bg-gray-900\/60 { background-color: rgba(0,0,0,0.05) !important; }
html:not(.dark) .bg-gray-900\/80 { background-color: rgba(0,0,0,0.06) !important; }
html:not(.dark) .border-gray-800\/40 { border-color: rgba(0,0,0,0.08) !important; }
html:not(.dark) .border-gray-700\/40 { border-color: rgba(0,0,0,0.1) !important; }
html:not(.dark) .border-gray-800\/60 { border-color: rgba(0,0,0,0.1) !important; }
html:not(.dark) .border-gray-800 { border-color: rgba(0,0,0,0.1) !important; }
html:not(.dark) .text-gray-200 { color: #1f2937 !important; }
html:not(.dark) .text-gray-300 { color: #374151 !important; }
html:not(.dark) .text-gray-400 { color: #6b7280 !important; }
html:not(.dark) .text-gray-500 { color: #6b7280 !important; }
html:not(.dark) .text-gray-600 { color: #6b7280 !important; }
html:not(.dark) .text-white { color: #111827 !important; }
html:not(.dark) .bg-gray-800\/60 { background-color: rgba(255,255,255,0.85) !important; }
html:not(.dark) .hover\:bg-gray-700\/80:hover { background-color: #e5e7eb !important; }
html:not(.dark) .bg-gray-700\/75 { background-color: #f3f4f6 !important; }
html:not(.dark) .hover\:bg-gray-600:hover { background-color: #e5e7eb !important; }
html:not(.dark) .bg-gradient-to-b.from-\[\#020403\] {
  background: linear-gradient(to bottom, #f4f6f9, transparent) !important;
}

/* 动画 */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes shimmer { 0% { background-position: -1000px 0; } 100% { background-position: 1000px 0; } }
@keyframes pulse-dot { 0%, 80%, 100% { opacity: 0.3; } 40% { opacity: 1; } }

.animate-fade-in { animation: fadeIn 0.3s ease-in; }
.animate-slide-up { animation: slideUp 0.4s ease-out; }

/* 滚动条 */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(120,120,120,0.3); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(120,120,120,0.5); }

/* 选中文本 */
::selection { background: rgba(168,85,247,0.3); }

/* Markdown 报告样式 */
.markdown { line-height: 1.7; }
.markdown h1 { font-size: 1.6rem; font-weight: 700; margin: 1.2rem 0 0.8rem; color: #fff; }
.markdown h2 { font-size: 1.3rem; font-weight: 600; margin: 1.1rem 0 0.6rem; color: #fff; border-bottom: 1px solid rgba(168,85,247,0.3); padding-bottom: 0.3rem; }
.markdown h3 { font-size: 1.1rem; font-weight: 600; margin: 1rem 0 0.4rem; color: #f3e8ff; }
.markdown p { margin: 0.6rem 0; }
.markdown ul, .markdown ol { margin: 0.5rem 0; padding-left: 1.5rem; }
.markdown li { margin: 0.25rem 0; }
.markdown table { width: 100%; border-collapse: collapse; margin: 0.8rem 0; font-size: 0.9rem; }
.markdown th, .markdown td { border: 1px solid rgba(120,120,120,0.3); padding: 0.5rem 0.75rem; text-align: left; }
.markdown th { background: rgba(168,85,247,0.1); font-weight: 600; }
.markdown blockquote { border-left: 3px solid rgba(168,85,247,0.5); padding-left: 1rem; color: #9ca3af; margin: 0.8rem 0; }
.markdown code { background: rgba(168,85,247,0.15); padding: 0.1rem 0.4rem; border-radius: 4px; font-size: 0.85em; }
.markdown a { color: #a855f7; text-decoration: underline; text-decoration-color: rgba(168,85,247,0.4); }
.markdown a:hover { text-decoration-color: #a855f7; }
.markdown hr { border: 0; border-top: 1px solid rgba(120,120,120,0.3); margin: 1rem 0; }
.markdown strong { color: #fff; font-weight: 600; }
.markdown em { color: #d8b4fe; }

html:not(.dark) .markdown h1,
html:not(.dark) .markdown h2 { color: #111827 !important; }
html:not(.dark) .markdown h3 { color: #6b21a8 !important; }
html:not(.dark) .markdown blockquote { color: #6b7280 !important; }
html:not(.dark) .markdown strong { color: #111827 !important; }
html:not(.dark) .markdown em { color: #6b21a8 !important; }
html:not(.dark) .markdown a { color: #7e22ce !important; }
html:not(.dark) .markdown th { background: rgba(168,85,247,0.08) !important; }

/* 思考链折叠 */
.thinking-collapsed { max-height: 0; opacity: 0; overflow: hidden; transition: max-height 0.5s, opacity 0.5s; }
.thinking-expanded { max-height: 400px; opacity: 1; overflow-y: auto; transition: max-height 0.5s, opacity 0.5s; }

/* 输入框 */
input:focus, textarea:focus { outline: none; }

/* 移动端 */
@media (max-width: 640px) {
  .markdown h1 { font-size: 1.3rem; }
  .markdown h2 { font-size: 1.1rem; }
}