:root {
  --bg: #f4f5f7;
  --card: #ffffff;
  --ink: #101828;
  --ink2: #475467;
  --ink3: #8a94a6;
  --line: #e6e8ec;
  --accent: #2563eb;
  --accent-soft: #e8efff;
  --ok: #0f9d76;
  --warn: #d97706;
  --bad: #dc2626;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 4px 16px rgba(16, 24, 40, .06);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1015;
    --card: #171b22;
    --ink: #e9ecf1;
    --ink2: #b6bdc9;
    --ink3: #7d8796;
    --line: #262c36;
    --accent: #6ea0ff;
    --accent-soft: #1b2436;
    --ok: #3ddc97;
    --warn: #fbbf24;
    --bad: #f87171;
    --shadow: 0 1px 2px rgba(0, 0, 0, .5);
  }
}

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

html, body { margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.55 -apple-system, BlinkMacSystemFont, "SF Pro SC", "PingFang SC", "Helvetica Neue", sans-serif;
  padding-bottom: calc(96px + var(--safe-bottom));
  -webkit-text-size-adjust: 100%;
}

.app { max-width: 560px; margin: 0 auto; padding: 0 14px; }

/* 顶部 */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in oklab, var(--bg) 88%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: calc(8px + var(--safe-top)) 14px 8px;
  margin: 0 -14px;
  border-bottom: 1px solid var(--line);
}
.topbar-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; max-width: 560px; margin: 0 auto; }
.brand { display: flex; align-items: center; gap: 8px; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 9px;
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  display: grid; place-items: center; color: #fff; flex: none;
}
.brand-mark svg { width: 17px; height: 17px; }
.brand-title { font-size: 15px; font-weight: 700; letter-spacing: .2px; }
.brand-sub { font-size: 10.5px; color: var(--ink3); }

.link-btn {
  border: 0; background: transparent; color: var(--accent);
  font-size: 12.5px; padding: 6px 4px; font-weight: 500;
}

