/* ================================================
   游塑AI工具网站 - 公共样式
   设计规范：苹果风 + 莫兰迪蓝
   ================================================ */

/* --- CSS 变量 --- */
:root {
  /* 莫兰迪蓝主色系 */
  --primary: #8BAABB;
  --primary-light: #A8C0CC;
  --primary-dark: #6E8A9A;
  --primary-bg: #EEF3F5;
  --primary-subtle: #F4F7F8;
  
  /* 莫兰迪辅助色 */
  --accent: #E8B4A0;
  --accent-light: #F2D0C3;
  --success: #9CB8A0;
  --warning: #D4C59A;
  --error: #C89B9B;
  
  /* 中性色 */
  --text-primary: #2C3E50;
  --text-secondary: #6E8A9A;
  --text-muted: #A8B8C0;
  --border: #D8E3E8;
  --border-light: #EEF3F5;
  --white: #FFFFFF;
  --page-bg: #FAFBFC;
  
  /* 间距 */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;
  --space-20: 80px;
  
  /* 圆角 */
  --radius-sm: 6px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;
  
  /* 阴影 */
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow: 0 4px 12px rgba(0,0,0,0.08), 0 2px 4px rgba(0,0,0,0.04);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.10), 0 4px 8px rgba(0,0,0,0.05);
  --shadow-card: 0 2px 8px rgba(139,170,187,0.12);
  
  /* 字体 */
  --font: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Helvetica Neue', sans-serif;
  --font-mono: 'SF Mono', 'Fira Code', Consolas, monospace;
  
  /* 动效 */
  --transition: all 0.2s ease;
  --transition-fast: all 0.15s ease-out;
}

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font);
  background: var(--page-bg);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: var(--transition-fast);
}

a:hover {
  color: var(--primary-dark);
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* --- 滚动条 --- */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--primary-light);
}

/* --- 布局 --- */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--space-6);
}

.page-content {
  padding-top: calc(64px + var(--space-10) + 56px);
  padding-bottom: var(--space-20);
  min-height: 100vh;
}

/* --- Header --- */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  height: 64px;
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
}

.header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.header-logo {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-size: 20px;
  font-weight: 700;
  color: #8BAABB;
}

.header-logo img {
  height: 32px;
  width: auto;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: var(--space-8);
}

.header-nav a {
  font-size: 14px;
  color: var(--text-secondary);
  transition: var(--transition-fast);
}

.header-nav a:hover,
.header-nav a.active {
  color: var(--primary);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.mobile-menu-btn {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: var(--space-2);
  color: var(--text-primary);
}

/* --- 按钮 --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 0 var(--space-6);
  height: 44px;
  border-radius: var(--radius);
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: var(--transition-fast);
  white-space: nowrap;
  font-family: var(--font);
}

.btn-primary {
  background: var(--primary);
  color: var(--white);
}

.btn-primary:hover {
  background: var(--primary-light);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.btn-primary:active {
  background: var(--primary-dark);
  transform: translateY(0);
}

.btn-secondary {
  background: transparent;
  color: var(--primary);
  border: 1.5px solid var(--primary);
}

.btn-secondary:hover {
  background: var(--primary-bg);
}

.btn-pill {
  border-radius: var(--radius-full);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

.btn-sm {
  height: 36px;
  padding: 0 var(--space-4);
  font-size: 13px;
}

.btn-lg {
  height: 52px;
  padding: 0 var(--space-8);
  font-size: 16px;
}

/* --- 卡片 --- */
.card {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: var(--space-6);
  transition: var(--transition);
}

.card:hover {
  box-shadow: var(--shadow-sm);
  transform: translateY(-2px);
}

.card-flat {
  box-shadow: none;
  border: 1px solid var(--border-light);
}

.card-flat:hover {
  border-color: var(--primary-light);
  box-shadow: var(--shadow-sm);
}

/* --- 功能卡片 --- */
.feature-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: var(--space-8);
  cursor: pointer;
}

