/* ============================================================
   前台样式 · 图图兽 AI 精装设计
   暖调 + 高质感，纯手写，无外部依赖
   ============================================================ */

:root {
  --bg: #faf7f2;
  --surface: #ffffff;
  --ink: #241d18;
  --muted: #8d8074;
  --primary: #c67a4b;
  --primary-strong: #a8602f;
  --primary-soft: #f3e4d6;
  --border: #eee5da;
  --success: #3a8f6a;
  --danger: #c94f4f;
  --radius: 16px;
  --shadow-sm: 0 1px 3px rgba(40, 26, 12, .06);
  --shadow: 0 12px 32px rgba(70, 45, 20, .10);
  --shadow-lg: 0 24px 60px rgba(70, 45, 20, .16);
  --font: "PingFang SC", "Microsoft YaHei", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

.container { max-width: 1180px; margin: 0 auto; padding: 0 24px; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 22px; border: 1px solid transparent; border-radius: 12px;
  font-size: 15px; font-weight: 600; cursor: pointer; transition: all .18s ease;
  font-family: var(--font); line-height: 1.2; white-space: nowrap;
}
.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-strong));
  color: #fff; box-shadow: 0 6px 18px rgba(198, 122, 75, .35);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(198, 122, 75, .45); }
.btn-ghost {
  background: transparent; color: var(--ink); border-color: var(--border);
}
.btn-ghost:hover { border-color: var(--primary); color: var(--primary); }
.btn-light { background: #fff; color: var(--primary-strong); }
.btn-light:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.btn-danger { background: #fbeaea; color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-sm { padding: 6px 14px; font-size: 13px; border-radius: 9px; }
.btn-lg { padding: 14px 30px; font-size: 16px; border-radius: 14px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .6; cursor: not-allowed; transform: none; }

/* ---------- 提示 ---------- */
.alert {
  padding: 12px 16px; border-radius: 12px; margin: 16px 0;
  font-size: 14px; border: 1px solid transparent;
}
.alert-success { background: #eaf6f0; color: #236544; border-color: #c8e7d6; }
.alert-error { background: #fdeeee; color: #a53434; border-color: #f3cccc; }
.alert-info { background: #eef4fb; color: #2b5b8a; border-color: #cfe0f0; }

/* ---------- 顶部导航 ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255, 255, 255, .86); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.nav-wrap { display: flex; align-items: center; justify-content: space-between; height: 68px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; }
.brand-mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: 11px; font-size: 20px; color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--primary-strong));
  box-shadow: 0 4px 12px rgba(198, 122, 75, .35);
}
.brand-mark-lg { width: 56px; height: 56px; font-size: 28px; border-radius: 16px; }
.nav { display: flex; align-items: center; gap: 20px; }
.nav-link { font-size: 15px; color: var(--muted); transition: color .15s; }
.nav-link:hover { color: var(--primary); }
.nav-user { font-size: 14px; color: var(--ink); font-weight: 600; }

/* ---------- Hero ---------- */
.hero { position: relative; overflow: hidden; padding: 96px 0 80px; }
.hero-bg {
  position: absolute; inset: 0; z-index: -1;
  background:
    radial-gradient(60% 60% at 12% 0%, rgba(198, 122, 75, .16), transparent 60%),
    radial-gradient(50% 50% at 88% 10%, rgba(190, 140, 80, .14), transparent 55%),
    linear-gradient(180deg, #fdfbf7 0%, var(--bg) 100%);
}
.hero-inner { text-align: center; }
.hero-badge {
  display: inline-block; padding: 6px 16px; border-radius: 999px;
  background: var(--primary-soft); color: var(--primary-strong);
  font-size: 14px; font-weight: 600; margin-bottom: 22px;
}
.hero-title { font-size: 52px; line-height: 1.2; font-weight: 800; letter-spacing: -.5px; }
.grad {
  background: linear-gradient(120deg, var(--primary), #b8782f 60%, var(--primary-strong));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero-sub { font-size: 18px; color: var(--muted); max-width: 620px; margin: 22px auto 34px; }
.hero-actions { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }
.hero-stats {
  display: flex; gap: 48px; justify-content: center; margin-top: 54px; flex-wrap: wrap;
}
.hero-stat { text-align: center; }
.hero-stat strong { display: block; font-size: 30px; font-weight: 800; color: var(--primary-strong); }
.hero-stat span { font-size: 14px; color: var(--muted); }

/* ---------- 通用区块 ---------- */
.section { padding: 80px 0; }
.section-alt { background: #fff; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.section-head { text-align: center; margin-bottom: 48px; }
.section-head h2 { font-size: 32px; font-weight: 800; }
.section-head p { color: var(--muted); margin-top: 8px; }

.grid { display: grid; gap: 22px; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
}

/* 步骤 */
.step-card { padding: 30px 26px; transition: transform .2s, box-shadow .2s; }
.step-card:hover { transform: translateY(-6px); box-shadow: var(--shadow); }
.step-num {
  font-size: 15px; font-weight: 800; color: var(--primary);
  width: 46px; height: 46px; border-radius: 12px; background: var(--primary-soft);
  display: flex; align-items: center; justify-content: center; margin-bottom: 18px;
}
.step-card h3 { font-size: 18px; margin-bottom: 8px; }
.step-card p { color: var(--muted); font-size: 14px; }

/* 风格卡片 */
.style-card { background: #fff; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); transition: transform .2s, box-shadow .2s; }
.style-card:hover { transform: translateY(-6px); box-shadow: var(--shadow); }
.style-card-swatch { height: 120px; background: linear-gradient(135deg, #e8d5c4, #c9a57f); }
.style-card-img { width: 100%; height: 120px; object-fit: cover; }
.style-card:nth-child(2n) .style-card-swatch { background: linear-gradient(135deg, #d8d2c4, #a8b0a0); }
.style-card:nth-child(3n) .style-card-swatch { background: linear-gradient(135deg, #d9c8b8, #b09a7f); }
.style-card:nth-child(4n) .style-card-swatch { background: linear-gradient(135deg, #cfc4b6, #9c8f7a); }
.style-card-body { padding: 16px 18px 20px; }
.style-card-body h3 { font-size: 16px; margin-bottom: 4px; }
.style-card-body p { font-size: 13px; color: var(--muted); }

/* CTA */
.cta { padding: 60px 0; }
.cta-inner {
  text-align: center; padding: 60px 30px; border-radius: 24px; color: #fff;
  background: linear-gradient(135deg, #a8602f, #c67a4b 55%, #8a4b2d);
  box-shadow: var(--shadow-lg);
}
.cta-inner h2 { font-size: 30px; margin-bottom: 10px; }
.cta-inner p { opacity: .9; margin-bottom: 28px; }

/* ---------- 页脚 ---------- */
.site-footer { background: #241d18; color: #cfc6bd; margin-top: 40px; }
.footer-wrap { display: flex; justify-content: space-between; align-items: flex-start; padding: 48px 24px 30px; gap: 30px; flex-wrap: wrap; }
.footer-brand { color: #fff; font-weight: 700; font-size: 18px; margin-bottom: 6px; }
.footer-muted { color: #8d8074; font-size: 14px; }
.footer-links { display: flex; gap: 22px; }
.footer-links a { color: #cfc6bd; font-size: 14px; }
.footer-links a:hover { color: #fff; }
.footer-bottom { border-top: 1px solid rgba(255,255,255,.08); padding: 20px 24px; font-size: 13px; color: #8d8074; }

/* ---------- 登录页 ---------- */
.auth-page { display: flex; align-items: center; justify-content: center; min-height: calc(100vh - 68px); padding: 60px 24px; }
.auth-card { width: 100%; max-width: 420px; background: #fff; border: 1px solid var(--border); border-radius: 20px; padding: 42px 38px; box-shadow: var(--shadow); }
.auth-head { text-align: center; margin-bottom: 30px; }
.auth-head .brand-mark-lg { margin: 0 auto 18px; }
.auth-head h1 { font-size: 24px; margin-bottom: 8px; }
.auth-head p { color: var(--muted); font-size: 14px; }
.auth-foot { text-align: center; color: var(--muted); font-size: 13px; margin-top: 22px; }

/* ---------- 表单 ---------- */
.form { display: flex; flex-direction: column; gap: 16px; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-label { font-size: 14px; font-weight: 600; }
.form-control {
  padding: 12px 14px; border: 1px solid var(--border); border-radius: 11px;
  font-size: 15px; font-family: var(--font); background: #fff; color: var(--ink);
  transition: border-color .15s, box-shadow .15s; width: 100%;
}
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(198, 122, 75, .15); }
.form-hint { font-size: 12px; color: var(--muted); }
textarea.form-control { resize: vertical; }

/* ---------- 工作台 ---------- */
.workbench { padding: 44px 0 80px; }
.wb-header { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 30px; flex-wrap: wrap; gap: 18px; }
.wb-header h1 { font-size: 30px; }
.wb-quota { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }
.quota-chip {
  background: #fff; border: 1px solid var(--border); border-radius: 12px;
  padding: 10px 18px; font-size: 14px; color: var(--muted); box-shadow: var(--shadow-sm);
}
.quota-chip strong { color: var(--primary-strong); font-size: 18px; }
.quota-chip.quota-warn { color: var(--danger); background: #fdf3f3; border-color: #f3cccc; }

.wb-grid { display: grid; grid-template-columns: 1.1fr .9fr; gap: 24px; align-items: start; }
.wb-left, .wb-right { padding: 28px; }
.wb-title { font-size: 17px; margin-bottom: 16px; }

/* 上传区 */
.upload-area {
  border: 2px dashed var(--border); border-radius: 14px; padding: 40px 20px;
  text-align: center; cursor: pointer; transition: border-color .15s, background .15s;
  position: relative; margin-bottom: 26px; background: #fffdfa;
}
.upload-area:hover, .upload-area.dragover { border-color: var(--primary); background: var(--primary-soft); }
.upload-icon { font-size: 42px; margin-bottom: 10px; }
.upload-hint p { font-weight: 600; margin-bottom: 4px; }
.upload-hint span { font-size: 13px; color: var(--muted); }
.upload-preview { max-height: 300px; margin: 0 auto; border-radius: 10px; }
#btn-remove { position: absolute; bottom: 12px; right: 12px; }

/* 风格选择 */
.style-select { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 22px; }
.style-option {
  display: flex; align-items: center; gap: 8px; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: 11px; cursor: pointer;
  transition: all .15s; font-size: 14px;
}
.style-option:hover { border-color: var(--primary); }
.style-option input { display: none; }
.style-option-swatch {
  width: 16px; height: 16px; border-radius: 5px; flex-shrink: 0;
  background: linear-gradient(135deg, #e0c9b2, #b98e5e);
}
.style-option:nth-child(2n) .style-option-swatch { background: linear-gradient(135deg, #cfd2c4, #97a08f); }
.style-option:nth-child(3n) .style-option-swatch { background: linear-gradient(135deg, #d5c2b0, #a78e70); }
.style-option input:checked + .style-option-swatch { box-shadow: 0 0 0 2px var(--primary); }
.style-option:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }

.wb-tip { font-size: 12px; color: var(--muted); text-align: center; margin-top: 12px; }

/* 结果区 */
.wb-right { min-height: 420px; }
.result-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 320px; color: var(--muted); }
.result-placeholder { font-size: 64px; margin-bottom: 14px; opacity: .6; }
.result-loading { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 320px; gap: 16px; color: var(--muted); }
.spinner {
  width: 46px; height: 46px; border-radius: 50%;
  border: 4px solid var(--primary-soft); border-top-color: var(--primary);
  animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.result-img { display: block; max-width: 100%; margin: 0 auto; border-radius: 14px; box-shadow: var(--shadow); cursor: zoom-in; }
.result-actions { display: flex; gap: 12px; margin-top: 18px; justify-content: center; }

/* 历史 */
.wb-history { margin-top: 30px; padding: 26px; }
.wb-history-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.history-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 14px; }
.history-item { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.history-item img { width: 100%; height: 110px; object-fit: cover; }
.history-fail { height: 110px; display: flex; align-items: center; justify-content: center; color: var(--danger); background: #fdf3f3; font-size: 13px; }
.history-meta { display: flex; justify-content: space-between; align-items: center; padding: 8px 10px; font-size: 12px; }
.history-item img { cursor: zoom-in; }
.lightbox {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,.88);
  display: flex; align-items: center; justify-content: center;
  cursor: zoom-out;
}
.lightbox img { max-width: 92%; max-height: 92%; border-radius: 8px; box-shadow: 0 20px 60px rgba(0,0,0,.5); }

/* 徽章 */
.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.badge-success { background: #eaf6f0; color: #236544; }
.badge-error { background: #fdeeee; color: #a53434; }
.badge-info { background: #eef4fb; color: #2b5b8a; }

.muted { color: var(--muted); }

/* ---------- 响应式 ---------- */
@media (max-width: 960px) {
  .hero-title { font-size: 38px; }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: 1fr; }
  .wb-grid { grid-template-columns: 1fr; }
  .history-grid { grid-template-columns: repeat(3, 1fr); }
  .style-select { grid-template-columns: repeat(2, 1fr); }
}

/* ---------- 移动端（设计师主要使用场景） ---------- */
@media (max-width: 640px) {
  body { -webkit-tap-highlight-color: transparent; }
  .container { padding: 0 14px; }

  .hero { padding: 64px 0 56px; }
  .hero-title { font-size: 30px; }
  .hero-sub { font-size: 15px; }
  .hero-stats { gap: 22px; }
  .section { padding: 48px 0; }
  .section-head h2 { font-size: 24px; }

  /* 顶部导航：紧凑一行，隐藏姓名省空间 */
  .site-header { position: sticky; }
  .nav-wrap { height: 56px; }
  .brand-mark { width: 32px; height: 32px; font-size: 17px; border-radius: 9px; }
  .brand-text { font-size: 16px; }
  .nav { gap: 12px; }
  .nav-link { font-size: 14px; }
  .nav-user { display: none; }
  .btn { min-height: 44px; }
  .form-control { min-height: 48px; font-size: 16px; } /* 16px 防 iOS 聚焦自动放大 */

  /* 工作台 */
  .workbench { padding: 18px 0 64px; }
  .wb-header { flex-direction: column; align-items: stretch; gap: 14px; }
  .wb-header h1 { font-size: 22px; }
  .wb-quota { width: 100%; }
  .quota-chip { flex: 1; text-align: center; padding: 10px 12px; }
  .wb-left, .wb-right { padding: 18px 15px; border-radius: 14px; }
  .wb-title { font-size: 16px; }
  .upload-area { padding: 36px 14px; min-height: 200px; }
  .upload-icon { font-size: 40px; }
  .upload-hint p { font-size: 15px; }
  .style-select { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .style-option { padding: 13px 10px; font-size: 14px; }
  .wb-tip { font-size: 12px; }

  /* 结果区 */
  .wb-right { min-height: 0; }
  .result-empty, .result-loading { height: 230px; }
  .result-actions { flex-direction: column; }
  .result-actions .btn { width: 100%; }

  /* 历史缩略图 */
  .history-grid { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .history-item img { height: 82px; }

  /* 登录页 */
  .auth-page { padding: 28px 16px; }
  .auth-card { padding: 30px 22px; border-radius: 16px; }

  /* 页脚 */
  .footer-wrap { flex-direction: column; }
}

@media (max-width: 380px) {
  .hero-title { font-size: 26px; }
  .grid-4 { grid-template-columns: 1fr; }
  .history-grid { grid-template-columns: repeat(2, 1fr); }
  .hero-actions { flex-direction: column; }
  .hero-actions .btn { width: 100%; }
}
