/* 文件标注: public/assets/css/main.css */
/* 功能: 完整的样式系统，包含组件、布局、响应式设计 */
/* 阶段: Phase 1 - 基础架构 */
/* 优先级: P0 - 核心样式文件 */

/* ==========================================================================
   CSS自定义属性系统 (Design Tokens)
   ========================================================================== */

:root {
  /* 品牌色彩 */
  --primary-50: #eef2ff;
  --primary-100: #e0e7ff;
  --primary-200: #c7d2fe;
  --primary-300: #a5b4fc;
  --primary-400: #818cf8;
  --primary-500: #6366f1;
  --primary-600: #4f46e5;
  --primary-700: #4338ca;
  --primary-800: #3730a3;
  --primary-900: #312e81;
  
  /* 辅助色彩 */
  --accent-50: #fffbeb;
  --accent-100: #fef3c7;
  --accent-200: #fde68a;
  --accent-300: #fcd34d;
  --accent-400: #fbbf24;
  --accent-500: #f59e0b;
  --accent-600: #d97706;
  --accent-700: #b45309;
  --accent-800: #92400e;
  --accent-900: #78350f;
  
  /* 中性色彩 */
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;
  
  /* 语义色彩 */
  --success-50: #ecfdf5;
  --success-500: #10b981;
  --success-600: #059669;
  --error-50: #fef2f2;
  --error-500: #ef4444;
  --error-600: #dc2626;
  --warning-50: #fffbeb;
  --warning-500: #f59e0b;
  --warning-600: #d97706;
  
  /* 背景色彩 */
  --bg-primary: #ffffff;
  --bg-secondary: #f8fafc;
  --bg-tertiary: #f1f5f9;
  --bg-surface: #ffffff;
  --bg-overlay: rgba(0, 0, 0, 0.5);
  
  /* 文字色彩 */
  --text-primary: #1e293b;
  --text-secondary: #64748b;
  --text-tertiary: #94a3b8;
  --text-inverse: #ffffff;
  --text-muted: #cbd5e1;
  
  /* 边框色彩 */
  --border-light: #e2e8f0;
  --border-medium: #cbd5e1;
  --border-heavy: #94a3b8;
  --border-focus: var(--primary-500);
  
  /* 间距系统 */
  --space-0: 0;
  --space-1: 0.25rem;   /* 4px */
  --space-2: 0.5rem;    /* 8px */
  --space-3: 0.75rem;   /* 12px */
  --space-4: 1rem;      /* 16px */
  --space-5: 1.25rem;   /* 20px */
  --space-6: 1.5rem;    /* 24px */
  --space-8: 2rem;      /* 32px */
  --space-10: 2.5rem;   /* 40px */
  --space-12: 3rem;     /* 48px */
  --space-16: 4rem;     /* 64px */
  --space-20: 5rem;     /* 80px */
  --space-24: 6rem;     /* 96px */
  
  /* 字体系统 */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, monospace;
  
  /* 字体大小 */
  --text-xs: 0.75rem;   /* 12px */
  --text-sm: 0.875rem;  /* 14px */
  --text-base: 1rem;    /* 16px */
  --text-lg: 1.125rem;  /* 18px */
  --text-xl: 1.25rem;   /* 20px */
  --text-2xl: 1.5rem;   /* 24px */
  --text-3xl: 1.875rem; /* 30px */
  --text-4xl: 2.25rem;  /* 36px */
  --text-5xl: 3rem;     /* 48px */
  
  /* 圆角系统 */
  --radius-none: 0;
  --radius-sm: 0.125rem;    /* 2px */
  --radius-base: 0.25rem;   /* 4px */
  --radius-md: 0.375rem;    /* 6px */
  --radius-lg: 0.5rem;      /* 8px */
  --radius-xl: 0.75rem;     /* 12px */
  --radius-2xl: 1rem;       /* 16px */
  --radius-full: 9999px;
  
  /* 阴影系统 */
  --shadow-xs: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
  --shadow-base: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-md: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
  --shadow-xl: 0 25px 50px -12px rgb(0 0 0 / 0.25);
  
  /* 过渡动画 */
  --transition-fast: 150ms ease-out;
  --transition-base: 200ms ease-out;
  --transition-slow: 300ms ease-out;
  --transition-bounce: 200ms cubic-bezier(0.68, -0.55, 0.265, 1.55);
  
  /* Z-index层级 */
  --z-dropdown: 1000;
  --z-sticky: 1020;
  --z-fixed: 1030;
  --z-modal-backdrop: 1040;
  --z-modal: 1050;
  --z-popover: 1060;
  --z-tooltip: 1070;
  --z-toast: 1080;
}