.feature-card .icon {
  width: 56px;
  height: 56px;
  background: var(--primary-bg);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-4);
  color: var(--primary);
  transition: var(--transition);
}

.feature-card:hover .icon {
  background: var(--primary);
  color: var(--white);
  transform: scale(1.05);
}

.feature-card h3 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: var(--space-2);
  color: var(--text-primary);
}

.feature-card p {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* --- Hero 区域 --- */
.hero {
  padding: var(--space-16) 0;
  text-align: center;
}

.hero h1 {
  font-size: clamp(28px, 5vw, 48px);
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
  margin-bottom: var(--space-4);
  letter-spacing: -0.02em;
}

.hero .subtitle {
  font-size: clamp(15px, 2.5vw, 18px);
  color: var(--text-secondary);
  margin-bottom: var(--space-8);
  line-height: 1.6;
}

.hero .cta-group {
  display: flex;
  gap: var(--space-4);
  justify-content: center;
  flex-wrap: wrap;
}

/* --- 统计区 --- */
.stats-bar {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: var(--space-6) var(--space-8);
  display: flex;
  justify-content: space-around;
  flex-wrap: wrap;
  gap: var(--space-6);
  box-shadow: var(--shadow-card);
}

.stat-item {
  text-align: center;
}

.stat-number {
  font-size: 28px;
  font-weight: 700;
  color: var(--primary);
  font-variant-numeric: tabular-nums;
}

.stat-label {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: var(--space-1);
}

/* --- 区块标题 --- */
.section-header {
  text-align: center;
  margin-bottom: var(--space-10);
}

.section-title {
  font-size: clamp(22px, 3vw, 30px);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-3);
  letter-spacing: -0.01em;
}

.section-desc {
  font-size: 15px;
  color: var(--text-secondary);
  max-width: 560px;
  margin: 0 auto;
  line-height: 1.7;
}

/* --- 图片上传区 --- */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-10);
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  background: var(--primary-subtle);
}

.upload-zone:hover,
.upload-zone.dragover {
  border-color: var(--primary);
  background: var(--primary-bg);
}

.upload-zone .icon {
  font-size: 40px;
  color: var(--primary-light);
  margin-bottom: var(--space-4);
}

.upload-zone p {
  color: var(--text-secondary);
  font-size: 14px;
}

.upload-zone .hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: var(--space-2);
}

/* --- 图片预览 --- */
.preview-grid {
  display: grid;
  gap: var(--space-4);
}

.preview-grid-2 {
  grid-template-columns: repeat(2, 1fr);
}

.preview-grid-3 {
  grid-template-columns: repeat(3, 1fr);
}

.preview-grid-4 {
  grid-template-columns: repeat(2, 1fr);
}

.preview-item {
  background: var(--white);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  position: relative;
}

.preview-item img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
}

.preview-item .label {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: var(--space-2) var(--space-3);
  background: rgba(0,0,0,0.5);
  color: white;
  font-size: 12px;
  text-align: center;
}

/* --- 对话气泡 --- */
.chat-container {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  height: 60vh;
  min-height: 400px;
  max-height: 600px;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.chat-msg {
  display: flex;
  gap: var(--space-3);
  max-width: 85%;
}

.chat-msg.user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.chat-msg-avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
}

.chat-msg.ai .chat-msg-avatar {
  background: var(--primary-bg);
  color: var(--primary);
}

.chat-msg.user .chat-msg-avatar {
  background: var(--primary);
  color: white;
}

.chat-msg-bubble {
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-lg);
  font-size: 14px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}

.chat-msg.ai .chat-msg-bubble {
  background: var(--primary-bg);
  color: var(--text-primary);
  border-bottom-left-radius: var(--radius-sm);
}

.chat-msg.user .chat-msg-bubble {
  background: var(--primary);
  color: white;
  border-bottom-right-radius: var(--radius-sm);
}

