/* ============================================================
   GuardCart — Editorial Calm
   规范令牌（第 2、3 节）原样落地，然后才是组件。
   ============================================================ */

:root {
  --bg:#f7f5f2;
  --surface:#ffffff;
  --surface-muted:#f0eeea;
  --text:#171416;
  --text-secondary:#6b6b6b;
  --text-tertiary:#8a8a8a;
  --border:rgba(0,0,0,.08);
  --ink:#171416;
  --accent:#5b4cf5;
  --brand:#f28c28;
  --success:#2e9e6b; --warning:#e5a400; --error:#d64545;
  --success-tint:#e9f5ef; --warning-tint:#faf2d9; --error-tint:#f9e9e9;
  --radius-card:18px; --radius-field:12px; --radius-pill:999px;
  --ease:cubic-bezier(0.22,1,0.36,1);
}
[data-theme="dark"] {
  --bg:#0b0b0c; --surface:#151516; --surface-muted:#1d1d1f;
  --text:#f2f2f2; --text-secondary:#9a9a9a; --text-tertiary:#7a7a7a;
  --border:rgba(255,255,255,.1);
  --ink:#f2f2f2; --accent:#8b7dff; --brand:#ffa64d;
  --success:#4cc48c; --warning:#f0bb33; --error:#ef6b6b;
  --success-tint:rgba(76,196,140,.13); --warning-tint:rgba(240,187,51,.13); --error-tint:rgba(239,107,107,.13);
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: Inter, "Noto Sans SC", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  font-size: clamp(15px, 0.35vw + 12px, 16.5px);
  line-height: 1.6;
  transition: background-color .35s var(--ease), color .35s var(--ease);
}

body, button, input { font-variant-numeric: tabular-nums; }

h1, h2, h3 { letter-spacing: -0.02em; }

a { color: inherit; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

.wrap {
  max-width: 1120px;
  margin: 0 auto;
  padding-left: 32px;
  padding-right: 32px;
}

/* ---------------- 顶栏 ---------------- */
.topbar {
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 50;
}
.topbar-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 14px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: 17px;
  letter-spacing: -0.02em;
  cursor: pointer;
  background: none;
  border: none;
  color: var(--text);
  font-family: inherit;
}
.brand svg { display: block; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.avatar-chip {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ---------------- 按钮 ---------------- */
.btn {
  appearance: none;
  font: inherit;
  font-weight: 600;
  font-size: 15px;
  height: 44px;
  padding: 0 24px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background-color .15s var(--ease), color .15s var(--ease),
              border-color .15s var(--ease), transform .15s var(--ease);
}
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--ink); color: var(--bg); border: 1px solid var(--ink); }
.btn-primary:hover { opacity: .88; }
.btn-ghost { background: transparent; color: var(--text); border: 1px solid var(--border); }
.btn-ghost:hover { border-color: var(--text); }
.btn-sm { height: 38px; padding: 0 18px; font-size: 13px; }

/* ---------------- 状态标签 ---------------- */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 26px;
  padding: 0 12px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 600;
  background: var(--surface-muted);
  color: var(--text-secondary);
}
.tag::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.tag-accent { color: var(--accent); background: transparent; border: 1px solid var(--border); }
.tag-success { color: var(--success); background: var(--success-tint); }
.tag-warning { color: var(--warning); background: var(--warning-tint); }
.tag-error { color: var(--error); background: var(--error-tint); }

