/* 全局样式补充 */
@keyframes float {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(30px, -30px); }
}

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

@keyframes gradient {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

@keyframes shimmer {
  0% { background-position: -1000px 0; }
  100% { background-position: 1000px 0; }
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  font-feature-settings: 'cv11', 'ss01';
  -webkit-font-smoothing: antialiased;
}

/* 工具类 */
@layer utilities {
  .glass {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
  }
  .gradient-text {
    background-clip: text;
    -webkit-background-clip: text;
    color: transparent;
  }
  .scrollbar-thin::-webkit-scrollbar { width: 6px; height: 6px; }
  .scrollbar-thin::-webkit-scrollbar-track { background: transparent; }
  .scrollbar-thin::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
  .scrollbar-thin::-webkit-scrollbar-thumb:hover { background: #94a3b8; }
}

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

/* 加载动画 */
.loader {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* 卡片hover 3D效果 */
.feature-card {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.feature-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 20px 40px -10px rgba(99, 102, 241, 0.15);
}

/* Toast */
.toast {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%);
  padding: 12px 20px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  color: white;
  z-index: 100;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
  animation: toastIn 0.3s ease-out;
}
.toast.success { background: #10b981; }
.toast.error { background: #ef4444; }
.toast.info { background: #3b82f6; }

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

/* 文本截断 */
.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.line-clamp-3 {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* 渐变文字 */
.text-gradient {
  background: linear-gradient(135deg, #6366f1, #06b6d4, #8b5cf6);
  background-size: 200% auto;
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: gradient 6s ease infinite;
}

/* 滑入动画 */
.fade-in {
  animation: fadeUp 0.6s ease-out;
}

/* 移动端优化 */
@media (max-width: 640px) {
  /* 防止表格溢出 */
  table { display: block; overflow-x: auto; white-space: nowrap; }
  /* 减小标题字号 */
  h1 { font-size: 1.5rem; }
  h2 { font-size: 1.25rem; }
  /* 优化触摸区域 */
  button, a { -webkit-tap-highlight-color: transparent; }
  /* 防止输入框缩放 */
  input, textarea, select { font-size: 16px; }
}

/* 移动端侧边栏优化 */
@media (max-width: 1023px) {
  nav#sidebar {
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  nav#sidebar::-webkit-scrollbar { display: none; }
}

/* 排版预览样式 */
.fmt-heading { font-weight: 700; margin: 1.5em 0 0.8em; color: #1a1a2e; }
.fmt-heading:first-child { margin-top: 0; }
.fmt-highlight { background: linear-gradient(120deg, rgba(99,102,241,0.15) 0%, rgba(6,182,212,0.15) 100%); padding: 2px 6px; border-radius: 4px; font-weight: 600; color: #4338ca; }