/* ============================================================
   BuildLab — 设计系统
   规矩落地：
   1) 边框只套一层       —— 全局只有 --line 这一层描边，嵌套层级靠背景色差
   2) 圆角内外同心       —— --r-o 外层，内层恒为 calc(var(--r-o) - var(--pad))
   3) 分屏防翻车         —— 全用 minmax/auto-fill/clamp，无固定宽度
   4) 打中文不误发       —— 见 ui.js safeEnter
   5) 翻记录不被拽       —— 滚动容器独立 + overscroll-behavior: contain
   ============================================================ */

:root {
  --bg: #f4f6f9;
  --surface: #ffffff;
  --surface-2: #f7f9fc;
  --ink: #12151c;
  --ink-2: #596272;
  --ink-3: #8c95a5;
  --line: #e6e9f0;
  --line-soft: #eef1f6;

  --brand: #242830;
  --brand-ink: #111318;
  --brand-soft: #f0f1f4;
  --ok: #0f9d58;
  --ok-soft: #e8f6ee;
  --warn: #d98300;
  --warn-soft: #fff5e5;
  --bad: #e5484d;
  --bad-soft: #fdecec;

  /* 同心圆角 */
  --r-o: 26px;
  --pad: 8px;
  --r-i: calc(var(--r-o) - var(--pad));

  --sh-1: 0 1px 2px rgba(16, 24, 40, .04), 0 10px 26px -16px rgba(16, 24, 40, .18);
  --sh-2: 0 2px 6px rgba(16, 24, 40, .05), 0 22px 48px -20px rgba(16, 24, 40, .28);
  --sh-3: 0 30px 80px -28px rgba(16, 24, 40, .42);

  --ease-elastic: cubic-bezier(.34, 1.56, .64, 1);
  --ease-fluid: cubic-bezier(.16, 1, .3, 1);
  --ease-out: cubic-bezier(.22, .9, .24, 1);

  --topbar-h: 72px;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

body.is-locked { overscroll-behavior: none; }

button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
input, textarea { font: inherit; color: inherit; }
ul { list-style: none; margin: 0; padding: 0; }
h1, h2, h3 { margin: 0; font-weight: 650; letter-spacing: -.01em; }

/* ================= 顶栏 ================= */
.topbar {
  flex: 0 0 auto;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 20px;
  background: rgba(255, 255, 255, .82);
  backdrop-filter: saturate(1.6) blur(18px);
  -webkit-backdrop-filter: saturate(1.6) blur(18px);
  border-bottom: 1px solid var(--line);
  z-index: 40;
  position: relative;
}

.brand { display: flex; align-items: center; gap: 9px; flex: 0 0 auto; }
.logo {
  width: 30px; height: 30px;
  display: grid; place-items: center;
  border-radius: 10px;
  background: var(--ink);
  color: #fff;
}
.brand-txt { font-weight: 700; font-size: 15.5px; letter-spacing: -.02em; }
.ver {
  font-size: 11px;
  color: var(--ink-3);
  background: var(--surface-2);
  padding: 2px 7px;
  border-radius: 7px;
  font-variant-numeric: tabular-nums;
}

.top-search {
  flex: 1 1 260px;
  min-width: 0;
  max-width: 420px;
  position: relative;
  display: flex;
  align-items: center;
}
.search-icon { position: absolute; left: 12px; color: var(--ink-3); pointer-events: none; }
.top-search input {
  width: 100%;
  height: 38px;
  padding: 0 12px 0 33px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-2);
  outline: none;
  transition: border-color .2s, background .2s, box-shadow .2s;
}
.top-search input:focus {
  background: var(--surface);
  border-color: #c3d3ff;
  box-shadow: 0 0 0 4px rgba(47, 107, 255, .1);
}
.top-search input::placeholder { color: var(--ink-3); }