/* ---------------- 步骤条 ---------------- */
.stepper {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 24px 0;
}
.stepper li {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  height: 36px;
  padding: 0 16px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: background-color .3s var(--ease), color .3s var(--ease), border-color .3s var(--ease);
}
.stepper li .n { font-variant-numeric: tabular-nums; }
.stepper li.done { color: var(--text); }
.stepper li.current {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

/* ---------------- 页面切换（整页一次） ---------------- */
.screen { display: none; }
.screen.active { display: block; animation: pageIn .3s var(--ease) 1; }
@keyframes pageIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------------- 首屏 ---------------- */
.hero { padding: clamp(72px, 6vw, 104px) 0 40px; max-width: 760px; }
.hero-title {
  font-size: clamp(40px, 5.2vw, 66px);
  font-weight: 600;
  line-height: 1.05;
  margin-bottom: 20px;
}
.hero-title .dim { color: var(--text-tertiary); }
.hero-title .accent { color: var(--accent); }
.hero-title .w { display: inline-block; }
body.motion-ok .hero-title .w { animation: wordIn .5s var(--ease) both; }
body.motion-ok .hero-title .w:nth-child(1) { animation-delay: 0ms; }
body.motion-ok .hero-title .w:nth-child(2) { animation-delay: 60ms; }
body.motion-ok .hero-title .w:nth-child(3) { animation-delay: 120ms; }
body.motion-ok .hero-title .w:nth-child(4) { animation-delay: 180ms; }
body.motion-ok .hero-title .w:nth-child(5) { animation-delay: 240ms; }
body.motion-ok .hero-title .w:nth-child(6) { animation-delay: 300ms; }
body.motion-ok .hero-title .w:nth-child(7) { animation-delay: 360ms; }
@keyframes wordIn {
  from { opacity: 0; filter: blur(8px); }
  to { opacity: 1; filter: blur(0); }
}
.hero-sub {
  font-size: 15px;
  color: var(--text-secondary);
  max-width: 560px;
}

/* ---------------- 卡片 ---------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: clamp(28px, 2.3vw, 38px);
}
.card + .card { margin-top: 16px; }
.card-title { font-size: clamp(20px, 1.2vw, 22px); font-weight: 600; margin-bottom: 4px; }
.card-sub { font-size: 13px; color: var(--text-secondary); }

/* ---------------- 表单 ---------------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 13px; color: var(--text-secondary); }
.input {
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-field);
  height: 48px;
  padding: 0 16px;
  width: 100%;
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
.input:focus {
  outline: none;
  border-color: var(--text);
  box-shadow: 0 0 0 3px rgba(91, 76, 245, .15);
}
[data-theme="dark"] .input:focus { box-shadow: 0 0 0 3px rgba(139, 125, 255, .18); }
.input-lg { height: 56px; font-size: 17px; }
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}
.ask-row { display: flex; gap: 12px; align-items: stretch; }
.ask-row .input { flex: 1; }
.form-error {
  margin-top: 14px;
  border: 1px solid var(--error);
  border-radius: var(--radius-field);
  padding: 12px 16px;
  font-size: 13px;
  color: var(--error);
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
.form-error ul { padding-left: 18px; }

/* 开关 */
.switch { display: flex; align-items: center; gap: 12px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .track {
  width: 44px; height: 26px; border-radius: 999px;
  background: var(--surface-muted);
  border: 1px solid var(--border);
  position: relative; flex-shrink: 0;
  transition: background-color .2s var(--ease), border-color .2s var(--ease);
}
.switch .track::after {
  content: "";
  position: absolute; top: 2px; left: 2px;
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border);
  transition: transform .2s var(--ease);
}
.switch input:checked + .track { background: var(--ink); border-color: var(--ink); }
.switch input:checked + .track::after { transform: translateX(18px); }
.switch input:focus-visible + .track { outline: 2px solid var(--accent); outline-offset: 2px; }
.switch .txt { font-size: 15px; }
.switch .txt small { display: block; font-size: 13px; color: var(--text-secondary); }

.hr { border: none; border-top: 1px solid var(--border); margin: 20px 0; }
.mandate-summary { font-size: 13px; color: var(--text-secondary); display: flex; flex-wrap: wrap; gap: 8px 20px; }
.mandate-summary strong { color: var(--text); font-weight: 600; }

/* ---------------- Agent 进度 ---------------- */
.agent-list { list-style: none; }
.agent-list li {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
  font-weight: 500;
}
.agent-list li:last-child { border-bottom: none; }
.agent-list .ic {
  width: 36px; height: 36px;
  border-radius: 10px;
  border: 1px solid var(--border);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
  transition: border-color .3s var(--ease), color .3s var(--ease);
}
.agent-list li.running { color: var(--text); }
.agent-list li.running .ic { border-color: var(--accent); color: var(--accent); }
.agent-list li.finished { color: var(--text); }
.agent-list li.finished .ic { border-color: var(--success); color: var(--success); }
.agent-list .state { margin-left: auto; font-size: 13px; }

/* ---------------- 商品比较 ---------------- */
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}
.section-title { font-size: clamp(28px, 3.2vw, 46px); font-weight: 600; line-height: 1.12; }
.section-sub { font-size: 15px; color: var(--text-secondary); max-width: 560px; }
.product-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(16px, 1.3vw, 24px);
}
.product-card { display: flex; flex-direction: column; gap: 0; position: relative; }
.product-card.recommended { border-color: var(--text); }
.product-card .p-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; margin-bottom: 2px; }
.product-card h3 { font-size: clamp(20px, 1.25vw, 24px); font-weight: 600; }
.product-card .p-id { font-size: 12px; color: var(--text-secondary); }
.product-card .p-desc { font-size: 13px; color: var(--text-secondary); margin: 6px 0 14px; }
.product-card .p-merchant { display: flex; justify-content: space-between; align-items: center; font-size: 13px; margin-bottom: 14px; }
.price-rows { border-top: 1px solid var(--border); padding-top: 12px; margin-top: auto; }
.price-row { display: flex; justify-content: space-between; font-size: 13px; color: var(--text-secondary); padding: 3px 0; }
.price-row strong { color: var(--text); font-weight: 600; }
.price-total {
  border-top: 1px solid var(--border);
  margin-top: 10px; padding-top: 12px;
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 15px; font-weight: 600;
}
.price-total .num { font-size: clamp(32px, 2.1vw, 42px); font-weight: 600; letter-spacing: -0.02em; }
.product-card.recommended .price-total .num { color: var(--accent); }
.reco-reason {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-secondary);
}