/* 深色模式支持 */
@media (prefers-color-scheme: dark) {
  :root {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --bg-surface: #1e293b;
    
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-tertiary: #64748b;
    
    --border-light: #334155;
    --border-medium: #475569;
    --border-heavy: #64748b;
  }
}

/* ==========================================================================
   基础重置和排版
   ========================================================================== */

/* 现代CSS重置 */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
  -moz-tab-size: 4;
  tab-size: 4;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: 1.6;
  color: var(--text-primary);
  background-color: var(--bg-secondary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* 图片和媒体元素 */
img,
video,
canvas,
svg {
  max-width: 100%;
  height: auto;
  display: block;
}

/* 表单元素 */
button,
input,
optgroup,
select,
textarea {
  font-family: inherit;
  font-size: 100%;
  line-height: 1.15;
  margin: 0;
}

button,
[type="button"],
[type="reset"],
[type="submit"] {
  -webkit-appearance: button;
  cursor: pointer;
}

button:disabled,
[type="button"]:disabled,
[type="reset"]:disabled,
[type="submit"]:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

/* 链接 */
a {
  color: var(--primary-600);
  text-decoration: none;
  transition: color var(--transition-base);
}

a:hover {
  color: var(--primary-700);
  text-decoration: underline;
}

a:focus {
  outline: 2px solid var(--border-focus);
  outline-offset: 2px;
}

/* 排版元素 */
h1,
h2,
h3,
h4,
h5,
h6 {
  font-weight: 600;
  line-height: 1.25;
  margin-bottom: var(--space-4);
  color: var(--text-primary);
}

h1 { font-size: var(--text-4xl); }
h2 { font-size: var(--text-3xl); }
h3 { font-size: var(--text-2xl); }
h4 { font-size: var(--text-xl); }
h5 { font-size: var(--text-lg); }
h6 { font-size: var(--text-base); }

p {
  margin-bottom: var(--space-4);
  color: var(--text-secondary);
}

/* 列表 */
ul,
ol {
  padding-left: var(--space-6);
  margin-bottom: var(--space-4);
}

li {
  margin-bottom: var(--space-1);
}

/* 代码 */
code,
pre {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
}

code {
  background-color: var(--gray-100);
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-base);
  color: var(--text-primary);
}

pre {
  background-color: var(--gray-100);
  padding: var(--space-4);
  border-radius: var(--radius-lg);
  overflow-x: auto;
  margin-bottom: var(--space-4);
}

/* ==========================================================================
   布局组件
   ========================================================================== */

/* 容器 */
.container {
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 var(--space-4);
}

@media (min-width: 640px) {
  .container {
    padding: 0 var(--space-6);
  }
}

@media (min-width: 1024px) {
  .container {
    padding: 0 var(--space-8);
  }
}