.top-stats { display: flex; align-items: center; gap: 22px; margin-left: auto; flex: 0 0 auto; }
.stat { display: flex; flex-direction: column; gap: 1px; }
.stat label { font-size: 11px; color: var(--ink-3); letter-spacing: .02em; }
.stat-val { font-size: 15px; font-weight: 650; font-variant-numeric: tabular-nums; line-height: 1.3; }
.stat-val.total {
  display: flex; align-items: baseline; gap: 1px;
  font-size: 21px; letter-spacing: -.02em;
  color: var(--ink);
}
.stat-val.total .cur { font-size: 13px; color: var(--ink-2); font-weight: 600; }
.js-status[data-state="ok"] { color: var(--ok); }
.js-status[data-state="err"] { color: var(--bad); }
.js-status[data-state="idle"] { color: var(--ink-3); }

.top-actions { flex: 0 0 auto; }

.morph-btn {
  display: inline-flex; align-items: center; gap: 7px;
  height: 40px; padding: 0 16px;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  transition: transform .3s var(--ease-elastic), background .2s, box-shadow .25s;
  box-shadow: 0 6px 16px -8px rgba(16, 24, 40, .5);
}
.morph-btn:hover { background: #000; transform: translateY(-1px); }
.morph-btn:active { transform: scale(.96); }

/* ================= 主布局 ================= */
.layout {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 372px;
  gap: 18px;
  padding: 16px 20px 20px;
  max-width: 1640px;
  width: 100%;
  margin: 0 auto;
}

.workspace { display: flex; flex-direction: column; min-width: 0; min-height: 0; gap: 12px; }

/* 分类胶囊 */
.catbar {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 2px 6px;
  scrollbar-width: none;
  overscroll-behavior-x: contain;
  flex: 0 0 auto;
}
.catbar::-webkit-scrollbar { display: none; }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 34px; padding: 0 13px;
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink-2);
  font-size: 12.5px;
  font-weight: 550;
  white-space: nowrap;
  box-shadow: inset 0 0 0 1px var(--line);   /* 单层描边，不用 border */
  transition: background .2s, color .2s, transform .28s var(--ease-elastic), box-shadow .2s;
}
.chip b { font-weight: 600; color: var(--ink-3); font-size: 11px; }
.chip:hover { transform: translateY(-1px); }
.chip.is-on {
  background: var(--ink);
  color: #fff;
  box-shadow: none;
}
.chip.is-on b { color: rgba(255, 255, 255, .6); }

/* 卡片网格 */
.grid {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;      /* 翻记录不被拽 */
  -webkit-overflow-scrolling: touch;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(226px, 1fr));
  gap: 14px;
  padding: 2px 4px 90px 2px;
  align-content: start;
  scroll-behavior: smooth;
}
.grid::-webkit-scrollbar { width: 8px; }
.grid::-webkit-scrollbar-thumb { background: #dfe3ec; border-radius: 8px; }
.grid::-webkit-scrollbar-track { background: transparent; }

.card {
  position: relative;
  background: var(--surface);
  border-radius: var(--r-o);
  padding: 0;
  overflow: hidden;
  box-shadow: inset 0 0 0 1px var(--line), var(--sh-1);
  cursor: pointer;
  transition: transform .4s var(--ease-elastic), box-shadow .3s var(--ease-out);
  will-change: transform;
}
.card:hover { transform: translateY(-3px); box-shadow: inset 0 0 0 1px var(--line), var(--sh-2); }
.card:active { transform: scale(.985); }
.card.is-picked { box-shadow: inset 0 0 0 2px var(--brand), var(--sh-2); }
.card.is-conflict { opacity: .58; }
.card.is-conflict:hover { opacity: 1; }

.card-hero {
  position: relative;
  height: 142px;
  padding: 22px 14px 12px;
  display: grid;
  place-items: center;
  background: #ffffff;
  overflow: hidden;
}
.hero-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  opacity: 0;
  filter: blur(9px);
  transform: scale(1.04);
  transition: opacity .42s ease, filter .52s ease, transform .52s var(--ease-out);
  will-change: opacity, filter, transform;
}
.hero-img.is-loaded { opacity: 1; filter: blur(0); transform: scale(1); }
.card:hover .hero-img.is-loaded { transform: scale(1.05); }
.hero-img.is-broken { visibility: hidden; }
.hero-img.is-placeholder { max-height: 74px; opacity: .75; }