/* ---------------- 策略检查 ---------------- */
.zone-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(16px, 1.3vw, 24px);
  margin-bottom: 16px;
}
.zone { padding: 20px; }
.zone h3 { font-size: 13px; font-weight: 600; color: var(--text-secondary); margin-bottom: 8px; }
.zone p { font-size: 15px; }
.zone p strong { font-weight: 600; }
.check-list { list-style: none; }
.check-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.check-item:last-child { border-bottom: none; }
.check-item .ci {
  width: 28px; height: 28px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px; flex-shrink: 0;
  border: 1px solid var(--border);
}
.check-item.pass .ci { color: var(--success); border-color: var(--success); }
.check-item.fail .ci { color: var(--error); border-color: var(--error); }
.check-item.ask  .ci { color: var(--warning); border-color: var(--warning); }
.check-item .cn { font-weight: 600; font-size: 15px; }
.check-item .cd { font-size: 13px; color: var(--text-secondary); }
.check-item .cr { margin-left: auto; font-size: 13px; font-weight: 600; }
.check-item.pass .cr { color: var(--success); }
.check-item.fail .cr { color: var(--error); }
.check-item.ask  .cr { color: var(--warning); }

/* ---------------- 决策结果 ---------------- */
.decision {
  display: flex;
  gap: 24px;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  background: var(--surface);
  padding: clamp(32px, 2.6vw, 44px);
  margin-bottom: 16px;
}
.decision .mascot { flex-shrink: 0; }
.decision-approve { background: var(--success-tint); border-color: var(--success); }
.decision-ask { background: var(--warning-tint); border-color: var(--warning); }
.decision-block { background: var(--error-tint); border-color: var(--error); }
.decision .d-main { flex: 1; min-width: 0; }
.decision .d-title { font-size: clamp(28px, 3.2vw, 44px); font-weight: 600; line-height: 1.12; margin: 10px 0 6px; }
.decision .d-sub { font-size: 15px; color: var(--text-secondary); max-width: 520px; }
.decision .d-note {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-secondary);
}
.decision .d-num { text-align: right; flex-shrink: 0; }
.decision .d-num .big { font-size: clamp(40px, 5vw, 68px); font-weight: 600; letter-spacing: -0.02em; line-height: 1; }
.decision .d-num .cap { font-size: 13px; color: var(--text-secondary); margin-top: 6px; }
.decision-actions { display: flex; gap: 10px; margin-top: 18px; flex-wrap: wrap; }