/* 面板基础样式 */
.panel {
  background: var(--bg-surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
  overflow: hidden;
  height: fit-content;
}

.panel-header {
  padding: var(--space-6);
  border-bottom: 1px solid var(--border-light);
  background: var(--bg-tertiary);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.panel-title {
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.panel-content {
  padding: var(--space-6);
}

/* ==========================================================================
   Header组件
   ========================================================================== */

.site-header {
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border-light);
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  backdrop-filter: blur(8px);
  background: rgba(255, 255, 255, 0.95);
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-4) 0;
}

.logo-section {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.logo {
  height: 48px;
  width: auto;
  font-size: var(--text-2xl);
  font-weight: 700;
  color: var(--primary-600);
}

.tagline {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  font-weight: 500;
  letter-spacing: 0.05em;
}

.main-nav {
  display: none;
}

@media (min-width: 768px) {
  .main-nav {
    display: block;
  }
}

.nav-list {
  display: flex;
  gap: var(--space-8);
  list-style: none;
  padding: 0;
  margin: 0;
}

.nav-link {
  font-weight: 500;
  color: var(--text-secondary);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  transition: all var(--transition-base);
}

.nav-link:hover {
  color: var(--primary-600);
  background-color: var(--primary-50);
  text-decoration: none;
}

/* 移动端菜单 */
.mobile-menu-toggle {
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: none;
  border: none;
  padding: var(--space-2);
  cursor: pointer;
}

@media (min-width: 768px) {
  .mobile-menu-toggle {
    display: none;
  }
}

.hamburger-line {
  width: 24px;
  height: 2px;
  background-color: var(--text-primary);
  border-radius: var(--radius-full);
  transition: all var(--transition-base);
}

/* ==========================================================================
   Hero Section组件
   ========================================================================== */

.hero-section {
  padding: var(--space-20) 0 var(--space-16);
  background: linear-gradient(135deg, var(--primary-50) 0%, var(--accent-50) 100%);
  position: relative;
  overflow: hidden;
}

.hero-section::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: url('data:image/svg+xml,<svg width="60" height="60" viewBox="0 0 60 60" xmlns="http://www.w3.org/2000/svg"><g fill="none" fill-rule="evenodd"><g fill="%236366f1" fill-opacity="0.05"><rect width="2" height="2"/></g></svg>') repeat;
  opacity: 0.5;
  pointer-events: none;
}

.hero-content {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-12);
  align-items: center;
  position: relative;
  z-index: 1;
}

@media (min-width: 1024px) {
  .hero-content {
    grid-template-columns: 1fr 400px;
    gap: var(--space-16);
  }
}

.hero-title {
  font-size: var(--text-4xl);
  font-weight: 700;
  line-height: 1.1;
  margin-bottom: var(--space-6);
  color: var(--text-primary);
}

@media (min-width: 768px) {
  .hero-title {
    font-size: var(--text-5xl);
  }
}

.highlight {
  background: linear-gradient(135deg, var(--primary-600), var(--accent-500));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-description {
  font-size: var(--text-lg);
  color: var(--text-secondary);
  margin-bottom: var(--space-8);
  line-height: 1.7;
}

.hero-features {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-bottom: var(--space-8);
}

.feature-tag {
  background: var(--bg-primary);
  color: var(--text-primary);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  font-weight: 500;
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-xs);
}

.cta-buttons {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

@media (min-width: 640px) {
  .cta-buttons {
    flex-direction: row;
  }
}

.cta-primary {
  background: var(--primary-600);
  color: var(--text-inverse);
  padding: var(--space-4) var(--space-8);
  border-radius: var(--radius-xl);
  font-weight: 600;
  font-size: var(--text-lg);
  border: none;
  cursor: pointer;
  transition: all var(--transition-base);
  box-shadow: var(--shadow-base);
}

.cta-primary:hover {
  background: var(--primary-700);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.cta-secondary {
  background: var(--bg-primary);
  color: var(--primary-600);
  padding: var(--space-4) var(--space-8);
  border-radius: var(--radius-xl);
  font-weight: 600;
  font-size: var(--text-lg);
  border: 2px solid var(--primary-200);
  text-decoration: none;
  text-align: center;
  transition: all var(--transition-base);
}

.cta-secondary:hover {
  background: var(--primary-50);
  border-color: var(--primary-300);
  text-decoration: none;
}

/* Hero Visual */
.hero-visual {
  display: flex;
  justify-content: center;
  align-items: center;
}

.conversion-demo {
  background: var(--bg-primary);
  padding: var(--space-8);
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-light);
}

.demo-step {
  display: flex;
  align-items: center;
  gap: var(--space-6);
  margin-bottom: var(--space-4);
}

.demo-image {
  width: 80px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  background: var(--bg-tertiary);
  border-radius: var(--radius-xl);
  border: 2px solid var(--border-light);
}

.demo-arrow {
  font-size: var(--text-2xl);
  color: var(--primary-500);
  font-weight: bold;
}

.demo-caption {
  text-align: center;
  font-size: var(--text-sm);
  color: var(--text-tertiary);
  font-weight: 500;
}

/* ==========================================================================
   应用主界面布局
   ========================================================================== */

.converter-section {
  padding: var(--space-16) 0;
}

.app-container {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-6);
  max-width: 1600px;
  margin: 0 auto;
  padding: 0 var(--space-4);
}

