/* ===== ProductLens · 灵感库 ===== */
:root {
  --bg: #f6f7f9;
  --ink: #1b1f24;
  --ink-soft: #5b636e;
  --muted: #9aa2ad;
  --line: #e6e9ee;
  --accent: #2f6df0;
  --accent-soft: #eaf1ff;
  --ok: #1f9d6b;
  --warn: #d8543b;
  --card: #ffffff;
  --radius: 14px;
  --shadow: 0 6px 24px rgba(20, 30, 50, 0.06);
  --shadow-lg: 0 18px 50px rgba(20, 30, 50, 0.14);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB',
    'Microsoft YaHei', system-ui, sans-serif;
}

* { box-sizing: border-box; }
/* 关键修复：带 hidden 属性的元素必须真正隐藏，
   否则 .analyzing / .rm-overlay 的 display:flex 会盖过浏览器默认的 [hidden]{display:none}，
   导致「AI 正在分析」遮罩一进页面就显示。 */
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }

/* ---------- 导航 ---------- */
.nav {
  position: sticky; top: 0; z-index: 40;
  background: rgba(246, 247, 249, 0.85);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.nav-inner {
  max-width: 1180px; margin: 0 auto; padding: 14px 24px;
  display: flex; align-items: center; gap: 28px;
}
.logo { font-size: 20px; font-weight: 800; letter-spacing: -0.3px; }
.logo span { color: var(--accent); }
.logo em { font-style: normal; font-size: 13px; font-weight: 600; color: var(--muted); margin-left: 6px; }
.nav-links { display: flex; gap: 22px; margin-left: auto; }
.nav-links a { font-size: 14px; font-weight: 600; color: var(--ink-soft); padding: 6px 2px; border-bottom: 2px solid transparent; }
.nav-links a.active, .nav-links a:hover { color: var(--ink); border-color: var(--accent); }

/* ---------- Hero ---------- */
.hero {
  max-width: 1180px; margin: 0 auto; padding: 64px 24px 40px;
  text-align: center;
}
.hero h1 { font-size: 40px; line-height: 1.25; font-weight: 800; letter-spacing: -0.6px; margin: 0 0 14px; }
.hero h1 em { font-style: normal; color: var(--accent); }
.hero .sub { font-size: 16px; color: var(--ink-soft); margin: 0 0 26px; }
.hero-actions { display: flex; gap: 12px; justify-content: center; }

.btn-primary, .btn-ghost {
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700; padding: 12px 22px; border-radius: 10px;
  cursor: pointer; border: 1px solid transparent; transition: 0.15s;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: #245fda; }
.btn-primary:disabled { background: #b9c6e6; cursor: not-allowed; }
.btn-ghost { background: #fff; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--muted); }
.block { width: 100%; margin-top: 10px; }

/* ---------- Section ---------- */
.section { max-width: 1180px; margin: 0 auto; padding: 34px 24px; }
.section-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 22px; }
.section-head h2 { font-size: 24px; font-weight: 800; margin: 0; letter-spacing: -0.3px; }
.muted { color: var(--muted); font-size: 13px; }

/* ---------- 灵感库 ---------- */
.lib-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 20px; }
.lib-loading { color: var(--muted); padding: 40px; grid-column: 1 / -1; text-align: center; }

.lib-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; cursor: pointer; transition: 0.18s; box-shadow: var(--shadow);
  display: flex; flex-direction: column;
}
.lib-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: #d3dae6; }
.lib-card.featured { border-color: #bcd2ff; }
.lc-thumb { position: relative; height: 210px; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.lc-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.lc-emoji { font-size: 58px; filter: drop-shadow(0 4px 8px rgba(0,0,0,0.08)); }
.lc-badge {
  position: absolute; top: 12px; left: 12px; z-index: 2; background: #1b1f24; color: #fff;
  font-size: 11px; font-weight: 700; padding: 4px 10px; border-radius: 20px;
}
.lc-cat {
  position: absolute; bottom: 12px; right: 12px; z-index: 2; background: rgba(255,255,255,0.88);
  color: var(--ink-soft); font-size: 11px; font-weight: 700; padding: 4px 10px; border-radius: 20px;
  backdrop-filter: blur(4px);
}

/* 悬停浮现的产品开发文案 */
.lc-hover {
  position: absolute; inset: 0; z-index: 3; padding: 20px 18px;
  background: linear-gradient(to top, rgba(18,22,30,0.94) 0%, rgba(18,22,30,0.82) 55%, rgba(18,22,30,0.35) 100%);
  color: #fff; display: flex; flex-direction: column; justify-content: flex-end; gap: 6px;
  opacity: 0; transform: translateY(8px); transition: 0.22s ease;
}
.lib-card:hover .lc-hover { opacity: 1; transform: translateY(0); }
.lib-card:hover .lc-cat { opacity: 0; }
.lc-hover-tag {
  align-self: flex-start; font-size: 10.5px; font-weight: 800; letter-spacing: 0.5px;
  background: var(--accent); color: #fff; padding: 3px 9px; border-radius: 6px; margin-bottom: 2px;
}
.lc-hover-copy { margin: 0; font-size: 14px; font-weight: 700; line-height: 1.45;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.lc-hover-concl { margin: 0; font-size: 12px; line-height: 1.5; color: rgba(255,255,255,0.82);
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.lc-hover-cta { margin-top: 4px; font-size: 12px; font-weight: 700; color: #9ec3ff; }

.lc-body { padding: 14px 18px 16px; display: flex; flex-direction: column; flex: 1; }
.lc-body h3 { margin: 0 0 5px; font-size: 16px; font-weight: 800; letter-spacing: -0.2px; }
.lc-desc { margin: 0 0 12px; font-size: 13px; color: var(--ink-soft); }
.lc-foot { margin-top: auto; }
.lc-open { font-size: 13px; font-weight: 700; color: var(--accent); }

/* ---------- 上传 ---------- */
.upload-box { display: grid; grid-template-columns: 1.4fr 1fr; gap: 20px; }
.drop-zone {
  position: relative; background: var(--card); border: 2px dashed #cfd6e2; border-radius: var(--radius);
  min-height: 300px; display: flex; align-items: center; justify-content: center; cursor: pointer;
  overflow: hidden; transition: 0.15s;
}
.drop-zone:hover, .drop-zone.drag { border-color: var(--accent); background: var(--accent-soft); }
.dz-inner { text-align: center; padding: 30px; }
.dz-icon { font-size: 46px; margin-bottom: 10px; }
.dz-title { font-size: 16px; font-weight: 700; margin: 0 0 6px; }
.dz-hint { font-size: 13px; color: var(--muted); margin: 0; }
.preview-img { width: 100%; height: 100%; object-fit: contain; max-height: 420px; background: #fff; }

.upload-side { display: flex; flex-direction: column; }
.hint-label { font-size: 13px; font-weight: 700; color: var(--ink-soft); margin-bottom: 8px; }
#hintInput {
  flex: 1; min-height: 150px; resize: vertical; padding: 12px 14px; font-size: 14px; line-height: 1.6;
  border: 1px solid var(--line); border-radius: 10px; font-family: inherit; background: #fff; color: var(--ink);
}
#hintInput:focus { outline: none; border-color: var(--accent); }
.upload-status { font-size: 13px; color: var(--ink-soft); margin: 10px 0 0; min-height: 18px; }
.upload-status.err { color: var(--warn); font-weight: 600; }

/* ---------- 报告弹层 ---------- */
.report-modal {
  position: fixed; inset: 0; z-index: 80; background: #eef0f4;
  display: none; flex-direction: column;
}
.report-modal.open { display: flex; }
.rm-bar {
  display: flex; align-items: center; gap: 16px; padding: 12px 20px;
  background: #fff; border-bottom: 1px solid var(--line); flex-shrink: 0;
}
.rm-back { background: none; border: none; font-size: 14px; font-weight: 700; color: var(--ink-soft); cursor: pointer; padding: 6px 4px; }
.rm-back:hover { color: var(--ink); }
.rm-title { font-size: 15px; font-weight: 700; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.btn-pdf { background: var(--accent); color: #fff; border: none; font-size: 14px; font-weight: 700; padding: 10px 18px; border-radius: 9px; cursor: pointer; }
.btn-pdf:hover { background: #245fda; }
.rm-scroll { flex: 1; overflow-y: auto; padding: 30px 16px 60px; }
.rm-stage { max-width: 820px; margin: 0 auto; }

.rm-overlay {
  position: absolute; inset: 0; background: rgba(255,255,255,0.82); backdrop-filter: blur(2px);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px;
  font-size: 15px; font-weight: 600; color: var(--ink-soft);
}

/* ---------- 分析遮罩 ---------- */
.analyzing {
  position: fixed; inset: 0; z-index: 90; background: rgba(20,24,32,0.55); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
}
.an-card {
  background: #fff; border-radius: 18px; padding: 40px 48px; text-align: center; box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; align-items: center; gap: 14px; max-width: 360px;
}
.an-title { font-size: 17px; font-weight: 800; margin: 4px 0 0; }
.an-sub { font-size: 14px; color: var(--accent); font-weight: 600; margin: 0; }
.an-note { font-size: 12px; color: var(--muted); margin: 2px 0 0; }

.rm-spinner {
  width: 40px; height: 40px; border-radius: 50%;
  border: 4px solid var(--accent-soft); border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- footer ---------- */
.footer { text-align: center; color: var(--muted); font-size: 13px; padding: 40px 20px 60px; }

/* =====================================================
   报告文档样式（同时用于屏幕预览 + html2pdf 导出）
   ===================================================== */
.report-doc {
  background: #fff; color: #1b1f24; border-radius: 12px; box-shadow: var(--shadow);
  padding: 0 0 10px; overflow: hidden;
  font-size: 14px; line-height: 1.72;
}
.report-doc * { box-sizing: border-box; }

/* 封面 */
.rd-cover { padding: 40px 44px 30px; background: linear-gradient(160deg, #f2f7ff 0%, #ffffff 70%); border-bottom: 1px solid var(--line); }
/* 封面主图（真实产品照片）—— 按原图比例显示，不裁切 */
.rd-cover-hero { margin: -10px -10px 22px; border-radius: 14px; overflow: hidden; box-shadow: 0 8px 24px rgba(20,30,50,0.10); background: #f4f6f9; text-align: center; }
.rd-cover-hero-img { display: block; width: 100%; height: auto; max-height: 560px; object-fit: contain; }

/* AI 概念图集 */
.rd-gallery { margin: 4px 44px 24px; }
.rd-gallery-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.rd-gallery-tag { font-size: 11px; font-weight: 800; color: var(--accent); background: var(--accent-soft); padding: 3px 10px; border-radius: 6px; }
.rd-gallery-title { font-size: 15px; font-weight: 800; color: var(--ink); }
.rd-gallery-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.rd-gallery-grid.single { grid-template-columns: 1fr; max-width: 60%; }
.rd-gfig { margin: 0; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); box-shadow: 0 4px 14px rgba(20,30,50,0.06); background: #fff; page-break-inside: avoid; }
.rd-gfig-img { display: block; width: 100%; height: auto; aspect-ratio: 1 / 1; object-fit: cover; background: #f4f6f9; }
.rd-gfig-cap { margin: 0; padding: 7px 10px; font-size: 11.5px; color: var(--ink-soft); border-top: 1px solid var(--line); }

/* 配色 Pantone 色卡 */
.rd-swatches { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 4px 0 16px; }
.rd-swatch { border-radius: 10px; overflow: hidden; border: 1px solid var(--line); background: #fff; box-shadow: 0 3px 10px rgba(20,30,50,0.05); page-break-inside: avoid; }
.rd-swatch-chip { position: relative; height: 120px; }
.rd-swatch-tag { position: absolute; top: 8px; left: 8px; font-size: 10px; font-weight: 800; background: rgba(255,255,255,0.9); color: var(--ink); padding: 2px 8px; border-radius: 5px; }
.rd-swatch-name { padding: 9px 11px 2px; font-size: 12.5px; font-weight: 800; color: var(--ink); line-height: 1.35; }
.rd-swatch-code { padding: 0 11px 10px; font-size: 11px; color: var(--muted); font-family: ui-monospace, Menlo, monospace; letter-spacing: 0.3px; }

/* 精简卡片（只标题，无正文） */
.rd-cards-slim { grid-template-columns: repeat(3, 1fr); }
.rd-cards-slim .rd-card { padding: 14px 15px; }
.rd-cards-slim .rd-card-title { font-size: 14.5px; margin-bottom: 0; }
.rd-cat { display: inline-block; font-size: 12px; font-weight: 700; color: var(--accent); background: var(--accent-soft); padding: 4px 12px; border-radius: 20px; margin-bottom: 16px; }
.rd-title { font-size: 27px; font-weight: 800; letter-spacing: -0.4px; margin: 0 0 6px; line-height: 1.3; }
.rd-sub { font-size: 12px; font-weight: 700; letter-spacing: 1px; color: var(--muted); margin-bottom: 16px; }
.rd-tagline { font-size: 14.5px; color: var(--ink-soft); margin: 0 0 22px; }
.rd-highlights { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 22px; }
.rd-hl { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 16px 14px; box-shadow: 0 2px 8px rgba(20,30,50,0.04); }
.rd-hl-val { font-size: 23px; font-weight: 800; color: var(--accent); letter-spacing: -0.5px; }
.rd-hl-label { font-size: 12.5px; font-weight: 700; color: var(--ink); margin: 4px 0 6px; }
.rd-hl-note { font-size: 12px; color: var(--ink-soft); line-height: 1.55; }
.rd-oneline { display: flex; align-items: flex-start; gap: 12px; background: #1b1f24; color: #fff; border-radius: 12px; padding: 16px 18px; }
.rd-oneline-tag { flex-shrink: 0; font-size: 12px; font-weight: 800; background: var(--accent); color: #fff; padding: 4px 10px; border-radius: 6px; margin-top: 2px; }
.rd-oneline-text { font-size: 14px; line-height: 1.6; }

/* 通用小节 */
.rd-section { padding: 28px 44px 4px; page-break-inside: avoid; }
.rd-h2 { font-size: 19px; font-weight: 800; margin: 0 0 14px; padding-left: 12px; border-left: 4px solid var(--accent); letter-spacing: -0.2px; }
.rd-p { font-size: 14px; color: var(--ink); margin: 0 0 14px; }
.rd-intro { color: var(--ink-soft); }

/* 核心判断 */
.rd-verdict { background: #fbfcfe; }
.rd-verdict-head { font-size: 16px; font-weight: 800; margin: 0 0 10px; }
.rd-verdict-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 4px 0 16px; }
.rd-col { border-radius: 12px; padding: 14px 16px; }
.rd-must { background: #effaf4; border: 1px solid #cdebdb; }
.rd-avoid { background: #fdf1ee; border: 1px solid #f3d4cb; }
.rd-col h4 { margin: 0 0 8px; font-size: 13.5px; font-weight: 800; }
.rd-must h4 { color: var(--ok); }
.rd-avoid h4 { color: var(--warn); }
.rd-col ul { margin: 0; padding-left: 18px; }
.rd-col li { font-size: 13px; margin-bottom: 5px; color: var(--ink); }
.rd-naming { background: #fff; border: 1px dashed #cfd6e2; border-radius: 10px; padding: 12px 16px; font-size: 13px; color: var(--ink-soft); }
.rd-naming strong { color: var(--ink); }

/* 卡片 */
.rd-cards { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin: 4px 0 16px; }
.rd-card { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 15px 16px; page-break-inside: avoid; }
.rd-card-tag { display: inline-block; font-size: 11px; font-weight: 800; color: var(--accent); background: var(--accent-soft); padding: 3px 9px; border-radius: 6px; margin-bottom: 8px; }
.rd-card-title { font-size: 14.5px; font-weight: 800; margin-bottom: 5px; }
.rd-card-body { font-size: 13px; color: var(--ink-soft); margin: 0; line-height: 1.6; }

/* 表格 */
.rd-table-wrap { overflow: hidden; border-radius: 10px; border: 1px solid var(--line); margin: 4px 0 16px; }
.rd-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.rd-table th { background: #f2f5fa; text-align: left; font-weight: 800; padding: 10px 12px; color: var(--ink); border-bottom: 1px solid var(--line); }
.rd-table td { padding: 9px 12px; border-bottom: 1px solid #eef1f5; color: var(--ink-soft); vertical-align: top; }
.rd-table tr:last-child td { border-bottom: none; }
.rd-table tr:nth-child(even) td { background: #fafbfd; }
.rd-td-key { font-weight: 700; color: var(--ink); white-space: nowrap; }

/* 要点 */
.rd-bullets { margin: 4px 0 16px; padding-left: 20px; }
.rd-bullets li { font-size: 13.5px; margin-bottom: 6px; color: var(--ink); }

/* 结语 */
.rd-closing { background: #fbfcfe; border-top: 1px solid var(--line); margin-top: 10px; }
.rd-closing .rd-p { font-size: 14px; line-height: 1.78; }

.rd-foot { padding: 18px 44px; font-size: 11.5px; color: var(--muted); text-align: center; border-top: 1px solid var(--line); }

/* ---------- 响应式 ---------- */
@media (max-width: 760px) {
  .hero h1 { font-size: 30px; }
  .upload-box { grid-template-columns: 1fr; }
  .rd-highlights, .rd-cards, .rd-verdict-cols { grid-template-columns: 1fr; }
  .rd-cover, .rd-section, .rd-foot { padding-left: 22px; padding-right: 22px; }
  .nav-links { gap: 14px; }
}

/* ---------- 打印 / 导出 PDF：只输出报告本体 ---------- */
@media print {
  .nav, .hero, .footer, #library, #upload, .analyzing, .rm-bar, .rm-overlay { display: none !important; }
  body { background: #fff !important; }
  .report-modal { position: static !important; display: block !important; background: #fff !important; }
  .rm-scroll { overflow: visible !important; height: auto !important; padding: 0 !important; }
  .rm-stage { max-width: 100% !important; margin: 0 !important; }
  .report-doc { box-shadow: none !important; border-radius: 0 !important; }
  .rd-section, .rd-gallery, .rd-gfig, .rd-swatch, .rd-card, .rd-cover, .rd-table-wrap { page-break-inside: avoid; }
}