/* 统计容器：多个数字一个大容器，1px 竖线分隔 */
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  background: var(--surface);
  margin-bottom: 16px;
  overflow: hidden;
}
.stat { padding: 20px 24px; border-left: 1px solid var(--border); }
.stat:first-child { border-left: none; }
.stat .v { font-size: clamp(32px, 2.1vw, 40px); font-weight: 600; letter-spacing: -0.02em; line-height: 1.1; }
.stat .k { font-size: 13px; color: var(--text-secondary); margin-top: 4px; }

/* 支付选项：行选中 = 2px 竖线 + muted 底 */
.pay-list { display: flex; flex-direction: column; }
.pay-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-left: 2px solid transparent;
  border-bottom: 1px solid var(--border);
  font-size: 15px;
}
.pay-row:last-child { border-bottom: none; }
.pay-row.best { border-left-color: var(--ink); background: var(--surface-muted); }
.pay-row .pn { font-weight: 600; }
.pay-row .pm { font-size: 13px; color: var(--text-secondary); }
.pay-row .pc { font-weight: 600; font-size: 17px; }
.pay-note { font-size: 13px; color: var(--text-secondary); margin-top: 14px; display: flex; align-items: center; gap: 8px; }
.dot-brand { width: 6px; height: 6px; border-radius: 50%; background: var(--brand); display: inline-block; flex-shrink: 0; }
.dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.dot-success { background: var(--success); }
.dot-warning { background: var(--warning); }
.dot-error { background: var(--error); }

/* ---------------- 审计时间线 ---------------- */
.timeline { position: relative; padding-left: 24px; }
.timeline::before {
  content: "";
  position: absolute;
  left: 5px; top: 8px; bottom: 8px;
  width: 1px;
  background: var(--border);
}
.tl-item { position: relative; padding: 10px 0; }
.tl-item::before {
  content: "";
  position: absolute;
  left: -23px; top: 18px;
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--bg);
  border: 1px solid var(--text-secondary);
}
.tl-item.ok::before { border-color: var(--success); background: var(--success); }
.tl-item.no::before { border-color: var(--error); background: var(--error); }
.tl-item.maybe::before { border-color: var(--warning); background: var(--warning); }
.tl-time { font-size: 12px; color: var(--text-secondary); }
.tl-event { font-size: 15px; font-weight: 600; }
.tl-result { font-size: 13px; color: var(--text-secondary); }
.empty-state { text-align: center; padding: 40px 0 28px; }
.empty-state p { font-size: 15px; color: var(--text-secondary); margin-top: 16px; }

/* ---------------- 演示控制条 ---------------- */
.demo-bar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  background: var(--bg);
  border-top: 1px solid var(--border);
  z-index: 60;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.demo-inner {
  position: relative;
  max-width: 1120px;
  margin: 0 auto;
  padding: 12px 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}
.demo-label { font-size: 13px; color: var(--text-secondary); margin-right: 4px; }
main { padding-bottom: 120px; }

/* ---------------- 区块间距 ---------------- */
.screen > .mb { margin-bottom: 16px; }
.actions-end { display: flex; justify-content: flex-end; margin-top: 16px; gap: 10px; }
.actions-between { display: flex; justify-content: space-between; margin-top: 16px; gap: 10px; flex-wrap: wrap; }