.hero-top {
  position: absolute;
  top: 8px;
  left: 12px;
  right: 12px;
  display: flex;
  align-items: baseline;
  gap: 6px;
  white-space: nowrap;
  overflow: hidden;
  z-index: 2;
}
.hero-brand {
  flex: 0 0 auto;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--ink-2);
}
.hero-model {
  min-width: 0;
  font-size: 9.5px;
  color: var(--ink-3);
  overflow: hidden;
  text-overflow: ellipsis;
}
.hero-cat {
  position: absolute;
  right: 11px;
  bottom: 9px;
  font-size: 9px;
  font-weight: 600;
  color: var(--ink-3);
  background: rgba(255, 255, 255, .92);
  padding: 2px 6px;
  border-radius: 6px;
}
.hero-warn {
  position: absolute;
  top: 11px; right: 12px;
  width: 19px; height: 19px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, .92);
  color: var(--bad);
  font-size: 12px;
  font-weight: 800;
}

.card-body {
  padding: 12px 15px 13px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.card-body h3 {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.7em;
}
.spec {
  margin: 0;
  font-size: 11.5px;
  color: var(--ink-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.card-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 3px; }
.price { font-size: 16px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }

.pick-btn {
  height: 30px;
  padding: 0 13px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand-ink);
  font-size: 12px;
  font-weight: 600;
  transition: background .2s, transform .3s var(--ease-elastic);
}
.pick-btn:hover { background: #dfe8ff; }
.pick-btn:active { transform: scale(.93); }
.card.is-picked .pick-btn { background: var(--brand); color: #fff; }

.empty {
  grid-column: 1 / -1;
  padding: 70px 0;
  text-align: center;
  color: var(--ink-3);
  font-size: 13px;
}

/* ================= 配置面板 ================= */
.build-panel {
  /* 同心圆角：内层 = 外层 26 - 本面板水平内边距 14 = 12 */
  --pad: 14px;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--surface);
  border-radius: var(--r-o);
  box-shadow: inset 0 0 0 1px var(--line), var(--sh-1);
  padding: 16px var(--pad) 12px;
  gap: 10px;
}
.bp-head { display: flex; align-items: center; justify-content: space-between; padding: 0 4px; }
.bp-head h2 { font-size: 14px; }
.link-btn { font-size: 12px; color: var(--ink-3); padding: 4px 8px; border-radius: 8px; transition: background .2s, color .2s; }
.link-btn:hover { background: var(--surface-2); color: var(--ink); }

.build-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 2px;
  /* 在使用处解析，才能吃到 .build-panel 覆盖后的 --pad */
  border-radius: calc(var(--r-o) - var(--pad));
}
.build-list::-webkit-scrollbar { width: 6px; }
.build-list::-webkit-scrollbar-thumb { background: #e4e8f0; border-radius: 6px; }

.bl-item {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto 22px;
  align-items: center;
  gap: 8px;
  padding: 9px 8px;
  border-radius: 13px;
  transition: background .18s;
  animation: rowIn .34s var(--ease-out) both;
}
@keyframes rowIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }
.bl-item.is-filled:hover { background: var(--surface-2); }
.bl-item.is-empty { grid-template-columns: 42px minmax(0, 1fr); cursor: pointer; }
.bl-item.is-empty:hover { background: var(--surface-2); }
.bl-item.is-empty .bl-name { color: var(--ink-3); font-size: 12.5px; }

.bl-cat {
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: .04em;
  color: var(--ink-3);
  background: var(--surface-2);
  padding: 3px 0;
  border-radius: 6px;
  text-align: center;
}
.bl-item.is-filled .bl-cat { background: var(--brand-soft); color: var(--brand-ink); }
.bl-name { font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bl-price { font-size: 12.5px; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--ink-2); }
.bl-del {
  width: 22px; height: 22px;
  border-radius: 50%;
  color: var(--ink-3);
  font-size: 15px;
  line-height: 1;
  display: grid; place-items: center;
  transition: background .18s, color .18s, transform .3s var(--ease-elastic);
  opacity: 0;
}
.bl-item:hover .bl-del { opacity: 1; }
.bl-del:hover { background: var(--bad-soft); color: var(--bad); transform: rotate(90deg); }

.compat { display: flex; flex-direction: column; gap: 5px; padding: 2px; }
.compat-note { font-size: 11.5px; color: var(--ink-3); padding: 6px 8px; }
.issue {
  display: flex; align-items: flex-start; gap: 7px;
  font-size: 11.5px;
  line-height: 1.45;
  padding: 7px 9px;
  border-radius: 11px;
  animation: rowIn .3s var(--ease-out) both;
}
.issue i { flex: 0 0 auto; width: 6px; height: 6px; border-radius: 50%; margin-top: 5px; }
.issue.err { background: var(--bad-soft); color: #96222a; }
.issue.err i { background: var(--bad); }
.issue.warn { background: var(--warn-soft); color: #8a5600; }
.issue.warn i { background: var(--warn); }
.issue.ok { background: var(--ok-soft); color: #0a6b3d; }
.issue.ok i { background: var(--ok); }

.bp-foot {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 8px 2px;
  border-top: 1px solid var(--line-soft);
}
.bp-foot-label { font-size: 11.5px; color: var(--ink-3); }
.bp-foot-val { font-size: 16px; font-weight: 700; font-variant-numeric: tabular-nums; }

/* ================= 底部抽屉 ================= */
.sheet {
  position: fixed;
  left: 0; right: 0; top: 0;
  height: 100vh;
  background: var(--surface);
  border-radius: 26px 26px 0 0;
  box-shadow: 0 -14px 44px -18px rgba(16, 24, 40, .3);
  z-index: 45;
  display: none;
  flex-direction: column;
  will-change: transform;
  transform: translateY(100%);
  touch-action: none;
}
.sheet-head { flex: 0 0 auto; padding: 8px 16px 10px; cursor: grab; touch-action: none; }
.sheet.is-dragging .sheet-head { cursor: grabbing; }
.sheet-grab { display: grid; place-items: center; height: 18px; }
.sheet-grab span { width: 38px; height: 4px; border-radius: 4px; background: #d7dce6; }
.sheet-bar { display: flex; align-items: center; justify-content: space-between; margin-top: 4px; }
.sheet-title { display: flex; align-items: center; gap: 9px; font-size: 13.5px; font-weight: 620; }
.sheet-title .js-status { font-size: 11px; font-weight: 500; }
.chip-btn {
  height: 28px; padding: 0 12px;
  border-radius: 999px;
  background: var(--surface-2);
  font-size: 12px;
  color: var(--ink-2);
  transition: background .2s, transform .3s var(--ease-elastic);
}
.chip-btn:active { transform: scale(.94); }
.sheet-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 2px 14px 40px;
  touch-action: pan-y;
}

/* ================= 详情层 ================= */
.detail-layer { position: fixed; inset: 0; z-index: 70; display: flex; align-items: center; justify-content: center; padding: 26px; }
.detail-scrim {
  position: absolute; inset: 0;
  background: rgba(16, 24, 40, .38);
  backdrop-filter: blur(10px) saturate(1.2);
  -webkit-backdrop-filter: blur(10px) saturate(1.2);
  animation: fadeIn .28s ease both;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.detail-panel {
  position: relative;
  width: min(768px, 100%);
  max-height: min(88vh, 920px);
  background: var(--surface);
  border-radius: var(--r-o);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--sh-3);
}
.detail-hero {
  position: relative;
  flex: 0 0 auto;
  height: 236px;
  padding: 26px 22px 18px;
  display: grid;
  place-items: center;
  background: #ffffff;
  overflow: hidden;
}
.detail-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  opacity: 0;
  filter: blur(10px);
  transition: opacity .45s ease, filter .55s ease;
}
.detail-img.is-loaded { opacity: 1; filter: blur(0); }
.detail-hero .hero-top { top: 14px; left: 18px; right: 54px; }
.detail-hero .hero-brand { font-size: 11px; }
.detail-hero .hero-model { font-size: 11.5px; color: var(--ink-2); }
.detail-close {
  position: absolute;
  top: 14px; right: 14px;
  width: 32px; height: 32px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, .94);
  color: var(--ink);
  box-shadow: 0 1px 4px rgba(16, 24, 40, .12);
  font-size: 13px;
  transition: background .2s, transform .3s var(--ease-elastic);
  z-index: 2;
}
.detail-close:hover { background: #fff; transform: rotate(90deg); }

.detail-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 18px 22px 22px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.detail-title { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.detail-title h2 { font-size: 18px; line-height: 1.3; }
.detail-sub { margin: 3px 0 0; font-size: 12px; color: var(--ink-3); }
.badge-live {
  flex: 0 0 auto;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--brand-ink);
  background: var(--brand-soft);
  padding: 4px 9px;
  border-radius: 8px;
}

.spec-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
  gap: 1px;
  margin: 0;
  background: var(--line-soft);
  border-radius: 16px;
  overflow: hidden;
}
.spec-row { background: var(--surface); padding: 10px 12px; }
.spec-row dt { font-size: 10.5px; color: var(--ink-3); margin-bottom: 2px; }
.spec-row dd { margin: 0; font-size: 13px; font-weight: 600; }

.detail-actions { display: flex; gap: 9px; }
.btn-primary {
  flex: 1 1 auto;
  height: 44px;
  border-radius: 14px;
  background: var(--brand);
  color: #fff;
  font-size: 13.5px;
  font-weight: 620;
  transition: background .2s, transform .3s var(--ease-elastic), box-shadow .25s;
  box-shadow: 0 10px 22px -12px rgba(47, 107, 255, .9);
}
.btn-primary:hover { background: var(--brand-ink); transform: translateY(-1px); }
.btn-primary:active { transform: scale(.97); }
.btn-primary.sm { flex: 0 0 auto; height: 38px; padding: 0 16px; border-radius: 11px; font-size: 12.5px; }
.btn-ghost {
  flex: 0 0 auto;
  height: 44px;
  padding: 0 20px;
  border-radius: 14px;
  background: var(--surface-2);
  color: var(--ink-2);
  font-size: 13.5px;
  transition: background .2s, transform .3s var(--ease-elastic);
}
.btn-ghost:hover { background: #eef1f7; }
.btn-ghost:active { transform: scale(.97); }
.detail-tip { margin: 0; font-size: 11px; color: var(--ink-3); }

/* ================= 图表 ================= */
.chart-wrap {
  background: var(--surface-2);
  border-radius: 18px;
  padding: 14px 14px 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  user-select: none;
}
.chart-head { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.chart-num { display: flex; align-items: baseline; gap: 2px; font-variant-numeric: tabular-nums; }
.chart-num .cur { font-size: 14px; font-weight: 600; color: var(--ink-2); }
.chart-meta { display: flex; align-items: center; gap: 8px; padding-bottom: 4px; }
.delta {
  font-size: 12px;
  font-weight: 620;
  font-variant-numeric: tabular-nums;
  padding: 2px 7px;
  border-radius: 7px;
  transition: color .25s, background .25s;
}
.delta.up { color: var(--bad); background: var(--bad-soft); }
.delta.down { color: var(--ok); background: var(--ok-soft); }
.delta.flat { color: var(--ink-3); background: #eef1f6; }
.chart-stamp { font-size: 11px; color: var(--ink-3); font-variant-numeric: tabular-nums; }

.ranges { display: flex; gap: 4px; margin-left: auto; background: #eef1f6; padding: 3px; border-radius: 999px; }
.range-chip {
  height: 26px;
  padding: 0 11px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 550;
  color: var(--ink-2);
  transition: background .25s, color .2s, transform .3s var(--ease-elastic);
}
.range-chip.is-on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(16,24,40,.12); }
.range-chip:active { transform: scale(.94); }

.chart-stage {
  position: relative;
  touch-action: pan-y;
  cursor: crosshair;
}
.chart-svg { display: block; width: 100%; overflow: visible; }
.chart-svg .grid line { stroke: var(--line-soft); stroke-width: 1; stroke-dasharray: 3 5; }
.chart-svg .line { stroke: var(--brand); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }

.chart-cursor {
  position: absolute;
  top: 0; left: 0;
  width: 0;
  pointer-events: none;
  transition: transform .2s var(--ease-elastic);
}
.cursor-line {
  position: absolute;
  top: 18px; bottom: 22px;
  left: 0;
  width: 1px;
  background: rgba(36,40,48,.26);
}
.cursor-dot {
  position: absolute;
  left: -4.5px;
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--brand);
  box-shadow: 0 0 0 2.5px var(--surface-2);
  transition: top .2s var(--ease-elastic);
}
.cursor-halo {
  position: absolute;
  left: -15px;
  width: 30px; height: 30px;
  margin-top: -10px;
  border-radius: 50%;
  background: rgba(36,40,48,.11);
  transition: top .2s var(--ease-elastic);
}

.chart-foot {
  display: flex; align-items: center; gap: 7px;
  font-size: 10.5px;
  color: var(--ink-3);
  padding-top: 2px;
}
.dot-live {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 0 rgba(15, 157, 88, .5);
  animation: pulse 1.9s infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(15, 157, 88, .45); }
  70% { box-shadow: 0 0 0 7px rgba(15, 157, 88, 0); }
  100% { box-shadow: 0 0 0 0 rgba(15, 157, 88, 0); }
}
.src-tag { margin-left: auto; color: var(--ink-3); opacity: .8; }

/* ================= Odometer ================= */
.odometer {
  display: inline-flex;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  letter-spacing: -.02em;
  font-size: 21px;
}
.od-digit {
  display: inline-block;
  height: 1em;
  overflow: hidden;
  width: .60em;
  text-align: center;
}
.od-strip {
  display: block;
  transition: transform .66s var(--ease-elastic), opacity .3s;
  will-change: transform;
}
.od-strip i {
  display: block;
  height: 1em;
  line-height: 1em;
  font-style: normal;
}
.chart-num .odometer { font-size: 30px; }

/* ================= 导出面板 ================= */
.morph-panel {
  /* 同心圆角：24 - 12 = 12 */
  --r-o: 24px;
  --pad: 12px;
  position: fixed;
  top: calc(var(--topbar-h) + 8px);
  right: 20px;
  width: min(400px, calc(100vw - 32px));
  background: var(--surface);
  border-radius: var(--r-o);
  padding: var(--pad);
  z-index: 60;
  display: none;
  box-shadow: inset 0 0 0 1px var(--line), var(--sh-2);
  transform-origin: top right;
  will-change: transform;
}
.mp-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.mp-head h3 { font-size: 13.5px; }
.icon-btn {
  width: 28px; height: 28px;
  display: grid; place-items: center;
  border-radius: 50%;
  color: var(--ink-3);
  transition: background .2s, color .2s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.mp-text {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: calc(var(--r-o) - var(--pad));
  background: var(--surface-2);
  padding: 11px 12px;
  font-size: 12px;
  line-height: 1.65;
  resize: none;
  outline: none;
  font-variant-numeric: tabular-nums;
  transition: border-color .2s, box-shadow .2s;
}
.mp-text:focus { border-color: #c3d3ff; box-shadow: 0 0 0 4px rgba(47,107,255,.1); }
.mp-foot { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.mp-hint { font-size: 10.5px; color: var(--ink-3); }

/* ================= 飞行快照 ================= */
.fly-snap {
  position: fixed;
  z-index: 90;
  overflow: hidden;
  pointer-events: none;
  padding: 20px 14px;
  display: grid;
  place-items: center;
  box-shadow: 0 26px 60px -24px rgba(16, 24, 40, .5);
  will-change: left, top, width, height, border-radius;
}
.fly-snap .hero-img { max-width: 100%; max-height: 100%; object-fit: contain; }

/* ================= 页脚 / 图片来源 ================= */
.site-foot {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 20px 10px;
  font-size: 11px;
  color: var(--ink-3);
}
.site-foot .link-btn { padding: 2px 8px; font-size: 11px; }
.foot-note { margin-left: auto; opacity: .85; }

.credit-panel {
  width: min(480px, calc(100vw - 32px));
  max-height: min(62vh, 560px);
  display: none;
  flex-direction: column;
}
.credit-panel.is-open { display: flex; }
.credit-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
  gap: 2px;
  border-radius: calc(var(--r-o) - var(--pad));
  margin: 0 -2px;
  padding: 0 2px;
}
.credit-item {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  grid-template-areas: "cat main link" "cat by link";
  gap: 2px 9px;
  align-items: center;
  padding: 8px 8px;
  border-radius: 11px;
}
.credit-item:hover { background: var(--surface-2); }
.credit-cat {
  grid-area: cat;
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: .04em;
  color: var(--ink-3);
  background: var(--surface-2);
  padding: 4px 0;
  border-radius: 6px;
  text-align: center;
}
.credit-main { grid-area: main; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.credit-by { grid-area: by; font-size: 10.5px; color: var(--ink-3); }
.credit-link {
  grid-area: link;
  font-size: 10.5px;
  color: var(--brand);
  text-decoration: none;
  padding: 3px 8px;
  border-radius: 8px;
  background: var(--brand-soft);
  white-space: nowrap;
}
.credit-link:hover { background: #dfe8ff; }
.credit-loading { margin: 0; padding: 24px 0; text-align: center; font-size: 12px; color: var(--ink-3); }
.credit-hint { margin: 8px 0 0; line-height: 1.5; }

/* ================= 响应式：分屏防翻车 ================= */
@media (max-width: 1080px) {
  .layout { grid-template-columns: minmax(0, 1fr) 320px; }
  .top-search { max-width: 300px; }
}

@media (max-width: 900px) {
  :root { --topbar-h: 62px; --r-o: 22px; }
  .layout { grid-template-columns: minmax(0, 1fr); padding: 12px 14px 0; }
  .build-panel { display: none; }
  .sheet { display: flex; }
  .grid { padding-bottom: 190px; }
  .top-stats { gap: 14px; }
  .hide-sm { display: none; }
  .brand-txt { font-size: 14px; }
  .ver { display: none; }
  .detail-layer { padding: 0; align-items: flex-end; }
  .detail-panel { width: 100%; max-height: 92vh; border-radius: 26px 26px 0 0; }
  .detail-hero { height: 196px; }
  .site-foot { display: none; }
  .detail-body { padding: 16px 16px 20px; gap: 14px; }
  .morph-panel { right: 12px; left: 12px; width: auto; }
  .chart-num .odometer { font-size: 26px; }
}

@media (max-width: 620px) {
  .topbar { gap: 10px; padding: 0 12px; }
  .top-search { flex: 1 1 auto; max-width: none; }
  .top-search input { height: 34px; font-size: 13px; }
  .stat-val.total { font-size: 17px; }
  .morph-btn { height: 34px; padding: 0 12px; font-size: 12px; }
  .morph-btn svg { display: none; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(158px, 1fr)); gap: 10px; }
  .card-hero { height: 106px; padding: 18px 10px 8px; }
  .hero-brand { font-size: 8.5px; top: 8px; left: 10px; }
  .hero-cat { display: none; }
  .card-body { padding: 10px 11px 11px; }
  .card-body h3 { font-size: 12px; }
  .price { font-size: 14px; }
  .pick-btn { height: 27px; padding: 0 10px; font-size: 11px; }
  .spec-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
  }
}
