/* ==========================================================================
   宝石世界 · Design System
   原厂对齐：统一圆角、1px 线框、按钮层级、字号梯度、双主题色板
   ========================================================================== */

:root {
  --fs-display: 32px;
  --fs-h1: 24px;
  --fs-h2: 19px;
  --fs-h3: 16px;
  --fs-body: 14px;
  --fs-caption: 12px;
  --fs-micro: 10px;

  --r-xs: 0;
  --r-sm: 0;
  --r-md: 0;
  --r-lg: 0;
  --r-xl: 0;
  --r-pill: 999px;

  --space-1: 6px;
  --space-2: 12px;
  --space-3: 16px;
  --space-4: 20px;
  --space-5: 28px;
  --space-6: 38px;
  --space-8: 52px;

  --header-h: 64px;
  --tabbar-h: 68px;
  --shadow-1: none;
  --shadow-2: 0 18px 50px rgba(43, 36, 31, .14);
  --font: "Helvetica Neue", Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-serif: Didot, "Bodoni MT", "Times New Roman", "Songti SC", "Noto Serif CJK SC", serif;
}

html[data-theme="warm"] {
  --bg: #FFFFF0;
  --bg-deep: #FFFFF0;
  --surface: #FFFFF0;
  --surface-2: #FFFFF0;
  --surface-3: #FFFFF0;
  --text: #2B241F;
  --text-2: #6E6258;
  --text-3: #9C9085;
  --line: #E4DEC8;
  --line-strong: #CFC6A8;
  --primary: #2B241F;
  --primary-hover: #120E0B;
  --primary-2: #6E6258;
  --primary-soft: #F0EAE1;
  --primary-contrast: #FFFDFA;
  --accent: #D8561F;
  --accent-soft: #F8E9DF;
  --success: #3E6B58;
  --success-soft: #E8EFEA;
  --danger: #A33B32;
  --danger-soft: #F5E5E2;
  --gold: #D8561F;
  --gold-soft: #F8E9DF;
  --overlay: rgba(43, 36, 31, .48);
}