/* ---------------- 响应式 ---------------- */
@media (max-width: 900px) {
  .product-grid { grid-template-columns: 1fr; }
  .zone-grid { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .stat:nth-child(3) { border-left: none; }
  .stat:nth-child(3), .stat:nth-child(4) { border-top: 1px solid var(--border); }
  .decision { flex-direction: column; align-items: flex-start; }
  .decision .d-num { text-align: left; }
}
/* ---------------- 手机自适应 ---------------- */
@media (max-width: 600px) {
  html, body { overflow-x: hidden; }
  .wrap { padding-left: 16px; padding-right: 16px; }

  /* 顶栏：收窄间距，隐藏次要元素，保证品牌 / 数据标签 / 主题切换不换行 */
  .topbar-inner { padding: 10px 16px; gap: 10px; }
  .brand { font-size: 16px; gap: 8px; }
  .topbar-right { gap: 8px; }
  .tag-hide-sm, .avatar-hide-sm { display: none; }
  .tag { height: 24px; padding: 0 10px; font-size: 11px; gap: 5px; }
  #theme-toggle { height: 34px; padding: 0 12px; font-size: 12px; }

  /* 步骤条：单行横向滑动，不挤占纵向空间 */
  .stepper {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    margin: 0 -16px;
    padding: 14px 16px 10px;
    gap: 7px;
  }
  .stepper::-webkit-scrollbar { display: none; }
  .stepper li { flex-shrink: 0; height: 32px; padding: 0 12px; font-size: 12px; gap: 6px; }

  /* 首屏 */
  .hero { padding: 36px 0 24px; }
  .hero-title { font-size: clamp(30px, 8.5vw, 38px); }
  .hero-sub { font-size: 14px; }

  /* 卡片与表单：输入框 16px 防止 iOS Safari 聚焦自动放大 */
  .card { padding: 18px; }
  .card-title { font-size: 18px; }
  .form-grid { grid-template-columns: 1fr; }
  .input { font-size: 16px; }
  .input-lg { height: 52px; }
  .ask-row { flex-direction: column; }
  .ask-row .btn { width: 100%; }
  .mandate-summary { flex-direction: column; gap: 6px; }

  /* 各区块标题与主按钮：按钮整行，拇指热区 */
  .section-head { margin-bottom: 18px; }
  .section-title { font-size: clamp(24px, 7vw, 30px); }
  .section-sub { font-size: 14px; }
  .section-head .btn { width: 100%; }
  .actions-end { flex-direction: column; align-items: stretch; }
  .actions-end .btn,
  .actions-between .btn { width: 100%; }
  .actions-between { flex-direction: column; }

  /* 策略三栏已在 900 变单栏，这里收窄内边距 */
  .zone { padding: 16px; }
  .zone p { font-size: 14px; }
  .check-item { flex-wrap: wrap; row-gap: 2px; padding: 12px 0; }
  .check-item .cn, .check-item .cd { font-size: 14px; }
  .check-item .cr { margin-left: auto; }

  /* 商品卡 */
  .product-card h3 { font-size: 18px; }
  .price-total .num { font-size: 28px; }

  /* 决策横幅与数字统计 */
  .decision { padding: 20px 18px; gap: 16px; }
  .decision .d-title { font-size: clamp(24px, 7vw, 30px); }
  .decision .d-sub { font-size: 14px; }
  .decision .d-num .big { font-size: clamp(34px, 9.5vw, 40px); }
  .decision-actions .btn { width: 100%; }
  .stat { padding: 14px 16px; }
  .stat .v { font-size: 24px; }
  .stat .k { font-size: 12px; }

  /* 支付行允许折行，费用不被挤压 */
  .pay-row { flex-wrap: wrap; row-gap: 2px; padding: 13px 12px; }
  .pay-row .pc { margin-left: auto; }

  /* 底部演示条：单行横向滑动 + 状态文字浮在条上方 */
  .demo-inner {
    flex-wrap: nowrap;
    justify-content: flex-start;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding: 10px 16px;
    gap: 8px;
  }
  .demo-inner::-webkit-scrollbar { display: none; }
  .demo-inner .btn-sm { flex: 0 0 auto; height: 40px; padding: 0 14px; }
  .demo-label { display: none; }
  /* 状态条用 fixed：demo-inner 的 overflow:auto 会裁掉绝对定位子元素 */
  .live-status {
    position: fixed;
    left: 0; right: 0;
    bottom: calc(60px + env(safe-area-inset-bottom, 0px));
    max-width: none;
    padding: 8px 16px;
    border-top: 1px solid var(--border);
    background: var(--bg);
    font-size: 12px;
    z-index: 61;
  }
  main { padding-bottom: calc(66px + env(safe-area-inset-bottom, 0px)); }
}

@media (max-width: 380px) {
  .wrap { padding-left: 12px; padding-right: 12px; }
  .topbar-inner { padding-left: 12px; padding-right: 12px; }
  .stepper { margin-left: -12px; margin-right: -12px; padding-left: 12px; padding-right: 12px; }
  .card { padding: 16px; }
  .hero-title { font-size: clamp(27px, 8vw, 32px); }
  .stat { padding: 12px; }
  .stat .v { font-size: 21px; }
  .demo-inner { padding-left: 12px; padding-right: 12px; }
  .demo-inner .btn-sm { padding: 0 12px; font-size: 12px; }
  .live-status { padding-left: 12px; padding-right: 12px; }
}

/* ---------------- 桌面端左侧导航（≥860px：AI 工具式固定侧栏） ---------------- */
@media (min-width: 860px) {
  :root { --sidebar-w: clamp(232px, 15.5vw, 264px); }
  .demo-bar {
    top: 0; bottom: 0; left: 0; right: auto;
    width: var(--sidebar-w);
    border-top: none;
    border-right: 1px solid var(--border);
    padding-bottom: 0;
  }
  .demo-inner {
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    flex-wrap: nowrap;
    height: 100%;
    padding: 22px 16px;
    gap: 8px;
  }
  .demo-label {
    display: block;
    margin: 0 10px 10px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .1em;
    text-transform: uppercase;
  }
  .demo-inner .btn-sm { justify-content: flex-start; height: 42px; padding: 0 14px; font-size: 14px; }
  /* Reset 沉到侧栏底部，live 状态作为其下方的说明行 */
  .demo-inner .btn:last-of-type { margin-top: auto; }
  .live-status {
    position: static;
    max-width: none;
    padding: 8px 10px 0;
    font-size: 12px;
    text-align: left;
  }
  /* 放开写死的 1120px 内容上限，随屏宽流式填充（留出舒服的页边距）；
     超宽屏（≥2K）加 1720px 上限，避免表单/卡片被过度拉长 */
  .topbar { margin-left: var(--sidebar-w); }
  .topbar-inner {
    max-width: 1720px;
    padding-left: clamp(32px, 3.4vw, 88px);
    padding-right: clamp(32px, 3.4vw, 88px);
  }
  .wrap {
    margin-left: var(--sidebar-w);
    max-width: 1720px;
    padding-left: clamp(32px, 3.4vw, 88px);
    padding-right: clamp(32px, 3.4vw, 88px);
  }
  main { padding-bottom: 56px; }
}

/* ---------------- 减少动态效果 ---------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0s !important;
    animation-delay: 0s !important;
    transition-duration: 0s !important;
  }
}

/* ---------------- 数据源标签 / Live API ---------------- */
.tag-live { color: var(--accent); background: rgba(91, 76, 245, 0.10); }
[data-theme="dark"] .tag-live { background: rgba(139, 125, 255, 0.16); }
.tag-muted { color: var(--text-tertiary); }
.dot-live { background: var(--accent); }
.motion-ok .dot-pulse { animation: dot-live-pulse 1.1s var(--ease) infinite; }
@keyframes dot-live-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}
.live-status {
  font-size: 13px;
  color: var(--text-secondary);
  max-width: 460px;
  text-align: left;
}
.live-status:empty { display: none; }
.live-status.is-ok { color: var(--success); }
.live-status.is-error { color: var(--error); }
.product-card.disqualified { opacity: 0.62; }
.product-card .price-total-na .num { color: var(--text-tertiary); }