.chat-msg-images {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
  margin-top: var(--space-2);
}

.chat-msg-images img {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.chat-input-area {
  padding: var(--space-4);
  border-top: 1px solid var(--border-light);
  display: flex;
  gap: var(--space-3);
  align-items: flex-end;
}

.chat-input-area textarea {
  flex: 1;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-3) var(--space-4);
  font-size: 14px;
  font-family: var(--font);
  resize: none;
  outline: none;
  line-height: 1.5;
  max-height: 120px;
  transition: var(--transition-fast);
}

.chat-input-area textarea:focus {
  border-color: var(--primary);
}

/* --- 登录表单 --- */
.auth-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-6);
  background: var(--primary-subtle);
}

.auth-box {
  background: var(--white);
  border-radius: var(--radius-xl);
  padding: var(--space-10);
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow-lg);
}

.auth-box h2 {
  font-size: 24px;
  font-weight: 600;
  text-align: center;
  margin-bottom: var(--space-2);
  color: var(--text-primary);
}

.auth-box .sub {
  text-align: center;
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: var(--space-8);
}

.auth-tabs {
  display: flex;
  background: var(--primary-subtle);
  border-radius: var(--radius);
  padding: var(--space-1);
  margin-bottom: var(--space-6);
}

.auth-tab {
  flex: 1;
  padding: var(--space-2) var(--space-4);
  text-align: center;
  border-radius: calc(var(--radius) - 2px);
  font-size: 14px;
  cursor: pointer;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  transition: var(--transition-fast);
  font-family: var(--font);
  font-weight: 500;
}

.auth-tab.active {
  background: var(--white);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

.form-group {
  margin-bottom: var(--space-4);
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: var(--space-2);
}

.form-input {
  width: 100%;
  height: 44px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 0 var(--space-4);
  font-size: 15px;
  font-family: var(--font);
  outline: none;
  transition: var(--transition-fast);
  background: var(--white);
}

.form-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(139,170,187,0.15);
}

.form-input::placeholder {
  color: var(--text-muted);
}

.code-input-group {
  display: flex;
  gap: var(--space-2);
}

.code-input-group .form-input {
  flex: 1;
}

.send-code-btn {
  flex-shrink: 0;
  padding: 0 var(--space-4);
  height: 44px;
  background: var(--primary-bg);
  color: var(--primary);
  border: none;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition-fast);
  white-space: nowrap;
  font-family: var(--font);
}

.send-code-btn:hover {
  background: var(--primary);
  color: var(--white);
}

.form-divider {
  text-align: center;
  margin: var(--space-6) 0;
  color: var(--text-muted);
  font-size: 13px;
  position: relative;
}

.form-divider::before,
.form-divider::after {
  content: '';
  position: absolute;
  top: 50%;
  width: calc(50% - 20px);
  height: 1px;
  background: var(--border);
}

.form-divider::before { left: 0; }
.form-divider::after { right: 0; }

/* --- Tab 切换 --- */
.tabs {
  display: flex;
  gap: var(--space-1);
  background: var(--primary-subtle);
  border-radius: var(--radius);
  padding: var(--space-1);
  margin-bottom: var(--space-6);
  width: fit-content;
}

.tab-btn {
  padding: var(--space-2) var(--space-5);
  border-radius: calc(var(--radius) - 2px);
  font-size: 14px;
  cursor: pointer;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  transition: var(--transition-fast);
  font-family: var(--font);
  font-weight: 500;
}

