/* ============================================================
   AI 穿搭助手 · 设计系统
   风格：wearwow 式黑白极简 —— 白底 / 近黑 / 超粗标题 /
   胶囊按钮 / 大圆角卡片 / 粉→薄荷绿渐变仅用于 AI 能力点缀
   ============================================================ */

/* 展示字体自托管（原 Google Fonts 外链国内连不上：轻则回退系统字体，重则拖慢首屏）*/
@font-face {
  font-family: "Archivo Black";
  src: url("../assets/fonts/archivo-black.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --ink: #101012;          /* 主文字 · 近黑 */
  --ink-2: #55555a;        /* 次级文字 */
  --muted: #97979c;        /* 弱文字 */
  --bg: #fafaf9;           /* 页面底 */
  --card: #ffffff;         /* 卡片 */
  --fill: #f4f4f2;         /* 浅灰填充（chips / 占位） */
  --fill-2: #ececea;       /* 深一档填充 */
  --line: #ebebe8;         /* 分割线 */
  --grad: linear-gradient(96deg, #ffc9e5 0%, #ffd9c4 38%, #b9f0d2 100%);
  --grad-soft: linear-gradient(160deg, #eafaf1 0%, #fdf0f6 55%, #f6effa 100%);
  --danger: #e5484d;
  --r-xl: 28px;
  --r-lg: 22px;
  --r-md: 16px;
  --shadow-card: 0 2px 10px rgba(16, 16, 18, .05);
  --shadow-float: 0 10px 30px rgba(16, 16, 18, .16);
  --font-display: "Archivo Black", "PingFang SC", "Heiti SC", sans-serif;
  --font-body: -apple-system, BlinkMacSystemFont, "PingFang SC", "Heiti SC",
               "Microsoft YaHei", sans-serif;
  /* iOS 规范：16pt 页边距、49pt TabBar + 底部安全区 */
  --pad: 16px;
  --nav-h: 82px;
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body { height: 100%; }
/* 手机上下拉回弹露出的区域也保持与顶部渐变同色系 */
html { background: #e9f5ee; }

body {
  font-family: var(--font-body);
  color: var(--ink);
  /* 手机：最底层就是淡薄荷，Safari 状态栏区域取的正是这层颜色 */
  background: #e9f5ee;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;   /* 禁止页面整体左右滑动 */
}
/* 桌面：页面外围恢复灰色衬托手机画幅 */
@media (min-width: 431px) {
  body { background: #e9e9e6; }
}

/* ---------- 手机画幅 ---------- */
.app {
  position: relative;
  max-width: 430px;
  min-height: 100dvh;
  margin: 0 auto;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  overflow: clip;
  /* 手机自带状态栏：内容避开刘海安全区，再留一点呼吸空间 */
  padding-top: calc(env(safe-area-inset-top) + 8px);
}
@media (min-width: 431px) {
  .app { box-shadow: 0 0 60px rgba(0,0,0,.18); }
}

/* 顶部浅色氛围渐变（wearwow 式）
   最顶部先铺一段与手机状态栏 theme-color(#f0f6f1) 完全相同的纯色，
   再过渡进渐变，保证状态栏与页面无接缝 */
.app::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 240px;
  background:
    linear-gradient(#e9f5ee 0, #e9f5ee 34px, rgba(233,245,238,0) 120px),
    var(--grad-soft);
  mask-image: linear-gradient(#000 20%, transparent);
  -webkit-mask-image: linear-gradient(#000 20%, transparent);
  pointer-events: none;
}
.app > * { position: relative; }

/* ---------- 页头 ---------- */
.pagehead { padding: 10px var(--pad) 4px; display: flex; align-items: center; gap: 12px; }
.pagehead .grow { flex: 1; }

.brand {
  font-family: var(--font-display);
  font-size: 26px;
  letter-spacing: -.01em;
}
.brand .zh { font-family: var(--font-body); font-weight: 900; }

.h-display {
  font-weight: 900;
  font-size: 34px;
  line-height: 1.22;
  letter-spacing: .01em;
}
.h-sub { color: var(--ink-2); font-size: 15px; margin-top: 10px; line-height: 1.6; }

.section-title { font-size: 20px; font-weight: 800; }
.section-note { font-size: 13px; color: var(--muted); }

/* 圆形图标按钮（返回 / 关闭）· iOS 最小可点区域 44pt */
.iconbtn {
  width: 44px; height: 44px; border-radius: 50%;
  border: none; background: var(--card);
  box-shadow: var(--shadow-card);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 18px; cursor: pointer; color: var(--ink);
  flex: none;
}
.iconbtn:active { transform: scale(.92); }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: none; cursor: pointer;
  border-radius: 999px;
  font-family: var(--font-body);
  font-size: 17px; font-weight: 600;   /* iOS Body 17pt Semibold */
  min-height: 50px;
  padding: 14px 24px;
  transition: transform .12s ease, opacity .15s ease;
  text-decoration: none;
}
.btn:active { transform: scale(.97); }
.btn-block { width: 100%; }
.btn-primary { background: var(--ink); color: #fff; }
.btn-primary:disabled { background: #d9d9d6; color: #fff; cursor: not-allowed; }
.btn-ghost { background: var(--card); color: var(--ink); border: 1.5px solid var(--line); }
.btn-soft { background: var(--fill); color: var(--ink); }
.btn-sm { padding: 10px 18px; font-size: 14px; }

/* AI 渐变描边胶囊（唯一彩色点缀） */
.ai-pill {
  position: relative;
  border-radius: 999px;
  background: var(--card);
  border: 2px solid transparent;
  background-image: linear-gradient(var(--card), var(--card)), var(--grad);
  background-origin: border-box;
  background-clip: padding-box, border-box;
}

/* ---------- Chips ---------- */
.chips { display: flex; gap: 10px; overflow-x: auto; scrollbar-width: none; padding: 4px var(--pad); }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 18px;
  border-radius: 999px;
  background: var(--card);
  border: 1.5px solid var(--line);
  font-size: 15px; font-weight: 600; color: var(--ink-2);  /* iOS Subheadline 15pt */
  cursor: pointer; user-select: none;
  transition: all .15s ease;
}
.chip.active { background: var(--ink); border-color: var(--ink); color: #fff; }

/* 可选择的大 chip（引导问卷用） */
.pick {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 14px 22px;
  border-radius: 999px;
  background: var(--card);
  border: 1.5px solid var(--line);
  font-size: 16px; font-weight: 700;
  cursor: pointer;
  transition: all .15s ease;
}
.pick.active { border-color: var(--ink); background: var(--ink); color: #fff; }

/* ---------- 卡片 ---------- */
.card {
  background: var(--card);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-card);
}

/* ---------- 底部导航 ---------- */
.tabbar {
  position: sticky; bottom: 0; z-index: 30;
  margin-top: auto;
  height: var(--nav-h);
  background: color-mix(in srgb, var(--card) 92%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  align-items: stretch;
  padding-bottom: 18px;   /* iOS Home Indicator 安全区 */
}
.tabbar a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  text-decoration: none; color: var(--muted);
  font-size: 10px; font-weight: 500;   /* iOS TabBar 标签 10pt */
}
.tabbar a svg { width: 25px; height: 25px; }
.tabbar a.active { color: var(--ink); }
.tabbar .fab-slot { position: relative; }
.fab {
  /* 黑圆缩小并整体下移，完全收进导航栏内；+ 号放大 */
  position: absolute; left: 50%; top: 6px; transform: translateX(-50%);
  width: 48px; height: 48px; border-radius: 50%;
  background: var(--ink); color: #fff;
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-float);
  text-decoration: none;
}
.tabbar a.fab { color: #fff; }   /* 提高优先级：+号纯白，不被 .tabbar a 的灰色盖掉 */
.fab:active { transform: translateX(-50%) scale(.94); }

/* ---------- 半屏抽屉 Sheet ---------- */
.sheet-mask {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(12,12,14,.45);
  opacity: 0; pointer-events: none;
  transition: opacity .25s ease;
}
.sheet-mask.show { opacity: 1; pointer-events: auto; }
.sheet {
  position: fixed; left: 50%; bottom: 0; z-index: 61;
  width: 100%; max-width: 430px;
  transform: translate(-50%, 105%);
  transition: transform .32s cubic-bezier(.32,.72,.35,1);
  background: var(--card);
  border-radius: 26px 26px 0 0;
  padding: 10px 24px calc(24px + env(safe-area-inset-bottom));
  max-height: 88dvh; overflow-y: auto;
}
.sheet.show { transform: translate(-50%, 0); }
.sheet-grab { width: 42px; height: 4.5px; border-radius: 3px; background: var(--fill-2); margin: 4px auto 14px; }
.sheet-title { text-align: center; font-size: 18px; font-weight: 800; margin-bottom: 18px; position: relative; }
.sheet-x {
  position: absolute; right: -6px; top: -4px;
  border: none; background: none; font-size: 20px; cursor: pointer; color: var(--ink);
}

/* ---------- 居中弹窗 ---------- */
.modal-mask {
  position: fixed; inset: 0; z-index: 70;
  background: rgba(12,12,14,.5);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none;
  transition: opacity .22s ease;
}
.modal-mask.show { opacity: 1; pointer-events: auto; }
.modal {
  width: min(78%, 330px);
  background: var(--card);
  border-radius: var(--r-xl);
  padding: 30px 26px 22px;
  text-align: center;
  transform: scale(.92);
  transition: transform .22s ease;
}
.modal-mask.show .modal { transform: scale(1); }
.modal h3 { font-size: 18.5px; font-weight: 800; }
.modal p { color: var(--ink-2); font-size: 15px; margin: 12px 0 22px; }
.modal .link { background: none; border: none; color: var(--muted); font-size: 15px; margin-top: 14px; cursor: pointer; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 120px; z-index: 90;
  transform: translateX(-50%) translateY(16px);
  background: rgba(16,16,18,.92); color: #fff;
  padding: 12px 22px; border-radius: 999px;
  font-size: 14.5px; font-weight: 600;
  opacity: 0; pointer-events: none;
  transition: all .28s ease;
  white-space: nowrap;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- 商品图占位 ---------- */
.ph-img {
  width: 100%; height: 100%;
  object-fit: contain;
  display: block;
}
.ph-box {
  background: var(--fill);
  border-radius: var(--r-md);
  overflow: hidden;
  display: flex; align-items: center; justify-content: center;
}

/* 搭配整图覆盖层（放了真图就盖住拼贴，没图自动移除） */
.ocover {
  position: absolute; inset: 0; z-index: 1;
  width: 100%; height: 100%;
  object-fit: cover;
  border-radius: var(--r-md);
  background: #fff;
  visibility: hidden;   /* 加载成功才显示（onload），避免白底挡住拼贴 */
  pointer-events: none; /* 整图只做展示：不挡下层单品点击（详情页替换入口在整图之下） */
}

/* ---------- AI 拆图进度卡（衣橱网格 / 试穿抽屉共用） ---------- */
.split-prog {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 7px; padding: 8px; text-align: center;
}
.split-prog .spname {
  font-size: 12px; font-weight: 700; color: var(--ink-2);
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.split-prog .sppct { font-size: 15px; font-weight: 800; font-variant-numeric: tabular-nums; color: var(--ink); }   /* 固定墨色：试穿抽屉深色主题下不被继承成白色 */
.split-prog .spbar { width: 78%; height: 4px; border-radius: 2px; background: var(--fill-2); overflow: hidden; }
.split-prog .spbar i {
  display: block; height: 100%; width: 0%;
  border-radius: 2px; background: var(--grad);   /* AI 能力专属渐变 */
  transition: width .3s linear;
}
.split-prog .spretry {
  border: none; background: var(--ink); color: #fff;
  border-radius: 999px; padding: 6px 14px;
  font-size: 12px; font-weight: 600; cursor: pointer;
}
.split-prog .spfail { font-size: 12px; color: var(--danger); font-weight: 600; }

/* ---------- 通用工具 ---------- */
.px { padding-left: var(--pad); padding-right: var(--pad); }
.grow { flex: 1; }
.row { display: flex; align-items: center; gap: 12px; }
.scroll-body {
  flex: 1; min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
.hidden { display: none !important; }

/* 页面载入编排动画 */
@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}
.rise { animation: rise .5s cubic-bezier(.2,.7,.3,1) both; }
.d1 { animation-delay: .05s; } .d2 { animation-delay: .12s; }
.d3 { animation-delay: .19s; } .d4 { animation-delay: .26s; }
.d5 { animation-delay: .33s; }

/* ---------- 表单 ---------- */
.field {
  display: flex; align-items: center; gap: 10px;
  background: var(--card);
  border: 1.5px solid var(--line);
  border-radius: var(--r-md);
  padding: 16px 18px;
}
.field input {
  flex: 1; border: none; outline: none; background: none;
  font-size: 17px; font-family: var(--font-body); color: var(--ink);  /* iOS Body 17pt */
}
.field input::placeholder { color: var(--muted); }
.field .field-act { border: none; background: none; font-size: 14.5px; font-weight: 700; color: var(--ink); cursor: pointer; white-space: nowrap; }
.field .field-act:disabled { color: var(--muted); }

.agree { display: flex; gap: 8px; font-size: 13px; color: var(--muted); line-height: 1.7; align-items: flex-start; }
.agree a { color: var(--ink); font-weight: 600; text-decoration: none; }
.checkbox {
  flex: none; width: 19px; height: 19px; margin-top: 3px;
  border-radius: 50%; border: 1.5px solid #cfcfcc;
  appearance: none; -webkit-appearance: none; cursor: pointer;
  display: inline-grid; place-content: center;
  transition: all .15s ease;
}
.checkbox:checked { background: var(--ink); border-color: var(--ink); }
.checkbox:checked::after { content: "✓"; color: #fff; font-size: 11px; font-weight: 900; }

/* 进度条（引导流程） */
.progress { display: flex; gap: 6px; width: 90px; }
.progress i { flex: 1; height: 4px; border-radius: 2px; background: var(--fill-2); }
.progress i.on { background: var(--ink); }
