/* ============================================================
 * 口红搭档 LipPartner 样式
 * ============================================================ */
:root {
  --primary: #c94f5e;
  --primary-dark: #a63a48;
  --primary-light: #fbe9ec;
  --bg: #faf7f5;
  --card: #ffffff;
  --text: #3a2e30;
  --muted: #93838a;
  --border: #f0e2e4;
  --ok: #4caf7d;
  --warn: #e0a63c;
  --bad: #e05c5c;
  --radius: 14px;
  --shadow: 0 2px 12px rgba(180, 90, 100, .08);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: "PingFang SC", "Microsoft YaHei", -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}
.wrap { max-width: 1400px; margin: 0 auto; padding: 0 16px; }
/* 三栏布局仅用于试色推荐页，其余页签卡片仍保持窄版阅读宽度 */
#tab-dupe .card, #tab-cabinet .card, #tab-report .card, #reportArea .card { max-width: 960px; margin-left: auto; margin-right: auto; }
.hidden { display: none !important; }
.center { text-align: center; }
.muted { color: var(--muted); font-size: 14px; }

/* ---------- header ---------- */
.site-header {
  background: linear-gradient(135deg, #a63a48, #c94f5e 60%, #d97a6c);
  color: #fff;
  padding: 20px 0 0;
  box-shadow: var(--shadow);
}
.header-inner { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding-bottom: 12px; }
.logo { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 260px; }
.logo-mark { font-size: 34px; }
.logo h1 { font-size: 22px; line-height: 1.2; }
.logo h1 small { font-size: 13px; font-weight: 400; opacity: .85; margin-left: 6px; }
.slogan { font-size: 12px; opacity: .85; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.tab {
  background: rgba(255,255,255,.14); color: #fff; border: none;
  padding: 9px 16px; border-radius: 10px 10px 0 0; cursor: pointer;
  font-size: 14px; transition: background .2s;
}
.tab:hover { background: rgba(255,255,255,.25); }
.tab.active { background: var(--bg); color: var(--primary-dark); font-weight: 600; }

/* ---------- layout ---------- */
main { padding: 20px 0 40px; }
.panel { display: none; }
.panel.active { display: block; }
.card {
  background: var(--card); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 20px; margin-bottom: 16px;
}
.card h2 { font-size: 18px; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
em.privacy-note {
  font-style: normal; font-size: 12px; color: var(--ok);
  background: #eaf7f0; border-radius: 20px; padding: 2px 10px;
}
.step-no {
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--primary); color: #fff; font-size: 14px; flex: none;
}
.tag {
  background: var(--primary-light); color: var(--primary-dark);
  font-size: 13px; padding: 2px 10px; border-radius: 20px; font-weight: 500;
}

/* ---------- buttons & chips ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: none; border-radius: 10px; cursor: pointer;
  padding: 9px 18px; font-size: 14px; transition: all .15s;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-ghost { background: #fff; color: var(--primary-dark); border: 1px solid var(--primary); }
.btn-ghost:hover { background: var(--primary-light); }
.btn-lg { font-size: 16px; padding: 13px 30px; border-radius: 24px; }
.btn-mini {
  padding: 4px 10px; font-size: 12px; border-radius: 8px;
  background: var(--primary-light); color: var(--primary-dark); border: none; cursor: pointer;
}
.btn-mini:hover { background: #f6d5da; }
.btn-mini.tryon-on { background: var(--primary-dark, #c2185b); color: #fff; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 7px 16px; border-radius: 20px; border: 1px solid var(--border);
  background: #fff; cursor: pointer; font-size: 14px; transition: all .15s;
}
.chip:hover { border-color: var(--primary); }
.chip.active {
  background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 500;
}
.chip-btn {
  padding: 5px 12px; border-radius: 8px; border: 1px solid var(--border);
  background: #fff; cursor: pointer; font-size: 13px;
}
.chip-btn:hover { border-color: var(--primary); color: var(--primary-dark); }
.chip-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ---------- step1 检测 ---------- */
/* 一屏三栏：卡片1 检测 | 卡片2 偏好 | 卡片3 推荐（最右） */
.match-grid {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(250px, .75fr) minmax(300px, 1.05fr);
  gap: 14px; align-items: start;
}
.match-grid .card { margin-bottom: 0; }
@media (max-width: 1080px) { .match-grid { grid-template-columns: 1fr; } .match-grid .card { margin-bottom: 16px; } }
.photo-stage {
  position: relative; background: #f5eef0; border: 2px dashed #dcc4c8;
  border-radius: var(--radius); min-height: 300px; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
}
.photo-stage canvas { max-width: 100%; max-height: 340px; display: block; cursor: crosshair; }
.photo-remove {
  position: absolute; top: 8px; right: 8px; z-index: 2;
  width: 30px; height: 30px; border-radius: 50%; border: none;
  background: rgba(0, 0, 0, .55); color: #fff; font-size: 15px;
  line-height: 30px; text-align: center; cursor: pointer; padding: 0;
}
.photo-remove:hover { background: rgba(0, 0, 0, .78); }
.photo-badge {
  position: absolute; top: 8px; right: 8px; z-index: 2;
  font-size: 12px; font-weight: 600; color: #fff;
  background: rgba(0, 0, 0, .55); border-radius: 10px;
  padding: 3px 10px; pointer-events: none;
}
.photo-empty { color: var(--muted); text-align: center; font-size: 14px; padding: 20px; }
.photo-actions { display: flex; gap: 10px; margin-top: 10px; flex-wrap: wrap; align-items: center; }
.photo-actions label { cursor: pointer; }
.photo-purpose { flex-basis: 100%; line-height: 1.6; }
.photo-hint { margin-top: 8px; font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.detect-status {
  flex-basis: 100%;
  margin-top: 10px;
  padding: 10px 14px;
  font-size: 15px; font-weight: 700;
  color: #1e7a4f;
  background: #eaf7f0;
  border-left: 4px solid var(--ok);
  border-radius: 8px;
}
.detect-status:empty { display: none; }
.detect-status.err { color: #b3261e; background: #fdecec; border-left-color: #b3261e; }

.detect-result { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.detect-block { background: #fdf8f8; border-radius: 10px; padding: 10px 12px; }
.detect-block h3 { font-size: 14px; color: var(--primary-dark); margin-bottom: 6px; }
.lab-readout {
  font-size: 12px; color: var(--muted); font-family: Consolas, monospace;
  margin-bottom: 8px; min-height: 18px;
}
.lab-readout .auto-badge {
  background: #eaf7f0; color: var(--ok); border-radius: 4px; padding: 0 6px;
  font-family: inherit; margin-left: 6px;
}
.tone-options { display: flex; flex-wrap: wrap; gap: 6px; }
.tone-hint { font-size: 12px; color: var(--muted); margin-top: 6px; }

/* ---------- step2 偏好 ---------- */
.pref-row { display: flex; gap: 12px; margin-bottom: 12px; align-items: flex-start; flex-wrap: wrap; }
.pref-label { font-size: 14px; color: var(--muted); width: 70px; flex: none; padding-top: 7px; }
.pref-row-btn { margin-top: 18px; }
.pref-sub {
  font-size: 15px; color: var(--primary-dark); font-weight: 600;
  margin: 14px 0 10px; padding-top: 12px; border-top: 1px dashed var(--border);
}
.match-card2 .detect-result { margin-top: 0; }

/* ---------- 卡片3 推荐结果（右侧栏紧凑化） ---------- */
.result-placeholder { color: var(--muted); font-size: 13px; padding: 24px 8px; text-align: center; }
.match-card3 .tryon-area { gap: 14px; margin: 10px 0 14px; flex-wrap: nowrap; justify-content: flex-start; }
.match-card3 .tryon-item { flex: 1; min-width: 0; }
.match-card3 .tryon-label { min-height: 2.8em; } /* 预留两行高度，试色切换文字时布局不跳动 */
.match-card3 .lips-svg { width: 100%; height: auto; }
.match-card3 .result-card { grid-template-columns: 56px 1fr; padding: 10px 12px; }
.match-card3 .swatch { width: 56px; height: 56px; }
.match-card3 .result-list { gap: 8px; }
.match-card3 .result-body h3 { font-size: 14px; margin: 0 0 2px; }
.match-card3 .de-row { margin: 2px 0; font-size: 12px; }
.match-card3 .de-bar { height: 5px; }
.match-card3 .explain { font-size: 12px; padding: 4px 8px; margin-top: 3px; }
.match-card3 .result-actions { margin-top: 6px; gap: 6px; }

/* ---------- 试色展示 ---------- */
.tryon-area {
  display: flex; gap: 30px; justify-content: center; align-items: flex-end;
  margin: 16px 0 22px; flex-wrap: wrap;
}
.tryon-item { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.tryon-label { font-size: 13px; color: var(--muted); }
.tryon-label small { font-size: 11px; }
.lips-svg { width: 170px; height: 100px; }
.match-card3 .lip-crop { width: 100%; height: auto; border-radius: 8px; box-shadow: 0 1px 4px rgba(0,0,0,.12); }
.lip-path-shape { stroke: rgba(0,0,0,.12); stroke-width: 1.2; }
.lip-line { fill: none; stroke: rgba(0,0,0,.28); stroke-width: 2; stroke-linecap: round; }

/* ---------- 推荐结果 ---------- */
.result-list { display: flex; flex-direction: column; gap: 12px; }
.result-card {
  border: 1px solid var(--border); border-radius: 12px; padding: 14px;
  display: grid; grid-template-columns: 76px 1fr; gap: 14px; position: relative;
}
.result-card.locked .result-body { filter: blur(5px); user-select: none; pointer-events: none; }
.result-card .rank-badge {
  position: absolute; top: -8px; left: -6px; background: var(--primary-dark);
  color: #fff; font-size: 11px; border-radius: 8px; padding: 1px 8px;
}
.swatch {
  width: 76px; height: 76px; border-radius: 12px; cursor: pointer;
  box-shadow: inset 0 0 0 3px rgba(255,255,255,.35), var(--shadow);
}
.result-body h3 { font-size: 15px; }
.result-body h3 small { color: var(--muted); font-weight: 400; margin-left: 6px; font-size: 12px; }
.de-row { display: flex; align-items: center; gap: 8px; margin: 6px 0; font-size: 13px; }
.de-value { font-family: Consolas, monospace; color: var(--primary-dark); font-weight: 600; }
.de-bar {
  flex: 1; height: 7px; border-radius: 4px; overflow: hidden;
  background: #f3e5e7; position: relative;
}
.de-bar i { display: block; height: 100%; border-radius: 4px; transition: width .5s; }
.de-threshold {
  position: absolute; top: -3px; bottom: -3px; width: 2px; background: rgba(0,0,0,.25);
}
.explain { font-size: 13px; color: #6b5a5e; background: #fdf8f8; border-radius: 8px; padding: 8px 10px; margin-top: 6px; }
.result-actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; align-items: center; }
.lock-overlay {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 8px; cursor: pointer;
  background: rgba(255,255,255,.25); border-radius: 12px;
}

/* ---------- 反馈 ---------- */
.feedback-box {
  margin-top: 16px; padding-top: 14px; border-top: 1px dashed var(--border);
  display: flex; align-items: center; gap: 10px; font-size: 14px; flex-wrap: wrap;
}
.fb-thanks { color: var(--ok); font-size: 13px; }

/* ---------- 付费 ---------- */
.paywall-box {
  margin-top: 14px; text-align: center; padding: 18px;
  background: linear-gradient(135deg, #fdf3f0, #fceef2);
  border-radius: 12px; border: 1px dashed #e8b9c0;
}
.paywall-box p { font-size: 14px; margin-bottom: 10px; color: var(--primary-dark); }

/* ---------- 搜索行 ---------- */
.search-row { display: flex; gap: 10px; margin-bottom: 14px; }
.search-row input {
  flex: 1; padding: 10px 14px; border: 1px solid var(--border); border-radius: 10px;
  font-size: 14px; outline: none;
}
.search-row input:focus { border-color: var(--primary); }
.picked-shade {
  display: flex; align-items: center; gap: 12px; padding: 10px 14px;
  background: #fdf8f8; border-radius: 10px; margin-bottom: 12px;
}
.picked-shade .swatch { width: 44px; height: 44px; }

/* ---------- 平替列表 ---------- */
.dupe-item {
  display: grid; grid-template-columns: 52px 1fr auto; gap: 12px; align-items: center;
  border: 1px solid var(--border); border-radius: 10px; padding: 10px 14px; margin-bottom: 8px;
}
.dupe-item .swatch { width: 52px; height: 52px; border-radius: 10px; }
.dupe-de { font-family: Consolas, monospace; font-weight: 600; color: var(--ok); font-size: 15px; }
.dupe-de.warn { color: var(--warn); }
.dupe-meta { font-size: 12px; color: var(--muted); }
.dupe-price { font-size: 13px; color: var(--primary-dark); font-weight: 600; }
.dupe-empty { text-align: center; color: var(--muted); padding: 24px 0; font-size: 14px; }

/* ---------- 口红柜 ---------- */
.cabinet-stats { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.stat-chip {
  background: var(--primary-light); color: var(--primary-dark);
  font-size: 12px; border-radius: 8px; padding: 4px 10px;
}
.cabinet-item {
  display: grid; grid-template-columns: 52px 1fr auto; gap: 12px; align-items: center;
  border: 1px solid var(--border); border-radius: 10px; padding: 10px 14px; margin-bottom: 8px;
}
.cabinet-item .swatch { width: 52px; height: 52px; border-radius: 10px; }
.fav-btn { background: none; border: none; font-size: 18px; cursor: pointer; opacity: .35; }
.fav-btn.on { opacity: 1; }
.dupe-check-result .dupe-item { border-color: #f2c4c4; background: #fdf5f5; }
.check-ok { color: var(--ok); font-weight: 600; }
.check-warn { color: var(--bad); font-weight: 600; }
.cabinet-empty, .dupe-empty { color: var(--muted); text-align: center; padding: 18px; font-size: 14px; }

/* ---------- 报告 ---------- */
.report-sec { margin-bottom: 14px; }
.report-sec h3 {
  font-size: 15px; color: var(--primary-dark); margin-bottom: 8px;
  padding-left: 10px; border-left: 3px solid var(--primary);
}
.report-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.report-tile { background: #fdf8f8; border-radius: 10px; padding: 10px 12px; font-size: 13px; }
.report-tile b { display: block; font-size: 14px; margin-bottom: 2px; }
.report-tile .swatch-mini {
  display: inline-block; width: 14px; height: 14px; border-radius: 4px;
  vertical-align: -2px; margin-right: 4px;
}
.report-line { font-size: 13px; margin: 4px 0; }
.report-actions { text-align: center; margin-top: 8px; }

/* ---------- footer / toast ---------- */
.site-footer {
  background: #f2ebea; color: var(--muted); font-size: 12px;
  padding: 18px 0; margin-top: 20px;
}
.site-footer p { margin-bottom: 4px; }
.toast {
  position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%);
  background: rgba(58, 46, 48, .92); color: #fff; font-size: 14px;
  padding: 10px 22px; border-radius: 24px; z-index: 99; animation: fadein .25s;
}
@keyframes fadein { from { opacity: 0; transform: translate(-50%, 8px); } }
@keyframes sheetin { from { opacity: 0; } }

/* ---------- 导出试色卡弹窗 ---------- */
.modal-mask {
  position: fixed; inset: 0; background: rgba(30, 20, 22, .55);
  z-index: 90; display: flex; align-items: center; justify-content: center;
  padding: 16px; animation: fadein .2s;
}
.modal-box {
  background: var(--card); border-radius: var(--radius);
  width: min(430px, 100%); max-height: 92vh; overflow: auto;
  padding: 18px; box-shadow: 0 12px 40px rgba(0, 0, 0, .18);
}
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.modal-head h3 { margin: 0; font-size: 16px; }
.modal-close {
  border: none; background: none; font-size: 18px; color: var(--muted);
  cursor: pointer; padding: 4px 8px; line-height: 1;
}
.modal-mode { display: flex; gap: 8px; margin-bottom: 12px; }
.modal-preview img {
  width: 100%; display: block; border-radius: 10px;
  border: 1px solid var(--border); background: #17181c;
}
.modal-actions { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; gap: 10px; }

/* ---------- 生成笔记弹窗（成品笔记预览，模拟小红书排版） ---------- */
.note-figure {
  border: 1px solid var(--border); border-radius: 10px;
  padding: 8px; margin-bottom: 12px; background: var(--bg);
}
.note-figure img { display: none; border-radius: 8px; background: #17181c; max-height: 34vh; width: auto; margin: 0 auto; }
.note-figure.has-img img { display: block; }
.note-figure-bar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; margin-top: 8px;
}
.note-figure.has-img .note-figure-bar { margin-top: 8px; }
.note-figure-meta { font-size: 12px; color: var(--muted); line-height: 1.5; flex: 1; }
.note-figure:not(.has-img) { border-style: dashed; }
.note-figure:not(.has-img) .note-figure-bar { margin-top: 0; }
.note-figure:not(.has-img) #btnDownloadFig { display: none; }
.note-card {
  background: #fff; border: 1px solid var(--border); border-radius: 10px;
  padding: 16px 16px 14px; max-height: 44vh; overflow: auto;
}
.note-title {
  font-size: 17px; font-weight: 700; line-height: 1.5;
  margin: 0 0 12px; color: var(--text);
}
.note-card p { font-size: 13.5px; line-height: 1.9; margin: 0 0 10px; color: #4a3b3e; }
.note-card p:last-child { margin-bottom: 0; }
.note-pt b { color: var(--primary-dark); }
.note-data {
  background: var(--primary-light); border-radius: 8px; padding: 8px 10px;
  font-size: 13px; color: var(--primary-dark); font-family: Consolas, monospace;
}
.note-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.note-tags span {
  font-size: 12.5px; color: #1a4a8a; background: #eaf1fa;
  border-radius: 4px; padding: 2px 7px;
}
.note-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; flex-wrap: wrap; }

/* ---------- 按钮对（生成推荐 + 导出档案卡） ---------- */
.btn-pair { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

/* ---------- 色彩报告照片开关与照片 ---------- */
.report-photo-toggle { vertical-align: middle; margin-left: 8px; }
.report-photo { display: flex; justify-content: center; margin: 12px 0 4px; }
.report-photo img {
  max-width: 260px; width: 100%; display: block;
  border-radius: 12px; border: 1px solid var(--border); background: #17181c;
}

/* ============================================================
 * 移动端独立布局（≤768px）
 * ============================================================ */
.tabbar, .m-steps, .m-nav { display: none; }

@media (max-width: 768px) {
  /* --- 顶部导航 → 底部 tab 栏 --- */
  .tabs { display: none; }
  .tabbar {
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 80;
    display: flex; background: var(--card);
    border-top: 1px solid var(--border);
    padding-bottom: env(safe-area-inset-bottom);
    box-shadow: 0 -2px 12px rgba(180, 90, 100, .10);
  }
  .tabbar .tab {
    flex: 1; border-radius: 0; background: none; color: var(--muted);
    font-size: 12px; padding: 10px 0 8px;
  }
  .tabbar .tab.active { background: none; color: var(--primary-dark); font-weight: 600; }

  main { padding-bottom: calc(80px + env(safe-area-inset-bottom)); }
  .wrap { padding: 0 12px; }
  .toast { bottom: calc(88px + env(safe-area-inset-bottom)); }
  main { padding-top: 12px; }

  /* --- 试色推荐：分步向导 --- */
  .match-grid { display: block; }
  .match-grid[m-step] .step-card { display: none; }
  .match-grid[m-step="1"] .match-card1,
  .match-grid[m-step="2"] .match-card2,
  .match-grid[m-step="3"] .match-card3 { display: block; }

  .m-steps {
    display: flex; gap: 6px; margin-bottom: 12px;
  }
  .m-steps span {
    flex: 1; text-align: center; font-size: 13px; color: var(--muted);
    background: var(--card); border-radius: 20px; padding: 6px 0;
    border: 1px solid var(--border);
  }
  .m-steps span.on {
    background: var(--primary); border-color: var(--primary);
    color: #fff; font-weight: 600;
  }

  .photo-stage canvas { max-height: 46vh; }
  .photo-stage { min-height: 220px; }

  /* --- 触控目标与间距 --- */
  .chip, .chip-btn { padding: 9px 14px; }
  .btn { min-height: 40px; }
  .btn-lg { min-height: 46px; }
  .modal-close, .photo-remove { width: 40px; height: 40px; font-size: 17px; line-height: 40px; }
  .card { padding: 14px; }
  .m-nav { display: inline-flex; }
  #mNext1 { width: 100%; margin-top: 12px; }

  /* --- 试色对比区 --- */
  .match-card3 .tryon-area { flex-wrap: wrap; gap: 10px; justify-content: center; }
  .lips-svg { width: 150px; height: 88px; }

  /* --- 弹窗 bottom sheet --- */
  .modal-mask { align-items: flex-end; padding: 0; animation: sheetin .2s; }
  .modal-box {
    width: 100%; max-height: 88dvh; padding: 14px;
    border-radius: 16px 16px 0 0;
  }

  /* --- 列表/结果 --- */
  .result-card { grid-template-columns: 60px 1fr; padding: 10px 12px; }
  .search-row { flex-wrap: wrap; }
  .search-row .btn { flex-basis: 100%; }
}