.tab-btn.active {
  background: var(--white);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

/* --- Toast 提示 --- */
.toast {
  position: fixed;
  bottom: var(--space-8);
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--text-primary);
  color: white;
  padding: var(--space-3) var(--space-6);
  border-radius: var(--radius-full);
  font-size: 14px;
  z-index: 9999;
  opacity: 0;
  transition: all 0.3s ease;
  pointer-events: none;
  white-space: nowrap;
  box-shadow: var(--shadow-lg);
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.toast.success {
  background: var(--success);
}

.toast.error {
  background: var(--error);
}

/* --- Loading 动画 --- */
.loading-spinner {
  width: 24px;
  height: 24px;
  border: 2.5px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.loading-spinner.sm {
  width: 16px;
  height: 16px;
}

.loading-dots {
  display: inline-flex;
  gap: 4px;
  align-items: center;
}

.loading-dots span {
  width: 6px;
  height: 6px;
  background: var(--primary-light);
  border-radius: 50%;
  animation: dotPulse 1.2s ease-in-out infinite;
}

.loading-dots span:nth-child(2) { animation-delay: 0.2s; }
.loading-dots span:nth-child(3) { animation-delay: 0.4s; }

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

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

/* --- Footer --- */
.footer {
  background: var(--white);
  border-top: 1px solid var(--border-light);
  padding: var(--space-8) 0;
  margin-top: var(--space-20);
}

.footer-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-4);
}

.footer-links {
  display: flex;
  gap: var(--space-6);
}

.footer-links a {
  font-size: 13px;
  color: var(--text-secondary);
}

.footer-copy {
  font-size: 12px;
  color: var(--text-muted);
}

/* --- 空状态 --- */
.empty-state {
  text-align: center;
  padding: var(--space-12) var(--space-6);
  color: var(--text-muted);
}

.empty-state .icon {
  font-size: 48px;
  margin-bottom: var(--space-4);
  opacity: 0.5;
}

.empty-state p {
  font-size: 14px;
}

/* --- 标签/徽章 --- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.badge-primary {
  background: var(--primary-bg);
  color: var(--primary);
}

.badge-success {
  background: rgba(156,184,160,0.15);
  color: #6B9068;
}

.badge-warning {
  background: rgba(212,197,154,0.2);
  color: #9A8448;
}

/* --- 分隔线 --- */
.divider {
  height: 1px;
  background: var(--border-light);
  margin: var(--space-6) 0;
}

/* --- 头像 --- */
.avatar {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  object-fit: cover;
  background: var(--primary-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  color: var(--primary);
  font-size: 16px;
}

.avatar.sm {
  width: 32px;
  height: 32px;
  font-size: 13px;
}

/* --- 响应式 --- */
@media (max-width: 768px) {
  .container {
    padding: 0 var(--space-4);
  }
  
  .header-nav {
    display: none;
  }
  
  .header-nav.open {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    background: var(--white);
    padding: var(--space-4) var(--space-6);
    border-bottom: 1px solid var(--border-light);
    box-shadow: var(--shadow);
    gap: var(--space-4);
  }
  
  .mobile-menu-btn {
    display: flex;
  }
  
  .hero {
    padding: var(--space-10) 0;
  }
  
  .stats-bar {
    padding: var(--space-5);
    gap: var(--space-4);
  }
  
  .auth-box {
    padding: var(--space-6);
  }
  
  .preview-grid-4 {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .chat-container {
    height: 70vh;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  }
}

@media (max-width: 480px) {
  .btn-lg {
    height: 48px;
    font-size: 15px;
  }
  
  .feature-card {
    padding: var(--space-5);
  }
  
  .hero .cta-group {
    flex-direction: column;
    align-items: stretch;
  }
  
  .footer-content {
    flex-direction: column;
    text-align: center;
  }
}

/* --- 辅助类 --- */
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-primary-color { color: var(--primary); }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mt-8 { margin-top: var(--space-8); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }
.mb-8 { margin-bottom: var(--space-8); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.flex-wrap { flex-wrap: wrap; }
.w-full { width: 100%; }
.hidden { display: none; }
/* 灰模结果16:9 */
.gray-result-item img { aspect-ratio: 16/9 !important; object-fit: contain !important; }
