:root {
  --bg: #f6f2ec;
  --card: #ffffff;
  --ink: #221e1a;
  --muted: #7a7168;
  --line: #e6dfd5;
  --accent: #b4532a;      /* 卖得好 */
  --accent-bg: #fbe9df;
  --cold: #55677a;        /* 卖不动 */
  --cold-bg: #e8edf2;
  --new: #2f7a4f;
  --new-bg: #e2f1e7;
  --heart: #d6336c;
  --photo: #ece7df;
  --radius: 14px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: light;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.4;
  -webkit-text-size-adjust: 100%;
}
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; padding: 0; }
a { color: inherit; }
img { display: block; max-width: 100%; }

/* 顶部 */
.top {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  padding: calc(8px + var(--safe-t)) 12px 8px;
  border-bottom: 1px solid var(--line);
}
.title-row { display: flex; align-items: baseline; justify-content: space-between; margin: 0 2px 8px; }
.title-row h1 { font-size: 19px; margin: 0; letter-spacing: .5px; }
.title-row .updated { font-size: 12px; color: var(--muted); }
.scopes { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; background: #ebe4da; border-radius: 12px; padding: 3px; }
.scopes button { padding: 9px 0; border-radius: 9px; font-size: 15px; font-weight: 600; color: var(--muted); }
.scopes button.on { background: var(--card); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.08); }