@media (min-width: 1024px) {
  .app-container {
    grid-template-columns: 320px 1fr 300px;
    gap: var(--space-8);
    padding: 0 var(--space-6);
  }
}

@media (min-width: 1280px) {
  .app-container {
    grid-template-columns: 350px 1fr 320px;
  }
}

/* 在移动端调整面板顺序 */
@media (max-width: 1023px) {
  .left-panel { order: 2; }
  .center-panel { order: 1; }
  .right-panel { order: 3; }
}

/* ==========================================================================
   上传区域组件
   ========================================================================== */

.mode-selector {
  display: flex;
  gap: var(--space-1);
  background: var(--bg-secondary);
  padding: var(--space-1);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-6);
}

.mode-btn {
  flex: 1;
  padding: var(--space-3) var(--space-4);
  border: none;
  background: transparent;
  color: var(--text-secondary);
  border-radius: var(--radius-md);
  font-weight: 500;
  font-size: var(--text-sm);
  cursor: pointer;
  transition: all var(--transition-base);
}

.mode-btn.active {
  background: var(--primary-500);
  color: var(--text-inverse);
  box-shadow: var(--shadow-xs);
}

.upload-zone {
  border: 2px dashed var(--border-medium);
  border-radius: var(--radius-xl);
  padding: var(--space-8);
  text-align: center;
  transition: all var(--transition-base);
  position: relative;
  cursor: pointer;
  background: var(--bg-primary);
  min-height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.upload-zone:hover,
.upload-zone.dragover {
  border-color: var(--primary-500);
  background: var(--primary-50);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.upload-zone:focus {
  outline: 2px solid var(--border-focus);
  outline-offset: 2px;
}

.upload-content {
  pointer-events: none;
}

.upload-icon {
  font-size: 3rem;
  margin-bottom: var(--space-4);
  opacity: 0.6;
}

.upload-title {
  font-size: var(--text-xl);
  font-weight: 600;
  margin-bottom: var(--space-2);
  color: var(--text-primary);
}

.upload-subtitle {
  color: var(--text-secondary);
  margin-bottom: var(--space-2);
}

.upload-info {
  font-size: var(--text-sm);
  color: var(--text-tertiary);
  margin-bottom: var(--space-6);
}

.upload-button {
  background: var(--primary-500);
  color: var(--text-inverse);
  border: none;
  padding: var(--space-3) var(--space-6);
  border-radius: var(--radius-lg);
  font-weight: 500;
  cursor: pointer;
  transition: background-color var(--transition-base);
  pointer-events: auto;
}

.upload-button:hover {
  background: var(--primary-600);
}

.file-input {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

/* ==========================================================================
   控制面板组件
   ========================================================================== */

.controls-panel {
  margin-top: var(--space-8);
}

.control-group {
  margin-bottom: var(--space-6);
}

.control-label {
  display: block;
  font-weight: 500;
  margin-bottom: var(--space-3);
  color: var(--text-primary);
  font-size: var(--text-sm);
}

/* 滑块控件 */
.range-control {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.range-input {
  flex: 1;
  height: 6px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
  outline: none;
  -webkit-appearance: none;
  cursor: pointer;
}

.range-input::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  background: var(--primary-500);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-base);
}

.range-input::-webkit-slider-thumb:hover {
  background: var(--primary-600);
  transform: scale(1.1);
}

.range-input::-moz-range-thumb {
  width: 20px;
  height: 20px;
  background: var(--primary-500);
  border-radius: 50%;
  cursor: pointer;
  border: none;
  box-shadow: var(--shadow-sm);
}

.range-value {
  font-weight: 600;
  color: var(--text-primary);
  min-width: 50px;
  text-align: right;
  font-family: var(--font-mono);
  font-size: var(--text-sm);
}

/* 选择框控件 */
.select-control {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-lg);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: var(--text-sm);
  cursor: pointer;
  transition: all var(--transition-base);
}

.select-control:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.select-control:hover {
  border-color: var(--border-heavy);
}

/* 开关控件 */
.toggle-control {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 24px;
}

.toggle-input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--bg-tertiary);
  border-radius: var(--radius-full);
  transition: all var(--transition-base);
  border: 1px solid var(--border-medium);
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 2px;
  bottom: 2px;
  background-color: var(--bg-primary);
  border-radius: 50%;
  transition: all var(--transition-base);
  box-shadow: var(--shadow-xs);
}