html[data-theme="night"] {
  /* 夜间主题：深色 UI，与暖色象牙白形成明显切换 */
  --bg: #171310;
  --bg-deep: #0E0B09;
  --surface: #201A16;
  --surface-2: #2A221D;
  --surface-3: #362C25;
  --text: #F4EFE8;
  --text-2: #B6A99B;
  --text-3: #82776C;
  --line: #3A3029;
  --line-strong: #57493E;
  --primary: #F4EFE8;
  --primary-hover: #FFFFFF;
  --primary-2: #C7B8A8;
  --primary-soft: #2E251F;
  --primary-contrast: #171310;
  --accent: #F6821F;
  --accent-soft: #3B261C;
  --success: #7FB29A;
  --success-soft: #22322A;
  --danger: #D07A70;
  --danger-soft: #39231F;
  --gold: #F6821F;
  --gold-soft: #3B261C;
  --overlay: rgba(0, 0, 0, .72);
  /* 顶栏/搜索/选项卡等 factory 组件跟随夜间主题 */
  --factory-ivory: #201A16;
  --factory-gold: #F6821F;
  --factory-orange: #F6821F;
  --factory-orange-soft: #FBAD41;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  font-size: var(--fs-body);
  font-weight: 400;
  line-height: 1.7;
  letter-spacing: .1px;
  color: var(--text);
  background: var(--bg-deep);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
input, textarea, select { outline: none; }
[hidden] { display: none !important; }

.icon {
  width: 18px; height: 18px;
  fill: none; stroke: currentColor; stroke-width: 1.25;
  stroke-linecap: round; stroke-linejoin: round;
  flex: none;
}

/* --------------------------------------------- Original-style top bar (cloudflare-like) */
.fb-topbar {
  display: none; align-items: center; gap: 8px;
  height: 60px; padding: 0 12px;
  background: var(--factory-ivory); color: var(--factory-gold);
  border-bottom: 0;
  transition: height .3s cubic-bezier(.4, 0, .2, 1), opacity .24s ease;
  overflow: hidden; will-change: height;
}
.tb-brand {
  display: flex; align-items: center; gap: 9px;
  padding: 0; color: var(--factory-gold); min-width: 0;
}
.tb-brand strong {
  font-size: 19px; font-weight: 700; letter-spacing: .4px;
  line-height: 1; white-space: nowrap;
}
.tb-brand-text { display: flex; flex-direction: column; justify-content: center; gap: 2px; min-width: 0; }
.tb-brand-text small { font-size: 9px; font-weight: 600; letter-spacing: 1.6px; color: var(--text-2); text-transform: uppercase; line-height: 1; white-space: nowrap; }
[data-action="edit-shop"] { cursor: pointer; }
[data-action="edit-shop"]:hover { text-decoration: underline dotted; text-underline-offset: 3px; }
.tb-logo {
  width: 40px; height: 40px; flex: none; display: grid; place-items: center;
  background: var(--factory-ivory); border: 1px solid var(--factory-gold); overflow: hidden;
}
.tb-logo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tb-logo .brand-gem { background: var(--factory-gold); }
.fb-actions { margin-left: auto; display: flex; align-items: center; gap: 2px; }
.tb-btn {
  width: 40px; height: 40px; flex: none; display: inline-flex;
  align-items: center; justify-content: center;
  color: var(--factory-gold); position: relative; background: transparent;
  border: 0;
}
.tb-btn:active { opacity: .6; }
.tb-btn .icon { width: 22px; height: 22px; stroke-width: 1.7; }
.tb-mini, .tb-badge {
  position: absolute; top: 1px; right: 1px; min-width: 15px; height: 15px; padding: 0 3px;
  font-size: 9px; font-weight: 700; line-height: 1;
  color: var(--factory-ivory); background: var(--factory-gold);
  border-radius: 2px; display: grid; place-items: center; border: 1px solid var(--factory-ivory);
}
.app-header.topbar-hidden .fb-topbar { height: 0; opacity: 0; }
.fb-menu-head {
  display: flex; align-items: center; gap: 12px;
  padding: 4px 0 16px; margin-bottom: 8px; border-bottom: 1px solid var(--line);
}

/* ---------------------------------------------------------------- App shell */
.app-shell {
  min-height: 100vh;
  max-width: 520px;
  margin: 0 auto;
  background: var(--bg);
  position: relative;
  box-shadow: none;
  display: flex;
  flex-direction: column;
}
.app-header {
  position: sticky; top: 0; z-index: 40;
  height: var(--header-h);
  background: var(--surface);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.header-inner {
  height: 100%; padding: 0 var(--space-5);
  display: flex; align-items: center; gap: var(--space-3);
}
.header-back { margin-left: -8px; }
.header-actions { margin-left: auto; display: flex; align-items: center; gap: 2px; }
.header-actions .icon-btn { width: 40px; height: 40px; flex: none; }
.header-actions .icon-btn .icon { width: 22px; height: 22px; stroke-width: 1.7; }

.brand { display: flex; align-items: center; gap: 9px; padding: 0; min-width: 0; text-align: left; }
.brand-mark {
  width: 28px; height: 28px; flex: none;
  background: var(--accent); display: grid; place-items: center; overflow: hidden;
}
.brand-mark img { width: 100%; height: 100%; object-fit: cover; }
.brand-gem {
  width: 14px; height: 14px; display: block;
  background: #FFFDFA; clip-path: polygon(50% 0, 92% 34%, 74% 100%, 26% 100%, 8% 34%);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.brand-text strong { font-family: var(--font-serif); font-size: 14px; font-weight: 400; letter-spacing: 2px; white-space: nowrap; }
.brand-text small { font-size: 8px; color: var(--text-2); letter-spacing: 2px; text-transform: uppercase; white-space: nowrap; }
.brand-text #brand-en { font-size: 9px; font-weight: 600; letter-spacing: 1.4px; color: var(--factory-gold); }

.icon-btn {
  width: 38px; height: 38px; border-radius: var(--r-sm);
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--text-2); position: relative; transition: background .15s, color .15s;
}
.icon-btn:hover, .icon-btn:active { background: var(--surface-2); color: var(--primary); }
.mini-label, .bell-btn .badge {
  position: absolute; top: 1px; right: 1px; min-width: 15px; height: 15px; padding: 0 3px;
  font-size: 9px; font-weight: 700; line-height: 1; letter-spacing: 0;
  border-radius: 2px; display: grid; place-items: center; border: 1px solid var(--surface);
}
.mini-label { color: #FFFDFA; background: var(--accent); }
.bell-btn .badge { color: #FFFDFA; background: var(--accent); }
.search-box {
  display: none; align-items: center; gap: 6px;
  background: transparent; border: 0; border-bottom: 1px solid var(--line-strong);
  padding: 0 2px; height: 34px;
  color: var(--text-3); width: 190px;
}
.search-box .icon { width: 16px; height: 16px; }
.search-box input { border: 0; background: transparent; width: 100%; font-size: var(--fs-caption); color: var(--text); }
.search-box input::placeholder { color: var(--text-3); }

.app-main { flex: 1; padding-bottom: calc(var(--tabbar-h) + 16px); }
.page { padding: var(--space-5); animation: fadeIn .22s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ------------------------------------------------------------------ Tabbar */
.tabbar {
  position: fixed; z-index: 40; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 520px; height: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: var(--surface);
  background: color-mix(in srgb, var(--surface) 95%, transparent);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
  display: flex; align-items: stretch;
}
.tab {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px; font-size: 9px; letter-spacing: 1px; color: var(--text-3); font-weight: 400;
  position: relative; transition: color .15s;
}
.tab .icon { width: 18px; height: 18px; }
.tab.active { color: var(--text); }
.tab.active::before {
  content: ""; position: absolute; top: 0; width: 14px; height: 1px; background: var(--accent);
}
.tab-sell .sell-circle {
  width: 36px; height: 36px; margin-top: -10px;
  background: transparent; color: var(--accent); display: grid; place-items: center;
  border: 1px solid var(--line-strong);
}
.tab-sell.active .sell-circle { border-color: var(--accent); }
.tab-sell .sell-circle .icon { width: 18px; height: 18px; stroke-width: 1.5; }
.tab-sell { color: var(--text-2); }
.tab-sell.active { color: var(--primary); }

/* -------------------------------------------------------------- Typography */
.page-head { margin-bottom: var(--space-6); }
.page-title, .hero-title, .detail-title, .profile-name, .modal-title, .sheet-title, .brand-text strong {
  font-family: var(--font-serif); font-weight: 400; letter-spacing: 1.2px;
}
.page-title { font-size: var(--fs-h1); margin: 0; }
.page-sub { color: var(--text-2); font-size: 11px; margin-top: 8px; letter-spacing: 1.6px; }
.section { margin-top: var(--space-8); }
.section-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--space-4); gap: 8px; }
.section-title { font-size: var(--fs-h2); font-family: var(--font-serif); font-weight: 400; letter-spacing: 2px; margin: 0; display: flex; align-items: center; gap: 10px; }
.section-title::before { content: ""; width: 18px; height: 1px; background: var(--accent); }
.section-more { font-size: 10px; color: var(--accent); letter-spacing: 1.4px; border-bottom: 1px solid var(--accent); padding-bottom: 1px; }

/* ------------------------------------------------------------------ Buttons */
.btn {
  min-height: 44px; padding: 0 24px; border-radius: 0;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-size: 11px; font-weight: 500; letter-spacing: 1.6px; text-transform: uppercase;
  border: 1px solid transparent; transition: background .18s, border-color .18s, color .18s;
  white-space: nowrap;
}
.btn:active { transform: none; }
.btn .icon { width: 17px; height: 17px; }
.btn-primary { background: var(--text); color: var(--surface); border: 1px solid var(--text); }
.btn-primary:hover { background: var(--accent); border-color: var(--accent); color: #FFFDFA; }
html[data-theme="night"] .btn-primary { background: var(--text); color: var(--bg-deep); border-color: var(--text); }
.btn-outline { background: transparent; border-color: var(--line-strong); color: var(--text); }
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }
.btn-ghost { background: var(--surface-2); color: var(--text); }
.btn-danger { background: var(--danger-soft); color: var(--danger); }
.btn-sm { min-height: 34px; padding: 0 12px; font-size: var(--fs-caption); border-radius: var(--r-sm); }
.btn-xs { min-height: 28px; padding: 0 9px; font-size: var(--fs-micro); border-radius: var(--r-xs); }
.btn-block { width: 100%; }
.btn-row { display: flex; gap: var(--space-2); }
.btn-row > .btn { flex: 1; }

/* ------------------------------------------------------------------- Cards */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 0;
}
.pad { padding: var(--space-5); }
.divider { height: 1px; background: var(--line); margin: var(--space-4) 0; }
.tag {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 2px 7px; border: 1px solid var(--line);
  font-size: 9px; font-weight: 500; letter-spacing: 1px; text-transform: uppercase;
  background: transparent; color: var(--text-2);
}
.tag-primary { background: var(--primary-soft); color: var(--primary); }
.tag-success { background: var(--success-soft); color: var(--success); }
.tag-gold { background: var(--gold-soft); color: var(--gold); }
.tag-danger { background: var(--danger-soft); color: var(--danger); }
.tag-ad { background: var(--gold-soft); color: var(--gold); letter-spacing: .5px; }
.tag-mine { position: absolute; top: 8px; left: 8px; z-index: 2; background: var(--gold); color: #fff; letter-spacing: .5px; }
.product-media, .feed-media { position: relative; }

/* -------------------------------------------------------------------- Hero */
.hero {
  overflow: hidden; position: relative;
  background: var(--surface); color: var(--text);
  padding: var(--space-8) var(--space-5); min-height: 250px;
  border: 1px solid var(--line);
  display: flex; flex-direction: column; justify-content: space-between;
}
.hero::after {
  content: ""; position: absolute; left: var(--space-5); right: var(--space-5); top: 72px;
  height: 1px; background: var(--line); pointer-events: none;
}
.hero-gem {
  position: absolute; right: 24px; top: 34px; width: 112px; height: 112px;
  opacity: .92; filter: none;
}
.hero-eyebrow { font-size: 8px; font-weight: 500; letter-spacing: 5px; color: var(--accent); text-transform: uppercase; }
.hero-title { font-size: var(--fs-display); line-height: 1.25; font-family: var(--font-serif); font-weight: 400; margin: 10px 0 8px; letter-spacing: 2.5px; color: var(--text); }
.hero-desc { font-size: 11px; color: var(--text-2); max-width: 72%; letter-spacing: .6px; }
.hero-actions { display: flex; gap: 10px; margin-top: var(--space-6); }
.hero-actions .btn { min-height: 40px; font-size: 10px; letter-spacing: 1.8px; padding: 0 16px; }
.hero-actions .btn-light { background: var(--text); color: var(--surface); border-color: var(--text); }
.hero-actions .btn-glass { background: transparent; color: var(--text); border-color: var(--line-strong); }

/* --------------------------------------------------------------- Ad banner */
.ad-card {
  margin-top: var(--space-4); border: 1px solid var(--line); background: var(--surface);
  display: flex; align-items: center; gap: 16px; padding: 16px; cursor: pointer;
}
.ad-thumb { width: 68px; height: 68px; border: 1px solid var(--line); padding: 6px; background: var(--surface-2); flex: none; }
.ad-thumb img { width: 100%; height: 100%; object-fit: contain; display: block; }
.ad-body { min-width: 0; flex: 1; }
.ad-title { font-family: var(--font-serif); font-weight: 400; font-size: var(--fs-body); letter-spacing: .5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ad-sub { color: var(--text-2); font-size: var(--fs-micro); margin-top: 2px; }
.ad-label { font-size: 8px; font-weight: 500; letter-spacing: 1.5px; color: var(--accent); padding: 0; }
.ad-dots { display: flex; gap: 4px; justify-content: center; margin-top: 8px; }
.dot { width: 6px; height: 6px; padding: 0; border: 0; border-radius: 50%; background: var(--line-strong); cursor: pointer; }
.dot.active { width: 14px; border-radius: 0; background: var(--accent); }

/* --------------------------------------------------------------- Category */
.cat-row { display: flex; gap: var(--space-3); overflow-x: auto; padding-bottom: 6px; scrollbar-width: none; }
.cat-row::-webkit-scrollbar { display: none; }
.cat-chip {
  flex: none; display: flex; flex-direction: column; align-items: center; gap: 5px;
  min-width: 56px; padding: 4px 2px 8px; background: transparent;
  border: 0; border-bottom: 1px solid transparent; color: var(--text-2);
  font-size: 10px; letter-spacing: 1px; transition: border-color .18s, color .18s;
}
.cat-chip.active { border-bottom-color: var(--accent); color: var(--text); }
.cat-icon { width: 32px; height: 32px; display: grid; place-items: center; font-size: 17px; font-weight: 400; color: var(--text-2); background: transparent; }
.cat-chip.active .cat-icon { color: var(--accent); }

/* ---------------------------------------------------------------- Products */
.product-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: var(--space-5); }
.product-card {
  background: var(--surface); border: 1px solid var(--line);
  overflow: hidden; cursor: pointer; transition: border-color .2s;
}
.product-card:hover { border-color: var(--line-strong); }
.product-media { position: relative; width: 100%; aspect-ratio: 1 / 1; padding: 24px; background: var(--bg); overflow: hidden; }
.product-media::after { content: ""; position: absolute; inset: 12px; border: 1px solid var(--line); pointer-events: none; }
.product-media img { width: 100%; height: 100%; object-fit: contain; display: block; }
.product-media .fav-btn {
  position: absolute; top: 16px; right: 16px; width: 26px; height: 26px; z-index: 1;
  background: var(--surface); border: 1px solid var(--line); color: var(--text-2);
  display: grid; place-items: center;
}
.fav-btn .icon { width: 15px; height: 15px; }
.fav-btn.on { color: var(--accent); border-color: var(--accent); }
.fav-btn.on .icon { fill: currentColor; }
.product-body { padding: 18px 16px 22px; }
.product-title { font-family: var(--font-serif); font-size: 15px; font-weight: 400; line-height: 1.45; letter-spacing: 1px; height: 44px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.product-meta { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; }
.price { color: var(--accent); font-family: var(--font-serif); font-weight: 400; font-size: 18px; letter-spacing: .5px; }
.price small { font-size: 9px; letter-spacing: 1px; margin-right: 2px; }
.price .price-cents, .feed-price .price-cents, .classify-price .price-cents,
.detail-price .price-cents, .cart-price .price-cents, .cart-total-row .price-cents,
.list-value .price-cents, .dash-stat .price-cents, .amount-chip .price-cents,
.ad-sub .price-cents, .mine-meta .price-cents {
  font-family: inherit; font-size: .62em; font-weight: 400;
  letter-spacing: 0; margin-right: 0; vertical-align: baseline;
}
.product-seller { font-size: var(--fs-micro); color: var(--text-3); display: flex; align-items: center; gap: 4px; margin-top: 6px; }
.product-seller .dot-sep { width: 3px; height: 3px; border-radius: 50%; background: var(--text-3); }
.card-tags { display: flex; gap: 4px; margin-top: 6px; flex-wrap: wrap; }
.status-off .product-media { filter: grayscale(.85); }

/* ------------------------------------------------------------- Latest list */
.latest-list { display: flex; flex-direction: column; gap: var(--space-3); }
.latest-card { display: flex; align-items: stretch; gap: 16px; padding: 14px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; transition: border-color .2s; }
.latest-card:hover { border-color: var(--line-strong); }
.latest-media { position: relative; width: 112px; height: 112px; flex: none; padding: 10px; background: var(--bg); border: 1px solid var(--line); }
.latest-media::after { content: ""; position: absolute; inset: 6px; border: 1px solid var(--line); pointer-events: none; }
.latest-media img { width: 100%; height: 100%; object-fit: contain; display: block; }
.latest-media .fav-btn { top: 8px; right: 8px; width: 24px; height: 24px; }
.latest-media .fav-btn .icon { width: 13px; height: 13px; }
.latest-body { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center; }
.latest-title { font-family: var(--font-serif); font-size: 15px; font-weight: 400; letter-spacing: 1px; line-height: 1.45; }
.latest-meta { margin-top: 8px; }

/* ------------------------------------------------------------ Auction page */
.auction-page { padding: 0; }
.auction-hero { padding: 20px 16px 16px; background: var(--factory-ivory); }
.auction-hero-title { font-family: var(--font-serif); font-size: 26px; font-weight: 600; color: var(--factory-gold); letter-spacing: 2px; }
.auction-hero-sub { font-size: 12px; color: var(--text-3); letter-spacing: 1px; margin-top: 4px; }
.auction-tabs { display: flex; gap: 6px; padding: 10px 12px; background: var(--factory-ivory); }
.auction-tab {
  flex: 1; min-height: 36px; padding: 0 2px; font-size: 13px; color: var(--text-2); text-align: center;
  background: var(--factory-ivory); border: 1px solid var(--factory-gold);
}
.auction-tab.active { background: var(--gold-soft); color: var(--factory-gold); font-weight: 600; }
.auction-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; padding: 12px; }
.auction-card { background: var(--surface); border: 1px solid var(--line); overflow: hidden; cursor: pointer; }
.auction-media { position: relative; width: 100%; aspect-ratio: 1 / 1; overflow: hidden; background: var(--factory-ivory); }
.auction-media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.auction-status { position: absolute; top: 8px; left: 8px; padding: 3px 8px; font-size: 10px; letter-spacing: .5px; color: #fff; background: var(--factory-gold); }
.auction-status.ending { background: var(--danger); }
.auction-status.ended { background: var(--text-3); }
.auction-body { padding: 10px; }
.auction-name { font-size: 14px; font-weight: 500; line-height: 1.4; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.auction-price-row { display: flex; align-items: baseline; justify-content: space-between; gap: 6px; margin-top: 6px; }
.auction-price { color: var(--factory-gold); font-family: var(--font-serif); font-size: 18px; font-weight: 600; }
.auction-bids { font-size: 10px; color: var(--text-3); }
.auction-meta { display: flex; justify-content: space-between; gap: 6px; margin-top: 6px; font-size: 10px; color: var(--text-3); }
.auction-timer { color: var(--factory-gold); }
.auction-bid-btn {
  width: 100%; min-height: 36px; margin-top: 10px; background: var(--factory-ivory);
  color: var(--factory-gold); border: 1px solid var(--factory-gold); font-size: 13px; letter-spacing: 1px;
}
.auction-bid-btn:disabled { opacity: .5; }

.auction-detail-page { padding: 16px; }
.auction-detail-media { width: 100%; aspect-ratio: 1 / 1; overflow: hidden; background: var(--factory-ivory); }
.auction-detail-media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.auction-detail-timer { display: flex; align-items: center; gap: 10px; margin-top: 14px; padding: 10px 14px; border: 1px solid var(--factory-gold); color: var(--factory-gold); }
.auction-timer-label { font-size: 12px; letter-spacing: 1px; }
.auction-detail-timer strong { font-family: var(--font-serif); font-size: 20px; margin-left: auto; }
.auction-detail-timer.off { border-color: var(--line); color: var(--text-3); }
.auction-price-box { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; padding: 16px; background: var(--factory-ivory); }
.auction-label { display: block; font-size: 11px; color: var(--text-3); letter-spacing: 1px; }
.auction-price-big { display: block; font-family: var(--font-serif); font-size: 30px; font-weight: 600; color: var(--factory-gold); margin-top: 4px; }
.auction-price-side { display: flex; flex-direction: column; gap: 4px; text-align: right; font-size: 11px; color: var(--text-2); }
.auction-bid-panel { margin-top: 14px; padding: 14px; border: 1px solid var(--line); }
.auction-bid-head { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-2); }
.auction-bid-head span:last-child { color: var(--factory-gold); }
.auction-quick { display: flex; gap: 8px; margin-top: 10px; }
.auction-quick-btn { flex: 1; min-height: 36px; background: var(--factory-ivory); color: var(--factory-gold); border: 1px solid var(--factory-gold); font-size: 13px; }
.auction-bid-row { display: flex; align-items: stretch; gap: 8px; margin-top: 10px; }
.auction-bid-unit { display: flex; align-items: center; padding: 0 6px; color: var(--factory-gold); font-family: var(--font-serif); font-size: 18px; }
.auction-bid-input { flex: 1; min-width: 0; min-height: 42px; padding: 0 10px; border: 1px solid var(--factory-gold); background: var(--factory-ivory); color: var(--text); font-size: 15px; }
.auction-bid-submit { padding: 0 16px; min-height: 42px; background: var(--factory-gold); color: #fff; border: 1px solid var(--factory-gold); font-size: 14px; letter-spacing: 1px; }
.auction-bid-submit:disabled { opacity: .5; }
.auction-bid-hint { margin: 8px 0 0; font-size: 11px; color: var(--text-3); line-height: 1.6; }
.auction-demo { margin-top: 12px; }
.auction-history { margin-top: 18px; }
.auction-history .section-title { font-size: 15px; margin-bottom: 10px; }
.auction-history-row { align-items: center; }
.auction-rank { width: 26px; height: 26px; flex: none; display: grid; place-items: center; font-size: 11px; color: var(--text-2); border: 1px solid var(--line); }
.auction-rank.top { color: var(--factory-gold); border-color: var(--factory-gold); }
.auction-bid-amount { font-family: var(--font-serif); font-size: 14px; color: var(--text); text-align: right; }
.auction-bid-amount small { display: block; font-family: inherit; font-size: 9px; color: var(--factory-gold); }
.auction-no-bids { font-size: 12px; color: var(--text-3); text-align: center; padding: 18px 0; }

/* ------------------------------------------------------------ Logistics / scan */
.segmented-scroll { display: flex; gap: 4px; overflow-x: auto; }
.segmented-scroll .segment { flex: none; padding: 0 10px; white-space: nowrap; }
.segmented-scroll .segment small { opacity: .7; font-size: 10px; }
.logi-item { padding: 12px 14px; border-bottom: 1px solid var(--line); }
.logi-item:last-child { border-bottom: 0; }
.logi-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.logi-price { font-family: var(--font-serif); font-size: 14px; color: var(--factory-gold); }
.logi-meta { margin-top: 4px; font-size: 11px; color: var(--text-3); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.logi-track { margin-top: 8px; padding: 7px 9px; background: var(--surface-2); font-size: 11px; color: var(--text-2); letter-spacing: .5px; }
.logi-return-reason { margin-top: 8px; padding: 7px 9px; background: var(--danger-soft); color: var(--danger); font-size: 11px; }
.logi-actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.buyer-order { border-left: 3px solid var(--factory-gold); }
.scan-box { position: relative; margin-top: 10px; aspect-ratio: 4 / 3; background: #000; overflow: hidden; }
.scan-box video { width: 100%; height: 100%; object-fit: cover; display: block; }
.scan-frame { position: absolute; inset: 12% 18%; border: 2px solid var(--factory-gold); box-shadow: 0 0 0 9999px rgba(0,0,0,.35); pointer-events: none; }

/* ------------------------------------------------------------- Check-in page */
.checkin-page { padding: 16px; }
.checkin-hero { text-align: center; padding: 24px 16px 18px; background: var(--factory-ivory); border: 1px solid var(--factory-gold); }
.checkin-flame { font-size: 30px; color: var(--factory-gold); }
.checkin-streak { margin-top: 6px; display: flex; align-items: baseline; justify-content: center; gap: 6px; }
.checkin-streak b { font-family: var(--font-serif); font-size: 46px; line-height: 1; color: var(--factory-gold); }
.checkin-streak span { font-size: 13px; color: var(--text-2); }
.checkin-hero-sub { margin-top: 6px; font-size: 12px; color: var(--text-3); letter-spacing: 1px; }
.checkin-stats { display: flex; gap: 10px; margin-top: 12px; }
.checkin-stats div { flex: 1; text-align: center; padding: 12px 0; background: var(--surface); border: 1px solid var(--line); }
.checkin-stats b { display: block; font-family: var(--font-serif); font-size: 22px; color: var(--accent); }
.checkin-stats span { font-size: 11px; color: var(--text-3); }
.checkin-btn { margin-top: 14px; }
.checkin-calendar { margin-top: 18px; }
.checkin-cal-head { display: flex; align-items: center; justify-content: space-between; padding: 0 4px 10px; }
.checkin-cal-head strong { font-family: var(--font-serif); font-size: 16px; color: var(--text); }
.checkin-week, .checkin-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.checkin-week span { text-align: center; font-size: 11px; color: var(--text-3); padding-bottom: 6px; }
.checkin-cell { aspect-ratio: 1 / 1; display: grid; place-items: center; font-size: 12px; color: var(--text-2); border: 1px solid var(--line); }
.checkin-cell.blank { border-color: transparent; }
.checkin-cell.marked { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); font-weight: 600; }
.checkin-cell.today { outline: 2px solid var(--factory-gold); outline-offset: -2px; }
.checkin-note { margin-top: 14px; }

/* ------------------------------------------------------------- Detail page */
.detail-media { position: relative; width: 100%; aspect-ratio: 1 / 1; padding: 0; border: 0; background: var(--factory-ivory); overflow: hidden; }
.detail-media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.detail-thumbs { display: flex; gap: 10px; margin-top: 12px; overflow-x: auto; }
.detail-thumbs img { width: 60px; height: 60px; padding: 0; object-fit: cover; background: var(--factory-ivory); border: 0; cursor: pointer; opacity: .7; }
.detail-thumbs img.active { opacity: 1; outline: 2px solid var(--factory-gold); outline-offset: -2px; }
.detail-title { font-size: var(--fs-h1); font-weight: 400; margin: 0 0 6px; }
.detail-price-row { display: flex; align-items: baseline; gap: 10px; }
.detail-price { font-family: var(--font-serif); font-size: 26px; font-weight: 400; color: var(--accent); }
.detail-tags { display: flex; gap: 6px; flex-wrap: wrap; margin: 10px 0; }
.seller-card { display: flex; align-items: center; gap: 10px; padding: 14px; border: 1px solid var(--line); background: transparent; }
.seller-card .btn-xs { border: 0; }
.seller-card .btn-xs:hover { border-color: transparent; }
.avatar { width: 40px; height: 40px; border: 1px solid var(--line-strong); background: transparent; color: var(--text); display: grid; place-items: center; font-family: var(--font-serif); font-weight: 400; font-size: var(--fs-h3); flex: none; overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.seller-name { font-weight: 500; font-size: var(--fs-body); }
.seller-sub { font-size: var(--fs-micro); color: var(--text-2); }
.detail-desc { color: var(--text-2); font-size: var(--fs-body); line-height: 1.7; }
.spec-list { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.spec-item { border: 1px solid var(--line); padding: 10px 12px; background: transparent; }
.spec-k { font-size: 9px; letter-spacing: 1px; color: var(--text-2); text-transform: uppercase; }
.spec-v { font-weight: 500; font-size: var(--fs-body); margin-top: 1px; }
.action-bar {
  position: fixed; bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px)); left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 520px; z-index: 35; padding: 10px var(--space-4);
  background: var(--surface);
  background: color-mix(in srgb, var(--surface) 96%, transparent); backdrop-filter: blur(12px);
  border-top: 1px solid var(--line); display: flex; gap: 8px; align-items: center;
}
.action-bar .btn { flex: 1; }
.action-icon { width: 46px; min-height: 44px; border: 1px solid var(--line-strong); background: transparent; color: var(--text-2); display: grid; place-items: center; flex: none; }
.action-icon.on { color: var(--accent); border-color: var(--accent); background: transparent; }
.action-icon.on .icon { fill: currentColor; }
.detail-page { padding-bottom: 96px; }
.detail-nav { display: flex; gap: 10px; margin-top: 16px; }
.detail-nav-btn {
  flex: 1; min-height: 42px; padding: 0 12px;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--factory-ivory); color: var(--factory-gold);
  border: 1px solid var(--factory-gold); font-size: 14px; letter-spacing: 1px;
}
.detail-nav-btn .icon { width: 16px; height: 16px; }
.detail-nav-btn:disabled { opacity: .35; }

/* -------------------------------------------------------------------- Forms */
.form-card { background: var(--surface); border: 1px solid var(--line); padding: var(--space-5); }
.field { margin-bottom: var(--space-5); }
.field:last-child { margin-bottom: 0; }
.field-label { display: block; font-size: 10px; font-weight: 500; letter-spacing: 1.5px; text-transform: uppercase; margin-bottom: 8px; color: var(--text-2); }
.field-label .req { color: var(--accent); }
.input, .textarea, .select {
  width: 100%; min-height: 44px; padding: 10px 2px;
  background: transparent; border: 0; border-bottom: 1px solid var(--line-strong);
  color: var(--text); font-size: var(--fs-body);
  transition: border-color .18s;
}
.input:focus, .textarea:focus, .select:focus { border-bottom-color: var(--accent); }
.input::placeholder, .textarea::placeholder { color: var(--text-3); }
.textarea { min-height: 92px; resize: vertical; }
.select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--text-2) 50%), linear-gradient(135deg, var(--text-2) 50%, transparent 50%); background-position: calc(100% - 12px) 19px, calc(100% - 7px) 19px; background-size: 5px 5px; background-repeat: no-repeat; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-4); }
.hint { font-size: 10px; letter-spacing: .5px; color: var(--text-3); margin-top: 6px; }

.upload-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.upload-tile { position: relative; aspect-ratio: 1; border-radius: var(--r-md); overflow: hidden; border: 1px solid var(--line); background: var(--surface-2); }
.upload-tile img { width: 100%; height: 100%; object-fit: cover; }
.upload-add {
  aspect-ratio: 1; border-radius: var(--r-md); border: 1.5px dashed var(--line-strong);
  background: var(--surface-2); color: var(--text-3);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; font-size: var(--fs-micro);
}
.upload-add:hover { border-color: var(--primary); color: var(--primary); }
.upload-del { position: absolute; top: 4px; right: 4px; width: 24px; height: 24px; border-radius: 50%; background: var(--overlay); color: #fff; display: grid; place-items: center; }
.upload-del .icon { width: 14px; height: 14px; }
.cover-flag { position: absolute; left: 4px; bottom: 4px; font-size: 9px; background: var(--primary); color: #fff; padding: 1px 5px; border-radius: 3px; font-weight: 700; }

/* -------------------------------------------------------------------- Lists */
.list-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
.list-row { display: flex; align-items: center; gap: 11px; padding: 12px 14px; width: 100%; text-align: left; border-bottom: 1px solid var(--line); }
.list-row:last-child { border-bottom: 0; }
.list-row:active { background: var(--surface-2); }
.list-icon { width: 36px; height: 36px; border-radius: var(--r-sm); display: grid; place-items: center; background: var(--surface-2); color: var(--primary); flex: none; }
.list-icon .icon { width: 18px; height: 18px; }
.list-body { min-width: 0; flex: 1; }
.list-title { font-weight: 650; font-size: var(--fs-body); }
.list-desc { color: var(--text-2); font-size: var(--fs-micro); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-value { color: var(--text-2); font-size: var(--fs-caption); flex: none; }
.notice-item { display: flex; gap: 10px; padding: 13px 14px; border-bottom: 1px solid var(--line); }
.notice-item:last-child { border-bottom: 0; }
.notice-item.unread { background: var(--primary-soft); }
.notice-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--primary); margin-top: 7px; flex: none; }
.notice-item.read .notice-dot { background: var(--line-strong); }
.notice-time { font-size: var(--fs-micro); color: var(--text-3); margin-top: 3px; }

.segmented { display: flex; background: transparent; border-bottom: 1px solid var(--line); gap: 0; }
.segment { flex: 1; min-height: 40px; font-size: 11px; letter-spacing: 1px; font-weight: 500; color: var(--text-2); border-bottom: 1px solid transparent; }
.segment.active { background: transparent; color: var(--text); border-bottom-color: var(--accent); box-shadow: none; }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.switch-row:last-child { border-bottom: 0; }
.switch { width: 44px; height: 25px; border-radius: var(--r-pill); background: var(--line-strong); position: relative; flex: none; transition: background .18s; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 21px; height: 21px; border-radius: 50%; background: #fff; transition: transform .18s; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.switch.on { background: var(--primary); }
.switch.on::after { transform: translateX(19px); }

/* ------------------------------------------------------------------ Profile */
.profile-hero {
  padding: var(--space-6) var(--space-5); color: var(--text);
  background: var(--surface); border: 1px solid var(--line);
  position: relative; overflow: hidden;
}
.profile-page .profile-hero::after { display: none; }
.profile-top { display: flex; align-items: center; gap: 12px; position: relative; z-index: 1; }
.profile-page .profile-top .avatar { color: var(--factory-gold); }
.profile-page .avatar { border: 0; }
.profile-name { font-size: var(--fs-h2); font-weight: 400; }
.profile-sub { font-size: 10px; letter-spacing: 1.2px; color: var(--text-2); }
.profile-stats { display: flex; margin-top: var(--space-5); position: relative; z-index: 1; }
.profile-stat { flex: 1; text-align: center; border-right: 1px solid var(--line); }
.profile-stat:last-child { border-right: 0; }
.profile-stat b { display: block; font-family: var(--font-serif); font-size: var(--fs-h2); font-weight: 400; color: var(--text); }
.profile-stat span { font-size: 9px; letter-spacing: 1px; color: var(--text-2); }

/* Profile navigation: no gray separators / no gray icon boxes */
.profile-page .list-card { border: 0; background: transparent; }
.profile-page .list-row { border-bottom: 0; }
.profile-page .list-icon { background: transparent; color: var(--factory-gold); }

.dash-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.dash-stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 11px; text-align: center; }
.dash-stat b { display: block; font-size: var(--fs-h2); color: var(--primary); font-weight: 800; }
.dash-stat span { font-size: var(--fs-micro); color: var(--text-2); }
.mine-item { display: flex; gap: 10px; padding: 11px; border-bottom: 1px solid var(--line); }
.mine-item:last-child { border-bottom: 0; }
.mine-thumb { width: 66px; height: 66px; border-radius: var(--r-sm); object-fit: cover; flex: none; }
.mine-body { flex: 1; min-width: 0; }
.mine-title { font-weight: 700; font-size: var(--fs-body); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mine-meta { font-size: var(--fs-micro); color: var(--text-2); margin: 3px 0 7px; }
.item-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* ------------------------------------------------------------ Empty / state */
.empty { text-align: center; padding: 46px 20px; color: var(--text-3); }
.empty .empty-icon { font-size: 30px; font-weight: 300; color: var(--line-strong); line-height: 1; }
.empty p { margin: 8px 0 16px; font-size: var(--fs-caption); }
.state-banner { display: flex; align-items: flex-start; gap: 9px; padding: 12px 14px; border-left: 2px solid var(--accent); background: transparent; color: var(--text-2); font-size: var(--fs-caption); line-height: 1.6; }
.state-banner .icon { width: 17px; height: 17px; margin-top: 1px; }

/* ------------------------------------------------------------ Modal & toast */
.modal-root, .sheet-root { position: relative; z-index: 100; }
.modal-backdrop {
  position: fixed; inset: 0; background: var(--overlay); z-index: 100;
  display: flex; align-items: center; justify-content: center; padding: 24px;
  animation: fadeIn .16s ease;
}
.modal {
  width: 100%; max-width: 380px; max-height: 80vh; overflow: auto;
  background: var(--surface); border: 1px solid var(--line);
  padding: var(--space-6) var(--space-5); box-shadow: var(--shadow-2);
}
.modal-title { font-size: var(--fs-h2); font-weight: 400; margin: 0 0 8px; }
.modal-desc { color: var(--text-2); font-size: var(--fs-caption); margin-bottom: var(--space-4); }
.modal-head { display: flex; align-items: center; justify-content: space-between; }
.amount-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 10px 0 16px; }
.amount-chip { border: 1px solid var(--line-strong); padding: 10px 4px; text-align: center; font-weight: 500; letter-spacing: 1px; background: transparent; }
.amount-chip.active { border-color: var(--accent); background: transparent; color: var(--accent); }
.sheet-backdrop { position: fixed; inset: 0; background: var(--overlay); z-index: 100; display: flex; align-items: flex-end; justify-content: center; }
.sheet {
  width: 100%; max-width: 520px; max-height: 82vh; overflow: auto;
  background: var(--surface);
  padding: var(--space-5) var(--space-5) calc(var(--space-6) + env(safe-area-inset-bottom, 0px));
  animation: slideUp .2s ease;
}
@keyframes slideUp { from { transform: translateY(30px); opacity: .4; } to { transform: none; opacity: 1; } }
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--space-3); }
.sheet-title { font-size: var(--fs-h2); font-weight: 400; }
.toast-root { position: fixed; top: 74px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: 92%; max-width: 420px; }
.toast {
  background: var(--text); color: var(--surface); padding: 11px 18px;
  font-size: var(--fs-caption); font-weight: 500; letter-spacing: 1px; box-shadow: none;
  animation: toastIn .2s ease; max-width: 100%; text-align: center;
}
.toast.ok { background: var(--success); color: #fff; }
.toast.warn { background: var(--danger); color: #fff; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

.qr-placeholder { width: 100%; aspect-ratio: 1; border-radius: var(--r-md); background: var(--surface-2); display: grid; place-items: center; color: var(--text-3); font-size: var(--fs-caption); text-align: center; padding: 20px; }

/* ------------------------------------------------------------------- Cart */
.cart-item { display: flex; align-items: flex-start; gap: 12px; padding: 14px; border-bottom: 1px solid var(--line); }
.cart-item:last-child { border-bottom: 0; }
.cart-item .mine-thumb { width: 64px; height: 64px; }
.cart-item .mine-body { flex: 1; min-width: 0; }
.cart-price { color: var(--accent); font-family: var(--font-serif); font-size: 15px; white-space: nowrap; }
.qty-control { display: inline-flex; align-items: center; border: 1px solid var(--line-strong); }
.qty-control button { width: 28px; height: 26px; font-size: 14px; color: var(--text-2); }
.qty-control button:hover { color: var(--accent); }
.qty-control span { min-width: 24px; text-align: center; font-size: 12px; }
.cart-summary { margin-top: var(--space-5); }
.cart-total-row { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; font-size: var(--fs-caption); color: var(--text-2); letter-spacing: 1px; }
.cart-total-row strong { color: var(--accent); font-family: var(--font-serif); font-size: 20px; font-weight: 400; letter-spacing: .5px; }

/* ------------------------------------------------------------------ Legal */
.legal-page { max-width: 760px; margin: 0 auto; }
.legal-card { border: 1px solid var(--line); background: var(--surface); padding: var(--space-6) var(--space-5); }
.legal-section { margin-bottom: var(--space-6); }
.legal-section:last-child { margin-bottom: 0; }
.legal-h {
  font-family: var(--font-serif); font-size: var(--fs-h3); font-weight: 400;
  letter-spacing: 1px; margin: 0 0 12px; padding-bottom: 8px;
  border-bottom: 1px solid var(--line); color: var(--text);
}
.legal-p { color: var(--text-2); font-size: var(--fs-caption); line-height: 1.9; margin: 0 0 10px; }
.legal-footer { margin-top: var(--space-5); }
.legal-links { display: flex; justify-content: center; align-items: center; gap: 10px; margin-top: var(--space-5); font-size: 10px; letter-spacing: 1px; color: var(--text-3); }
.legal-links button { color: var(--accent); font-size: 10px; letter-spacing: 1px; padding: 0; }
.legal-links button:hover { text-decoration: underline; }

/* ------------------------------------------------- Factory mobile feed UI */
:root {
  /* Cloudflare 官方品牌色：Tangerine #F6821F / Mango #FBAD41 */
  --factory-orange: #F6821F;
  --factory-orange-soft: #FBAD41;
  --factory-gold: #F6821F;
  --factory-ivory: #FFFFF0;
}

/* ------------------------------------------------ Pure-color UI systems */
/* 蓝色 UI */
html[data-scheme="blue"] {
  --accent: #2563EB; --accent-soft: #E8F0FE;
  --gold: #2563EB; --gold-soft: #E8F0FE;
  --factory-gold: #2563EB; --factory-orange: #2563EB; --factory-orange-soft: #7EA6F5;
  --primary: #2563EB; --primary-hover: #1D4ED8; --primary-2: #5B8DEF; --primary-contrast: #FFFFFF;
  --primary-soft: #E8F0FE;
}
html[data-scheme="blue"]:not([data-theme="night"]) {
  --bg: #F7FAFF; --bg-deep: #F7FAFF; --surface: #F7FAFF; --surface-2: #EEF4FF; --surface-3: #E4EDFC;
  --factory-ivory: #F4F8FF; --line: #D9E5F6; --line-strong: #B7CDEF;
}
html[data-scheme="blue"][data-theme="night"] { --primary-soft: #1E2E4A; }
/* 青色 UI */
html[data-scheme="cyan"] {
  --accent: #0891B2; --accent-soft: #E0F4F8;
  --gold: #0891B2; --gold-soft: #E0F4F8;
  --factory-gold: #0891B2; --factory-orange: #0891B2; --factory-orange-soft: #5FC0D6;
  --primary: #0891B2; --primary-hover: #075985; --primary-2: #4BB3C9; --primary-contrast: #FFFFFF;
  --primary-soft: #E0F4F8;
}
html[data-scheme="cyan"]:not([data-theme="night"]) {
  --bg: #F5FBFD; --bg-deep: #F5FBFD; --surface: #F5FBFD; --surface-2: #E8F6FA; --surface-3: #D8EEF4;
  --factory-ivory: #F1FAFC; --line: #D3EAF0; --line-strong: #A9D8E2;
}
html[data-scheme="cyan"][data-theme="night"] { --primary-soft: #123039; }
/* 紫色 UI */
html[data-scheme="purple"] {
  --accent: #7C3AED; --accent-soft: #F0E9FE;
  --gold: #7C3AED; --gold-soft: #F0E9FE;
  --factory-gold: #7C3AED; --factory-orange: #7C3AED; --factory-orange-soft: #AC8BF3;
  --primary: #7C3AED; --primary-hover: #5B21B6; --primary-2: #9D6BF0; --primary-contrast: #FFFFFF;
  --primary-soft: #F0E9FE;
}
html[data-scheme="purple"]:not([data-theme="night"]) {
  --bg: #FBF8FF; --bg-deep: #FBF8FF; --surface: #FBF8FF; --surface-2: #F3ECFD; --surface-3: #E9DDFA;
  --factory-ivory: #F9F5FF; --line: #E6DAF7; --line-strong: #CFB9EE;
}
html[data-scheme="purple"][data-theme="night"] { --primary-soft: #2E1F45; }

/* ------------------------------------------------ Color palettes (6 modes) */
/* 颜色模式叠加在暖色/夜间之上；UI 系统(scheme)优先级更高，纯色系统直接覆盖 accent。 */
html[data-palette="academic"] {
  --accent: #8B2E2E; --accent-soft: #F3E4E4;
  --gold: #8B2E2E; --gold-soft: #F3E4E4;
  --factory-gold: #8B2E2E; --factory-orange: #8B2E2E;
}
html[data-palette="tech"] {
  --accent: #0E7490; --accent-soft: #DCF3F8;
  --gold: #0E7490; --gold-soft: #DCF3F8;
  --factory-gold: #0E7490; --factory-orange: #0E7490;
}
html[data-palette="art"] {
  --accent: #BE185D; --accent-soft: #FCE4EF;
  --gold: #BE185D; --gold-soft: #FCE4EF;
  --factory-gold: #BE185D; --factory-orange: #BE185D;
}
html[data-palette="nature"] {
  --accent: #3F7D58; --accent-soft: #E3F0E8;
  --gold: #3F7D58; --gold-soft: #E3F0E8;
  --factory-gold: #3F7D58; --factory-orange: #3F7D58;
}
html[data-palette="ink"] {
  --accent: #2B241F; --accent-soft: #E9E5E0;
  --gold: #2B241F; --gold-soft: #E9E5E0;
  --factory-gold: #2B241F; --factory-orange: #2B241F;
}
html[data-palette="ink"][data-theme="night"] {
  --accent: #D8D2CB; --accent-soft: #2E2925;
  --gold: #D8D2CB; --gold-soft: #2E2925;
  --factory-gold: #D8D2CB; --factory-orange: #D8D2CB;
}
/* 纯色 UI 系统优先于颜色模式：scheme 定义在下方，覆盖 palette */

/* 外观：主题模式 tab + 颜色模式卡 + UI 系统卡 */
.theme-tabs { display: flex; gap: 24px; border-bottom: 1px solid var(--line-strong); }
.theme-tab { padding: 0 0 8px; border: 0; border-bottom: 2px solid transparent; background: transparent; color: var(--text-2); font-size: 11px; cursor: pointer; }
.theme-tab.active { color: var(--text); border-bottom-color: var(--accent); }
.palette-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
@media (max-width: 720px) { .palette-grid { grid-template-columns: repeat(3, 1fr); } }
.palette-item {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 12px 4px; background: var(--surface); border: 1px solid var(--line-strong);
  color: var(--text-2); font-size: 11px; cursor: pointer;
}
.palette-item.active { border-color: var(--accent); color: var(--accent); }
.palette-swatch { width: 28px; height: 28px; border: 1px solid var(--line-strong); border-radius: 50%; display: grid; place-items: center; overflow: hidden; }
.palette-item.active .palette-swatch { outline: 2px solid var(--accent); outline-offset: 2px; }
.palette-swatch.default { background: conic-gradient(#D8561F 0 50%, #FFFDFA 50% 100%); }
.palette-swatch.academic { background: conic-gradient(#8B2E2E 0 50%, #F3E4E4 50% 100%); }
.palette-swatch.tech { background: conic-gradient(#0E7490 0 50%, #DCF3F8 50% 100%); }
.palette-swatch.art { background: conic-gradient(#BE185D 0 50%, #FCE4EF 50% 100%); }
.palette-swatch.nature { background: conic-gradient(#3F7D58 0 50%, #E3F0E8 50% 100%); }
.palette-swatch.ink { background: conic-gradient(#2B241F 0 50%, #E9E5E0 50% 100%); }

/* UI 系统色块 */
.scheme-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.scheme-item {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 10px 4px; background: var(--surface); border: 1px solid var(--line-strong);
  color: var(--text-2); font-size: 11px;
}
.scheme-item.active { border-color: var(--accent); color: var(--accent); }
.scheme-swatch { width: 26px; height: 26px; border: 1px solid var(--line-strong); border-radius: 50%; }
.scheme-item.active .scheme-swatch { outline: 2px solid var(--accent); outline-offset: 2px; }
.scheme-swatch.auto { background: linear-gradient(135deg, #F6821F 50%, #2B241F 50%); }
.scheme-swatch.blue { background: #2563EB; }
.scheme-swatch.cyan { background: #0891B2; }
.scheme-swatch.purple { background: #7C3AED; }

/* -------------------------------------------------------------- Responsive */
@media (min-width: 900px) {
  :root { --fs-display: 38px; --fs-h1: 26px; --fs-h2: 20px; }
  .app-shell { max-width: 1080px; }
  .tabbar { max-width: 1080px; }
  .page { padding: 40px 48px; }
  .product-grid { grid-template-columns: repeat(4, minmax(0,1fr)); gap: 24px; }
  .home-grid { display: grid; grid-template-columns: 1.5fr 1fr; gap: 48px; align-items: start; }
  .home-grid .product-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .latest-card { gap: 20px; padding: 18px; }
  .latest-media { width: 132px; height: 132px; padding: 12px; }
  .header-inner { padding: 0 48px; }
  .search-box { display: flex; width: 260px; }
  .hero { min-height: 230px; }
  .action-bar { max-width: 1080px; }
  .sheet { max-width: 1080px; }
  .detail-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; }
  .auction-list { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 24px; padding: 0; }
  .auction-hero, .auction-tabs { padding-left: 0; padding-right: 0; }
  .auction-detail-media { max-width: 560px; }
  .feed-page { display: none; }
  .classify-page { display: none; }
  .header-title { display: none; }
  .mobile-home-extra { display: none; }
  .desktop-home, .desktop-explore { display: block; }
}
@media (min-width: 600px) and (max-width: 899px) {
  .app-shell { max-width: 720px; }
  .tabbar { max-width: 720px; }
  .search-box { display: flex; width: 200px; }
  .action-bar { max-width: 720px; }
  .sheet { max-width: 720px; }
}
@media (max-width: 899px) {
  .desktop-home, .desktop-explore { display: none !important; }
  .mobile-home-extra { padding-top: 0; }

  /* Factory ivory search header */
  .app-header {
    height: auto; min-height: 0;
    background: var(--factory-ivory); border-bottom: 0;
    backdrop-filter: none;
  }
  .fb-topbar { display: flex; }
  .header-inner {
    height: 58px; padding: 10px 12px; gap: 8px; flex-wrap: nowrap;
    display: grid; grid-template-columns: auto 1fr auto; align-items: center;
    transition: height .3s cubic-bezier(.4, 0, .2, 1), padding .3s cubic-bezier(.4, 0, .2, 1), opacity .24s ease;
    overflow: hidden; will-change: height;
  }
  .app-header.topbar-hidden .header-inner,
  .app-header.hide-search-row .header-inner {
    height: 0; padding-top: 0; padding-bottom: 0; opacity: 0;
  }
  .header-inner .brand { display: none; }
  .header-inner .header-back { grid-column: 1; margin-left: 0; color: var(--factory-gold); }
  .header-inner .header-actions { grid-column: 2 / 4; margin-left: 0; width: 100%; }
  .header-inner:not(:has(.header-back:not([hidden]))) .header-actions { grid-column: 1 / 4; }
  .header-actions .icon-btn { display: none; }
  .header-actions .search-box {
    display: flex !important; width: 100%;
    height: 38px; padding: 0 12px; gap: 8px;
    background: transparent; border: 1px solid var(--factory-gold);
    border-radius: 0;
  }
  .header-actions .search-box .icon { color: var(--factory-gold); width: 16px; height: 16px; }
  .header-actions .search-box input { font-size: 14px; color: var(--text); }
  .header-actions .search-box input::placeholder { color: var(--factory-gold); opacity: .8; }

  /* Classify page: ivory title bar */
  .header-title { display: none; }
  .app-header.is-classify .header-inner { display: flex; justify-content: center; }
  .app-header.is-classify .header-title {
    display: block; color: var(--factory-gold); font-size: 20px; font-weight: 700;
    letter-spacing: 1px; text-align: center;
  }
  .app-header.is-classify .header-actions { display: none; }

  .feed-page { padding: 0; }

  /* Feed tabs — thin gold outline */
  .feed-tabs {
    display: flex; gap: 6px; padding: 10px;
    background: var(--factory-ivory); border: 0;
  }
  .feed-tab {
    flex: 1; min-height: 36px; padding: 0 2px;
    font-size: 14px; color: var(--text-2); text-align: center;
    background: var(--factory-ivory); border: 1px solid var(--factory-gold);
  }
  .feed-tab.active {
    background: var(--gold-soft); color: var(--factory-gold); font-weight: 600;
  }

  /* Category chips under tabs */
  .feed-cats {
    padding: 10px 8px; border-bottom: 1px solid var(--line);
    background: var(--factory-ivory);
  }
  .feed-cats .cat-chip { min-width: 52px; font-size: 11px; }
  .feed-cats .cat-icon { width: 28px; height: 28px; font-size: 15px; }

  /* Factory product card: frameless full-bleed image (facebook-like) */
  .feed-list { display: flex; flex-direction: column; gap: 10px; padding: 0; }
  .feed-card {
    background: var(--factory-ivory); border: 0;
    overflow: hidden; cursor: pointer;
  }
  .feed-media {
    width: 100%; aspect-ratio: 1 / 1; padding: 0;
    background: var(--factory-ivory); overflow: hidden;
  }
  .feed-media img { width: 100%; height: 100%; object-fit: cover; display: block; }
  .feed-body { padding: 14px 14px 16px; }
  .feed-title {
    font-size: 19px; font-weight: 500; line-height: 1.4;
    color: var(--text); margin: 0 0 10px; letter-spacing: .5px;
  }
  .feed-bottom { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
  .feed-price {
    color: var(--factory-gold); font-family: var(--font-serif);
    font-size: 22px; font-weight: 600; letter-spacing: .5px;
  }
  .feed-buy {
    background: var(--factory-ivory); color: var(--factory-gold);
    border: 1px solid var(--factory-gold);
    min-height: 40px; padding: 0 24px; font-size: 15px; font-weight: 500;
    letter-spacing: 1px; flex: none;
  }
  .feed-buy:disabled { opacity: .5; }
  .feed-likes { color: var(--text-3); font-size: 12px; margin-top: 10px; }

  /* Detail page buy button factory gold */
  .action-bar .btn-primary {
    background: var(--factory-gold); border-color: var(--factory-gold); color: #fff;
  }
  .detail-price { color: var(--factory-gold); }

  /* Follow button: borderless, gold filled / gold text */
  .seller-card .btn-xs.btn-primary { background: var(--factory-gold); color: #fff; }
  .seller-card .btn-xs.btn-outline { background: transparent; color: var(--factory-gold); }

  /* Product / latest grid full-width big images */
  .product-grid { grid-template-columns: 1fr; gap: var(--space-6); }
  .product-card .product-media { aspect-ratio: 1 / 1; padding: 30px; }
  .product-card .product-media::after { inset: 16px; }
  .product-body { padding: 18px 18px 22px; }
  .product-title { font-size: 17px; height: auto; }
  .product-grid .price { font-size: 20px; }
  .latest-card { flex-direction: column; gap: 0; padding: 0; }
  .latest-media { width: 100%; height: auto; aspect-ratio: 1 / 1; padding: 30px; border: 0; border-bottom: 1px solid var(--line); }
  .latest-media::after { inset: 16px; }
  .latest-body { padding: 18px; }
  .latest-title { font-size: 17px; }
  .latest-meta .price { font-size: 20px; }

  /* Classify page: search bar + horizontal category tabs + two-column grid */
  .classify-page { padding: 0; }
  .classify-searchbar {
    display: flex; align-items: center; gap: 8px;
    margin: 10px 12px; padding: 0 12px; height: 40px;
    background: var(--factory-ivory); border: 1px solid var(--factory-gold);
  }
  .classify-searchbar .icon { color: var(--factory-gold); width: 17px; height: 17px; }
  .classify-searchbar input { flex: 1; min-width: 0; border: 0; font-size: 14px; color: var(--text); }
  .classify-searchbar input::placeholder { color: var(--factory-gold); opacity: .8; }

  .classify-tabs {
    display: flex; gap: 6px; padding: 0 10px 10px;
  }
  .classify-tab {
    flex: 1; min-width: 0; padding: 7px 4px;
    font-size: 13px; color: var(--text-2); text-align: center;
    background: var(--factory-ivory); border: 1px solid var(--factory-gold);
  }
  .classify-tab.active {
    background: var(--gold-soft); color: var(--factory-gold); font-weight: 600;
  }
  .classify-main { min-width: 0; padding: 0 10px 10px; }
  .classify-grid {
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px;
  }
  .classify-card { cursor: pointer; min-width: 0; }
  .classify-media {
    width: 100%; aspect-ratio: 1 / 1; padding: 0;
    background: var(--factory-ivory); border: 0; overflow: hidden;
  }
  .classify-media img { width: 100%; height: 100%; object-fit: cover; display: block; }
  .classify-name {
    margin-top: 8px; font-size: 13px; color: var(--text);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .classify-price {
    margin-top: 4px; color: var(--factory-gold);
    font-size: 15px; font-weight: 700; letter-spacing: .3px;
  }

  /* Factory four-item tabbar */
  .tabbar { height: calc(58px + env(safe-area-inset-bottom, 0px)); }
  .tabbar .tab { font-size: 11px; letter-spacing: 0; gap: 3px; }
  .tabbar .tab .icon { width: 22px; height: 22px; }
  .tabbar .tab.active { color: var(--factory-gold); }
  .tabbar .tab.active::before { display: none; }
}