.bar { display: flex; gap: 8px; padding: 10px 12px 0; overflow-x: auto; scrollbar-width: none; }
.bar::-webkit-scrollbar { display: none; }
.chip {
  flex: none; padding: 7px 13px; border-radius: 999px; background: var(--card); border: 1px solid var(--line);
  font-size: 14px; white-space: nowrap; color: var(--ink);
}
.chip.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.chip .n { color: var(--muted); margin-left: 3px; font-size: 12px; }
.chip.on .n { color: #d9d2c8; }
.sortrow { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px 2px; font-size: 13px; color: var(--muted); }
.seg { display: inline-flex; background: #ebe4da; border-radius: 9px; padding: 2px; }
.seg button { padding: 6px 11px; border-radius: 7px; font-size: 13px; color: var(--muted); }
.seg button.on { background: var(--card); color: var(--ink); font-weight: 600; }

/* 上次看完之后 */
.news {
  margin: 10px 12px 0; padding: 12px 14px; border-radius: var(--radius); background: var(--new-bg);
  border: 1px solid #c9e4d1;
}
.news .h { font-weight: 700; color: var(--new); margin-bottom: 6px; font-size: 15px; }
.news .types { display: flex; flex-wrap: wrap; gap: 6px 12px; font-size: 14px; }
.news .types b { font-size: 16px; }
.news .go { margin-top: 10px; display: inline-block; padding: 7px 14px; border-radius: 999px; background: var(--new); color: #fff; font-size: 14px; font-weight: 600; }
.news.quiet { background: var(--card); border-color: var(--line); color: var(--muted); font-size: 14px; }
.filter-note { margin: 10px 12px 0; display: flex; align-items: center; justify-content: space-between; font-size: 14px; color: var(--ink); }
.filter-note button { color: var(--accent); font-weight: 600; }

/* 款式墙 */
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 12px 10px calc(96px + var(--safe-b)); }
.card { background: var(--card); border-radius: var(--radius); overflow: hidden; position: relative; box-shadow: 0 1px 2px rgba(0,0,0,.04); }
.card .ph { position: relative; aspect-ratio: 3 / 4; background: var(--photo); }
.card .ph img { width: 100%; height: 100%; object-fit: cover; }
.card .badges { position: absolute; left: 6px; top: 6px; display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.badge { font-size: 12px; font-weight: 700; padding: 3px 7px; border-radius: 6px; background: rgba(255,255,255,.92); }
.badge.hot { color: var(--accent); }
.badge.new { color: #fff; background: var(--new); }
.badge.cold { color: var(--cold); }
.heart {
  position: absolute; right: 4px; top: 4px; width: 40px; height: 40px; display: grid; place-items: center;
  font-size: 22px; line-height: 1; filter: drop-shadow(0 1px 2px rgba(0,0,0,.25));
}
.card .info { padding: 8px 9px 10px; }
.card .brand { font-size: 12px; color: var(--muted); display: flex; justify-content: space-between; gap: 6px; }
.card .name { font-size: 13px; margin: 2px 0 4px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; text-transform: capitalize; }
.price { font-weight: 700; font-size: 15px; }
.price s { color: var(--muted); font-weight: 400; font-size: 12px; margin-left: 4px; }
.dots { display: flex; flex-wrap: wrap; align-items: center; gap: 3px 6px; margin-top: 6px; font-size: 12px; color: var(--ink); }
.dot { width: 12px; height: 12px; border-radius: 50%; border: 1px solid rgba(0,0,0,.18); display: inline-block; vertical-align: -2px; margin-right: 3px; }
.dot.pattern { background: conic-gradient(#d9534f 0 25%, #f0ad4e 0 50%, #5bc0de 0 75%, #5cb85c 0); }
.tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.tag { font-size: 11.5px; padding: 2px 6px; border-radius: 5px; background: #f2ede6; color: var(--ink); }
.tag.hot { background: var(--accent-bg); color: var(--accent); font-weight: 600; }
.tag.cold { background: var(--cold-bg); color: var(--cold); }
.tag.fab { background: #efe9df; color: #6b5a45; }
.tag.news { background: var(--new-bg); color: var(--new); font-weight: 600; }
.empty { padding: 50px 24px; text-align: center; color: var(--muted); }
.more { grid-column: 1 / -1; padding: 14px; text-align: center; }
.more button { padding: 10px 20px; border-radius: 999px; background: var(--card); border: 1px solid var(--line); font-weight: 600; }

/* 底部 */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: grid; grid-template-columns: repeat(3, 1fr);
  background: color-mix(in srgb, var(--card) 95%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-top: 1px solid var(--line); padding-bottom: var(--safe-b);
}
.tabs button { padding: 10px 0 9px; font-size: 13px; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 2px; }
.tabs button .i { font-size: 22px; line-height: 1; }
.tabs button.on { color: var(--ink); font-weight: 700; }

/* 颜色排行 / 汇总 */
.panel { padding: 12px 12px calc(96px + var(--safe-b)); }
.sec { background: var(--card); border-radius: var(--radius); padding: 14px; margin-bottom: 12px; }
.sec h2 { font-size: 16px; margin: 0 0 4px; }
.sec .sub { font-size: 12.5px; color: var(--muted); margin-bottom: 10px; }
.rank { list-style: none; margin: 0; padding: 0; }
.rank li { display: grid; grid-template-columns: 22px 26px 1fr auto; align-items: center; gap: 8px; padding: 9px 0; border-top: 1px solid #f1ece5; }
.rank li:first-child { border-top: 0; }
.rank .no { color: var(--muted); font-size: 13px; text-align: right; }
.rank .sw { width: 24px; height: 24px; border-radius: 7px; border: 1px solid rgba(0,0,0,.15); }
.rank .nm { font-weight: 600; font-size: 15px; }
.rank .barw { height: 6px; background: #f1ece5; border-radius: 3px; margin-top: 5px; overflow: hidden; }
.rank .barw i { display: block; height: 100%; background: #c9b79f; border-radius: 3px; }
.rank .num { text-align: right; font-size: 13px; color: var(--muted); white-space: nowrap; }
.rank .num b { color: var(--ink); font-size: 15px; }
.up { color: var(--accent); font-weight: 700; }
.down { color: var(--cold); font-weight: 700; }
.rank li.tap { cursor: pointer; }
.rank.simple li { grid-template-columns: 22px 1fr auto; }

/* 详情 */
.sheet { position: fixed; inset: 0; z-index: 50; background: var(--bg); overflow-y: auto; -webkit-overflow-scrolling: touch; }
.sheet .close {
  position: fixed; left: 10px; top: calc(10px + var(--safe-t)); z-index: 60; width: 42px; height: 42px; border-radius: 50%;
  background: rgba(255,255,255,.92); font-size: 22px; box-shadow: 0 1px 4px rgba(0,0,0,.15);
}
.gallery { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; background: var(--photo); scrollbar-width: none; }
.gallery::-webkit-scrollbar { display: none; }
.gallery img { flex: none; width: 100%; aspect-ratio: 3 / 4; object-fit: cover; scroll-snap-align: start; }
.gcount { text-align: center; font-size: 12px; color: var(--muted); padding: 6px 0 0; }
.dbody { padding: 10px 16px calc(40px + var(--safe-b)); }
.dbody .brand { color: var(--muted); font-size: 14px; }
.dbody h2 { font-size: 19px; margin: 2px 0 6px; text-transform: capitalize; }
.dbody .price { font-size: 20px; }
.row { margin-top: 14px; }
.row .lb { font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.colors-d { display: flex; flex-direction: column; gap: 8px; }
.colors-d .c { display: flex; align-items: flex-start; gap: 10px; background: var(--card); border-radius: 10px; padding: 9px 10px; }
.colors-d .c .dot { width: 20px; height: 20px; flex: none; margin-top: 1px; }
.colors-d .c .cn { font-weight: 600; }
.colors-d .c .raw { color: var(--muted); font-size: 12px; margin-left: 4px; }
.sizes { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 5px; }
.sz { font-size: 12px; padding: 2px 6px; border-radius: 5px; background: #eef5ef; color: #2f6a45; }
.sz.out { background: #f3eeee; color: #a39999; text-decoration: line-through; }
.sz.low { background: #fdf0e3; color: #b5651d; }
.sz.soon { background: #eef0f5; color: #6a7389; }
.btns { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 18px; }
.btn { display: flex; align-items: center; justify-content: center; gap: 6px; padding: 13px; border-radius: 12px; font-weight: 700; font-size: 15px; text-decoration: none; }
.btn.dark { background: var(--ink); color: #fff; }
.btn.light { background: var(--card); border: 1px solid var(--line); }
.btn.fav-on { color: var(--heart); border-color: #f1c2d3; background: #fff0f5; }
.small { font-size: 13px; color: var(--muted); }
.timeline { font-size: 13px; color: var(--ink); margin: 0; padding-left: 18px; }
.timeline li { margin: 3px 0; }
.desc { font-size: 13.5px; color: #4a433c; }

/* 登录 */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login form { width: 100%; max-width: 360px; background: var(--card); border-radius: 18px; padding: 26px 22px; box-shadow: 0 2px 10px rgba(0,0,0,.05); }
.login h1 { margin: 0 0 4px; font-size: 24px; }
.login p { margin: 0 0 18px; color: var(--muted); font-size: 14px; }
.login label { display: block; font-size: 14px; margin: 12px 0 6px; color: var(--muted); }
.login input { width: 100%; font-size: 17px; padding: 12px 14px; border-radius: 10px; border: 1px solid var(--line); background: #fbf9f6; }
.login button { width: 100%; margin-top: 20px; padding: 14px; border-radius: 12px; background: var(--ink); color: #fff; font-weight: 700; font-size: 17px; }
.login .err { color: #b3261e; font-size: 14px; margin-top: 10px; min-height: 20px; }

.loading { padding: 60px 0; text-align: center; color: var(--muted); }
.foot { text-align: center; color: var(--muted); font-size: 12px; padding: 4px 16px 16px; }
.foot button { color: var(--muted); text-decoration: underline; font-size: 12px; }

@media (min-width: 700px) {
  .grid { grid-template-columns: repeat(3, 1fr); max-width: 980px; margin: 0 auto; }
  .panel, .dbody { max-width: 720px; margin: 0 auto; }
  .gallery img { width: 50%; }
}
@media (min-width: 1000px) { .grid { grid-template-columns: repeat(4, 1fr); } }