.toggle-input:checked + .toggle-slider {
  background-color: var(--primary-500);
  border-color: var(--primary-500);
}

.toggle-input:checked + .toggle-slider:before {
  transform: translateX(24px);
}

.toggle-input:focus + .toggle-slider {
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.control-help {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  margin-top: var(--space-2);
}

/* AI优化按钮 */
.ai-optimize-btn {
  width: 100%;
  background: linear-gradient(135deg, var(--primary-500), var(--accent-500));
  color: var(--text-inverse);
  border: none;
  padding: var(--space-4);
  border-radius: var(--radius-lg);
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-base);
  font-size: var(--text-sm);
  box-shadow: var(--shadow-sm);
}

.ai-optimize-btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

/* ==========================================================================
   预览区域组件
   ========================================================================== */

.center-panel {
  min-height: 600px;
  display: flex;
  flex-direction: column;
}

.preview-tools {
  display: flex;
  gap: var(--space-2);
}

.tool-btn {
  width: 36px;
  height: 36px;
  border: 1px solid var(--border-medium);
  background: var(--bg-primary);
  border-radius: var(--radius-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-base);
  font-size: var(--text-sm);
}

.tool-btn:hover {
  background: var(--bg-tertiary);
  border-color: var(--border-heavy);
}

.tool-btn:focus {
  outline: 2px solid var(--border-focus);
  outline-offset: 2px;
}

.preview-container {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background: 
    linear-gradient(45deg, var(--gray-100) 25%, transparent 25%),
    linear-gradient(-45deg, var(--gray-100) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, var(--gray-100) 75%),
    linear-gradient(-45deg, transparent 75%, var(--gray-100) 75%);
  background-size: 20px 20px;
  background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  min-height: 400px;
}

.preview-placeholder {
  text-align: center;
  color: var(--text-tertiary);
}

.placeholder-icon {
  font-size: 4rem;
  margin-bottom: var(--space-4);
  opacity: 0.5;
}

.placeholder-text {
  font-size: var(--text-lg);
  font-weight: 500;
}

.preview-canvas {
  max-width: 100%;
  max-height: 100%;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  /* 优化：像素完美渲染设置 */
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
  image-rendering: crisp-edges;
  image-rendering: -webkit-optimize-contrast;
  image-rendering: optimize-contrast;
  /* 优化：防止浏览器自动平滑 */
  -webkit-font-smoothing: none;
  -moz-osx-font-smoothing: unset;
  /* 优化：确保像素对齐 */
  transform: translateZ(0);
  backface-visibility: hidden;
}

.hover-info {
  position: absolute;
  background: rgba(0, 0, 0, 0.9);
  color: var(--text-inverse);
  padding: var(--space-3);
  border-radius: var(--radius-md);
  font-size: var(--text-xs);
  font-family: var(--font-mono);
  pointer-events: none;
  z-index: var(--z-tooltip);
  backdrop-filter: blur(8px);
}

.info-line {
  margin-bottom: var(--space-1);
}

.info-line:last-child {
  margin-bottom: 0;
}

/* ==========================================================================
   统计面板组件
   ========================================================================== */

.stats-section,
.palette-section,
.export-section {
  margin-bottom: var(--space-8);
}

.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}

.stat-card {
  background: var(--bg-tertiary);
  padding: var(--space-4);
  border-radius: var(--radius-lg);
  text-align: center;
  border: 1px solid var(--border-light);
}

.stat-label {
  display: block;
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  margin-bottom: var(--space-2);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stat-value {
  display: block;
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--text-primary);
  font-family: var(--font-mono);
}

/* 成本分析 */
.cost-breakdown {
  background: var(--bg-tertiary);
  padding: var(--space-4);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-light);
}

.breakdown-title {
  font-size: var(--text-sm);
  font-weight: 600;
  margin-bottom: var(--space-4);
  color: var(--text-primary);
}

.cost-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-2) 0;
  font-size: var(--text-sm);
}