/* 步骤条 */
.steps { display: flex; gap: 6px; margin: 12px 0 14px; }
.step {
  flex: 1; display: flex; align-items: center; gap: 6px;
  font-size: 11.5px; color: var(--ink3);
}
.step i {
  width: 18px; height: 18px; border-radius: 50%; flex: none;
  background: var(--line); color: var(--ink3);
  display: grid; place-items: center; font-size: 10px; font-style: normal; font-weight: 700;
}
.step.active { color: var(--accent); font-weight: 600; }
.step.active i { background: var(--accent); color: #fff; }
.step.done i { background: var(--ok); color: #fff; }

/* 卡片 */
.card {
  background: var(--card); border-radius: var(--radius);
  padding: 16px; margin-bottom: 12px;
  box-shadow: var(--shadow);
}
.card-h { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.card-title { font-size: 13.5px; font-weight: 700; }
.card-sub { font-size: 11.5px; color: var(--ink3); font-weight: 400; }

/* 拍照区 */
.shoot {
  border: 2px dashed color-mix(in oklab, var(--accent) 40%, var(--line));
  border-radius: var(--radius);
  background: var(--accent-soft);
  padding: 30px 16px; text-align: center;
  display: block; width: 100%;
  color: var(--accent);
}
.shoot:active { transform: scale(.99); }
.shoot svg { width: 36px; height: 36px; margin-bottom: 8px; }
.shoot b { display: block; font-size: 16px; margin-bottom: 2px; }
.shoot span { font-size: 12px; color: var(--ink2); }

.photo-wrap { position: relative; border-radius: var(--radius); overflow: hidden; background: #000; }
.photo-wrap img { width: 100%; display: block; }
.photo-badge {
  position: absolute; left: 10px; top: 10px;
  background: rgba(0, 0, 0, .62); color: #fff;
  font-size: 11.5px; padding: 4px 9px; border-radius: 20px;
  backdrop-filter: blur(6px);
}
.photo-actions { position: absolute; right: 10px; top: 10px; display: flex; gap: 6px; }
.photo-actions button {
  width: 34px; height: 34px; border-radius: 50%; border: 0;
  background: rgba(0, 0, 0, .55); color: #fff; font-size: 15px;
  display: grid; place-items: center;
}

/* 质量条 */
.quality { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.q-bar { flex: 1; height: 7px; border-radius: 4px; background: var(--line); overflow: hidden; }
.q-bar i { display: block; height: 100%; border-radius: 4px; }
.q-score { font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; }

/* 表单 */
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 11.5px; color: var(--ink3); margin-bottom: 5px; }
.field .hint { font-size: 10.5px; color: var(--ink3); margin-top: 4px; }
input[type="text"], input[type="number"], select, textarea {
  width: 100%; border: 1px solid var(--line); background: var(--bg); color: var(--ink);
  border-radius: 11px; padding: 11px 12px; font-size: 16px; /* 16px 防 iOS 缩放 */
  outline: none; -webkit-appearance: none; appearance: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
select {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'><path d='M2 4l4 4 4-4' fill='none' stroke='%238a94a6' stroke-width='1.6'/></svg>");
  background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px;
}
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.seg { display: flex; background: var(--bg); border-radius: 11px; padding: 3px; gap: 3px; border: 1px solid var(--line); }
.seg button {
  flex: 1; border: 0; background: transparent; color: var(--ink2);
  padding: 8px 4px; border-radius: 9px; font-size: 12.5px;
}
.seg button[aria-pressed="true"] { background: var(--card); color: var(--ink); font-weight: 600; box-shadow: 0 1px 3px rgba(0,0,0,.08); }

/* 价格英雄卡 */
.hero {
  background: linear-gradient(160deg, #1d4ed8, #2563eb 55%, #3b82f6);
  color: #fff; border-radius: var(--radius); padding: 18px 16px;
  box-shadow: 0 8px 24px rgba(37, 99, 235, .28);
  position: relative; overflow: hidden;
}
.hero::after {
  content: ''; position: absolute; right: -40px; top: -40px;
  width: 160px; height: 160px; border-radius: 50%;
  background: rgba(255, 255, 255, .09);
}
.hero .k { font-size: 11.5px; opacity: .85; }
.hero .v { font-size: 40px; font-weight: 800; letter-spacing: -1px; line-height: 1.1; margin: 2px 0; font-variant-numeric: tabular-nums; }
.hero .sub { font-size: 12px; opacity: .9; }
.hero .row { display: flex; gap: 14px; margin-top: 12px; }
.hero .stat .k { font-size: 10.5px; opacity: .8; }
.hero .stat .v { font-size: 16px; font-weight: 700; margin: 0; }

/* 三档价 */
.tier {
  display: flex; align-items: center; gap: 12px;
  padding: 12px; border-radius: 13px; border: 1px solid var(--line);
  margin-bottom: 8px; background: var(--card);
}
.tier.hl { border-color: var(--accent); background: var(--accent-soft); }
.tier .name { font-size: 12.5px; font-weight: 700; }
.tier .note { font-size: 10.5px; color: var(--ink3); margin-top: 2px; }
.tier .price { font-size: 21px; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -.5px; }
.tier .meta { font-size: 10.5px; color: var(--ink2); margin-top: 2px; }
.tier .right { text-align: right; min-width: 96px; }

/* 价格带 */
.band { display: grid; grid-template-columns: 62px 1fr 46px; gap: 8px; align-items: center; font-size: 11px; margin: 5px 0; }
.band .lab { color: var(--ink3); }
.band .bars { display: flex; flex-direction: column; gap: 2px; }
.band .b { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; }
.band .b i { display: block; height: 100%; }
.band .v { text-align: right; color: var(--ink2); font-variant-numeric: tabular-nums; }
.legend { display: flex; gap: 14px; font-size: 10.5px; color: var(--ink3); margin-top: 8px; }
.legend i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 4px; }

/* 列表 */
.li { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.li:last-child { border-bottom: 0; }
.li .n {
  flex: none; width: 20px; height: 20px; border-radius: 6px;
  background: var(--accent-soft); color: var(--accent);
  font-size: 10.5px; font-weight: 700; display: grid; place-items: center; margin-top: 2px;
}
.li .t { font-size: 12.5px; font-weight: 600; }
.li .d { font-size: 11.5px; color: var(--ink2); margin-top: 2px; }

.pill {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 10.5px; padding: 2px 8px; border-radius: 20px;
  background: var(--accent-soft); color: var(--accent); font-weight: 600;
}
.pill.ok { background: color-mix(in oklab, var(--ok) 14%, transparent); color: var(--ok); }
.pill.warn { background: color-mix(in oklab, var(--warn) 16%, transparent); color: var(--warn); }
.pill.bad { background: color-mix(in oklab, var(--bad) 14%, transparent); color: var(--bad); }

.note {
  font-size: 11.5px; color: var(--ink2); line-height: 1.55;
  background: var(--bg); border-radius: 11px; padding: 10px 11px; margin-top: 8px;
}
.note.warn { background: color-mix(in oklab, var(--warn) 10%, var(--bg)); color: color-mix(in oklab, var(--warn) 70%, var(--ink)); }
.note.bad { background: color-mix(in oklab, var(--bad) 9%, var(--bg)); color: color-mix(in oklab, var(--bad) 75%, var(--ink)); }

/* 底部操作栏 */
.bottombar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  padding: 10px 14px calc(10px + var(--safe-bottom));
  background: color-mix(in oklab, var(--bg) 92%, transparent);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
}
.bottombar .inner { max-width: 560px; margin: 0 auto; display: flex; gap: 8px; }
.btn {
  flex: 1; border: 0; border-radius: 13px; padding: 14px;
  font-size: 15px; font-weight: 700;
  background: var(--line); color: var(--ink);
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.btn-primary { background: var(--accent); color: #fff; box-shadow: 0 6px 18px rgba(37,99,235,.3); }
.btn-primary:active { transform: translateY(1px); }
.btn-ghost { background: transparent; color: var(--ink2); border: 1px solid var(--line); flex: 0 0 auto; padding: 14px 16px; }
.btn:disabled { opacity: .5; }

/* 图表 */
.chart { width: 100%; }
.chart svg { display: block; width: 100%; height: auto; }

/* 弹层 */
.sheet-mask {
  position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 50;
  display: flex; align-items: flex-end;
}
.sheet {
  width: 100%; max-height: 86vh; overflow-y: auto;
  background: var(--card); border-radius: 20px 20px 0 0;
  padding: 18px 16px calc(24px + var(--safe-bottom));
  animation: up .22s ease-out;
}
@keyframes up { from { transform: translateY(30%); opacity: .6; } }
.sheet h3 { margin: 0 0 12px; font-size: 16px; }
.sheet .close { position: absolute; right: 14px; top: 14px; }

.hidden { display: none !important; }
.muted { color: var(--ink3); }
.small { font-size: 11.5px; }
.tiny { font-size: 10.5px; }
.num { font-variant-numeric: tabular-nums; }