.cost-item:not(:last-child) {
  border-bottom: 1px solid var(--border-light);
}

.cost-free {
  color: var(--success-500);
  font-weight: 600;
  font-family: var(--font-mono);
}

.cost-premium {
  color: var(--warning-500);
  font-weight: 600;
  font-family: var(--font-mono);
}

/* ==========================================================================
   调色板组件
   ========================================================================== */

.palette-filters {
  display: flex;
  gap: var(--space-1);
}

.filter-btn {
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--border-medium);
  background: var(--bg-primary);
  color: var(--text-secondary);
  border-radius: var(--radius-md);
  font-size: var(--text-xs);
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-base);
}

.filter-btn.active {
  background: var(--primary-500);
  color: var(--text-inverse);
  border-color: var(--primary-500);
}

.filter-btn:hover:not(.active) {
  background: var(--bg-tertiary);
  border-color: var(--border-heavy);
}

.color-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 4px;
  margin: var(--space-4) 0;
}

@media (max-width: 640px) {
  .color-grid {
    grid-template-columns: repeat(6, 1fr);
  }
}

.color-swatch {
  aspect-ratio: 1;
  border-radius: var(--radius-md);
  cursor: pointer;
  position: relative;
  transition: all var(--transition-base);
  border: 2px solid transparent;
  box-shadow: var(--shadow-xs);
}

.color-swatch:hover {
  transform: scale(1.1);
  z-index: 1;
  box-shadow: var(--shadow-md);
}

.color-swatch.selected {
  border-color: var(--primary-500);
  transform: scale(1.1);
  z-index: 1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.color-swatch.locked::after {
  content: '🔒';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 0.625rem;
  text-shadow: 0 0 2px rgba(0, 0, 0, 0.8);
}

.color-swatch.used::before {
  content: '';
  position: absolute;
  top: 2px;
  right: 2px;
  width: 8px;
  height: 8px;
  background: var(--success-500);
  border-radius: 50%;
  border: 2px solid var(--bg-primary);
  box-shadow: var(--shadow-xs);
}

.selected-color-info {
  background: var(--bg-tertiary);
  padding: var(--space-4);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  gap: var(--space-4);
  border: 1px solid var(--border-light);
}

.color-preview {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-lg);
  border: 2px solid var(--border-light);
  box-shadow: var(--shadow-xs);
  background-color: #000000;
}

.color-details {
  flex: 1;
}

.color-hex {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--text-primary);
  font-size: var(--text-sm);
}

.color-type {
  color: var(--text-secondary);
  font-size: var(--text-xs);
  font-weight: 500;
}

/* ==========================================================================
   导出面板组件
   ========================================================================== */

.export-buttons {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin-bottom: var(--space-6);
}

.export-btn {
  padding: var(--space-4);
  border: 1px solid var(--border-medium);
  background: var(--bg-primary);
  color: var(--text-primary);
  border-radius: var(--radius-lg);
  cursor: pointer;
  font-weight: 500;
  transition: all var(--transition-base);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
}

.export-btn:hover {
  background: var(--bg-tertiary);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.export-btn.primary {
  background: var(--primary-500);
  color: var(--text-inverse);
  border-color: var(--primary-500);
}

.export-btn.primary:hover {
  background: var(--primary-600);
}

.export-options {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.export-option {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-size: var(--text-sm);
  color: var(--text-secondary);
  cursor: pointer;
}

.export-option input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--primary-500);
  cursor: pointer;
}

/* ==========================================================================
   功能特性区域
   ========================================================================== */

.features-section {
  padding: var(--space-20) 0;
  background: var(--bg-primary);
}

.section-header {
  text-align: center;
  margin-bottom: var(--space-16);
}

.section-title {
  font-size: var(--text-4xl);
  font-weight: 700;
  margin-bottom: var(--space-4);
  color: var(--text-primary);
}

.section-subtitle {
  font-size: var(--text-lg);
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto;
}

.features-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-8);
}

@media (min-width: 768px) {
  .features-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .features-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.feature-card {
  background: var(--bg-surface);
  padding: var(--space-8);
  border-radius: var(--radius-xl);
  border: 1px solid var(--border-light);
  text-align: center;
  transition: all var(--transition-base);
  box-shadow: var(--shadow-xs);
}

.feature-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  border-color: var(--primary-200);
}

.feature-icon {
  font-size: 3rem;
  margin-bottom: var(--space-4);
  display: block;
}

.feature-title {
  font-size: var(--text-xl);
  font-weight: 600;
  margin-bottom: var(--space-3);
  color: var(--text-primary);
}

.feature-description {
  color: var(--text-secondary);
  line-height: 1.6;
}

/* ==========================================================================
   Footer组件
   ========================================================================== */

.site-footer {
  background: var(--bg-primary);
  border-top: 1px solid var(--border-light);
  padding: var(--space-16) 0 var(--space-8);
}

.footer-content {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-12);
}

@media (min-width: 1024px) {
  .footer-content {
    grid-template-columns: 1fr auto;
    gap: var(--space-16);
  }
}

.disclaimer-notice {
  background: var(--warning-50);
  border: 1px solid var(--warning-200);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  display: flex;
  gap: var(--space-4);
  align-items: flex-start;
}

.disclaimer-icon {
  font-size: var(--text-xl);
  flex-shrink: 0;
}

.disclaimer-text p {
  margin-bottom: var(--space-2);
  color: var(--warning-800);
}

.disclaimer-text p:last-child {
  margin-bottom: 0;
  font-weight: 600;
}

.footer-links {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: var(--space-8);
}

.footer-section h4 {
  font-size: var(--text-sm);
  font-weight: 600;
  margin-bottom: var(--space-4);
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.footer-section ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.footer-section li {
  margin-bottom: var(--space-2);
}

.footer-section a {
  color: var(--text-secondary);
  font-size: var(--text-sm);
  transition: color var(--transition-base);
}

.footer-section a:hover {
  color: var(--primary-600);
}

.footer-meta {
  text-align: center;
  padding-top: var(--space-8);
  border-top: 1px solid var(--border-light);
  color: var(--text-tertiary);
  font-size: var(--text-sm);
}

.footer-meta p {
  margin-bottom: var(--space-2);
}

.footer-badges {
  display: flex;
  justify-content: center;
  gap: var(--space-4);
  margin-top: var(--space-4);
}

.badge {
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 500;
  border: 1px solid var(--border-light);
}

/* ==========================================================================
   模态框组件
   ========================================================================== */

.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: var(--z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
}

.modal.hidden {
  display: none;
}

.modal-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--bg-overlay);
  backdrop-filter: blur(4px);
}

.modal-content {
  background: var(--bg-surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow: hidden;
  position: relative;
  z-index: 1;
  border: 1px solid var(--border-light);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-6);
  border-bottom: 1px solid var(--border-light);
  background: var(--bg-tertiary);
}

.modal-title {
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.close-btn {
  width: 32px;
  height: 32px;
  border: none;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: var(--text-lg);
  color: var(--text-secondary);
  transition: all var(--transition-base);
  display: flex;
  align-items: center;
  justify-content: center;
}

.close-btn:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.modal-body {
  padding: var(--space-6);
  overflow-y: auto;
  max-height: calc(90vh - 120px);
}

/* ==========================================================================
   通知系统
   ========================================================================== */

.notification-container {
  position: fixed;
  top: var(--space-4);
  right: var(--space-4);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  max-width: 400px;
}

.notification {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  backdrop-filter: blur(8px);
  animation: slideIn 300ms ease-out;
}

.notification.success {
  border-color: var(--success-500);
  background: var(--success-50);
}

.notification.error {
  border-color: var(--error-500);
  background: var(--error-50);
}

.notification.warning {
  border-color: var(--warning-500);
  background: var(--warning-50);
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(100%) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}

/* ==========================================================================
   加载状态组件
   ========================================================================== */

.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--bg-overlay);
  z-index: var(--z-modal);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}

.loading-overlay.hidden {
  display: none;
}

.loading-spinner {
  width: 48px;
  height: 48px;
  border: 4px solid var(--border-light);
  border-top: 4px solid var(--primary-500);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: var(--space-4);
}

.loading-text {
  color: var(--text-primary);
  font-weight: 500;
  font-size: var(--text-lg);
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* ==========================================================================
   辅助功能和可访问性
   ========================================================================== */

/* 跳过链接 */
.skip-link {
  position: absolute;
  top: -40px;
  left: 6px;
  background: var(--primary-600);
  color: var(--text-inverse);
  padding: 8px;
  text-decoration: none;
  border-radius: var(--radius-md);
  z-index: var(--z-modal);
  font-weight: 500;
  transition: all var(--transition-base);
}

.skip-link:focus {
  top: 6px;
}

/* 焦点指示器 */
*:focus {
  outline: 2px solid var(--border-focus);
  outline-offset: 2px;
}

/* 减少动画偏好设置 */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* 高对比度模式 */
@media (prefers-contrast: high) {
  :root {
    --border-light: #000000;
    --border-medium: #000000;
    --border-heavy: #000000;
    --text-secondary: #000000;
    --text-tertiary: #000000;
  }
}

/* ==========================================================================
   工具类
   ========================================================================== */

.hidden {
  display: none !important;
}

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

.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.font-mono { font-family: var(--font-mono); }
.font-sans { font-family: var(--font-sans); }

.text-xs { font-size: var(--text-xs); }
.text-sm { font-size: var(--text-sm); }
.text-base { font-size: var(--text-base); }
.text-lg { font-size: var(--text-lg); }
.text-xl { font-size: var(--text-xl); }

.font-normal { font-weight: 400; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }

.mb-0 { margin-bottom: 0; }
.mb-2 { margin-bottom: var(--space-2); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }
.mb-8 { margin-bottom: var(--space-8); }

.opacity-50 { opacity: 0.5; }
.opacity-75 { opacity: 0.75; }

/* ==========================================================================
   打印样式
   ========================================================================== */

@media print {
  .site-header,
  .site-footer,
  .modal,
  .notification-container,
  .loading-overlay {
    display: none !important;
  }
  
  .app-container {
    grid-template-columns: 1fr !important;
    gap: var(--space-4) !important;
  }
  
  .panel {
    box-shadow: none !important;
    border: 1px solid #000 !important;
  }
  
  * {
    background: white !important;
    color: black !important;
  }
}

/* ==========================================================================
   How It Works Section
   ========================================================================== */

.how-it-works-section {
  padding: var(--space-20) 0;
  background: var(--bg-primary);
}

.steps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--space-8);
  margin-top: var(--space-12);
}

.step-card {
  background: var(--bg-secondary);
  border-radius: var(--radius-xl);
  padding: var(--space-8);
  text-align: center;
  border: 1px solid var(--border-light);
  transition: all var(--transition-base);
  position: relative;
}

.step-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary-300);
}

.step-number {
  width: 60px;
  height: 60px;
  background: var(--primary-500);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-xl);
  font-weight: 700;
  margin: 0 auto var(--space-6);
}

.step-title {
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-4);
}

.step-description {
  color: var(--text-secondary);
  line-height: 1.6;
}

/* ==========================================================================
   Community Section
   ========================================================================== */

.community-section {
  padding: var(--space-20) 0;
  background: var(--bg-secondary);
}

.community-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: var(--space-8);
  margin-top: var(--space-12);
}

.community-card {
  background: var(--bg-primary);
  border-radius: var(--radius-xl);
  padding: var(--space-8);
  text-align: center;
  border: 1px solid var(--border-light);
  transition: all var(--transition-base);
}

.community-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--accent-300);
}

.community-icon {
  font-size: 3rem;
  margin-bottom: var(--space-6);
}

.community-title {
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-4);
}

.community-description {
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: var(--space-6);
}

.community-link {
  display: inline-block;
  background: var(--primary-500);
  color: white;
  padding: var(--space-3) var(--space-6);
  border-radius: var(--radius-lg);
  text-decoration: none;
  font-weight: 500;
  transition: all var(--transition-base);
}

.community-link:hover {
  background: var(--primary-600);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

/* ==========================================================================
   响应式设计 - 新增部分
   ========================================================================== */

@media (max-width: 768px) {
  .steps-grid,
  .community-grid {
    grid-template-columns: 1fr;
    gap: var(--space-6);
  }
  
  .step-card,
  .community-card {
    padding: var(--space-6);
  }
  
  .step-number {
    width: 50px;
    height: 50px;
    font-size: var(--text-lg);
  }
  
  .community-icon {
    font-size: 2.5rem;
  }
}
