:root {
  --bg: #0b0d10;
  --panel: #14181f;
  --line: #232a35;
  --text: #e8eaed;
  --dim: #8b93a1;
  --gold: #e8eaed;      /* 不再用金色：统一黑白灰 */
  --green: #c9cdd4;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, -apple-system, sans-serif;
}

/* ── 顶栏 ── */
.top {
  position: sticky;
  top: 0;
  z-index: 20;
  padding: 12px 22px 10px;
  background: rgba(11, 13, 16, .94);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.brand { font-size: 17px; font-weight: 700; letter-spacing: .4px; margin-right: 6px; white-space: nowrap; }

/* Telegram 里顶部已经有应用名，页面里就别重复了 */
.in-tg .brand { display: none; }

.bar input, .bar select {
  height: 38px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  padding: 0 12px;
  font-size: 14px;
  outline: none;
}
.bar input { flex: 1; min-width: 150px; }
.bar select { max-width: 200px; }
.bar input:focus, .bar select:focus { border-color: #3b4657; }

button {
  height: 38px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: var(--gold);
  color: #111111;
  font-size: 14px;
  font-weight: 700;
  padding: 0 16px;
  cursor: pointer;
}
button:hover { filter: brightness(1.05); }
button:disabled { opacity: .5; cursor: default; }
button.ghost { background: transparent; color: var(--text); border-color: var(--line); }
a.ghost {
  display: inline-flex;
  align-items: center;
  height: 38px;
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  color: var(--text);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
}
a.ghost:hover { border-color: #3b4657; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.chips button {
  height: 30px;
  padding: 0 12px;
  font-size: 13px;
  font-weight: 500;
  background: transparent;
  color: var(--dim);
  border: 1px solid var(--line);
  border-radius: 999px;
}
.chips button.on { background: rgba(232, 234, 237, .10); color: var(--text); border-color: var(--text); }

.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; }

/* 小而精致的筛选钮：礼物 / 模型 / 背景 */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 32px;
  max-width: 240px;
  padding: 0 13px;
  border-radius: 999px;
  border: 1px solid #2a3341;
  background: #171c24;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
}
.pill::after {
  content: "";
  flex: 0 0 auto;
  width: 5px;
  height: 5px;
  margin-top: -3px;
  border-right: 1.5px solid var(--dim);
  border-bottom: 1.5px solid var(--dim);
  transform: rotate(45deg);
  transition: transform .15s ease;
}
.pill.open { border-color: #59657a; background: #1c222b; }
.pill.open::after { transform: rotate(-135deg); }
.pill.on { border-color: #6a768b; background: rgba(232, 234, 237, .07); }
.pill .pill-txt { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pill.off { opacity: .4; }
.pill.clear { padding: 0 12px; background: transparent; color: var(--dim); font-weight: 500; }
.pill.clear::after { display: none; }

/* 下拉面板：跟页面同一个深色系，点外面/再点按钮都能收回 */
.filter-pop {
  position: fixed;
  z-index: 45;
  display: flex;
  flex-direction: column;
  width: min(250px, calc(100vw - 24px));
  max-height: min(320px, 60vh);
  overflow: hidden;
  padding: 6px;
  border-radius: 14px;
  border: 1px solid #2b3442;
  background: #151a21;
  box-shadow: 0 18px 46px rgba(0, 0, 0, .6);
}
.filter-search {
  flex: 0 0 auto;
  width: calc(100% - 4px);
  height: 32px;
  margin: 2px 2px 6px;
  padding: 0 10px;
  border-radius: 9px;
  border: 1px solid #2b3442;
  background: #0f1319;
  color: var(--text);
  font-size: 13px;
  outline: none;
}
.filter-search::placeholder { color: var(--dim); }
.filter-search:focus { border-color: #3b4657; }
.filter-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}
.filter-pop .opt {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 9px;
  width: 100%;
  height: 36px;
  padding: 0 8px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  text-align: left;
  white-space: nowrap;
}
.filter-pop .opt:hover { background: #1e2631; }
.filter-pop .opt .opt-pic {
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  border-radius: 7px;
  background: #0e1218;
  object-fit: contain;
}
.filter-pop .opt .opt-空 {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--dim);
}
.filter-pop .opt .opt-swatch {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, .18);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .25);
}
.filter-pop .opt .名 {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.filter-pop .opt.sel { background: rgba(232, 234, 237, .1); }
.filter-pop .opt.sel .名::before { content: "✓ "; }
.filter-pop .pop-empty { padding: 10px; color: var(--dim); font-size: 12px; text-align: center; }

.小按钮 { height: 32px; font-size: 13px; padding: 0 12px; border-radius: 999px; }

.meta {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-top: 10px;
  font-size: 13px;
  color: var(--dim);
}

/* ── 货架 ── */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(158px, 1fr));
  gap: 14px;
  padding: 18px 22px 8px;
}

.card {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 8px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--panel);
  cursor: pointer;
  text-align: left;
  transition: transform .12s ease, border-color .12s ease;
  user-select: none;
}
.card:hover { transform: translateY(-2px); border-color: #3c4759; }
.card:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

.pic {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 10px;
  background: #0e1218;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.pic img {
  width: 100%;
  height: 100%;
  object-fit: contain;   /* ★ 完整显示，不裁掉礼物 */
  display: block;
}

.price { font-size: 19px; font-weight: 800; color: var(--gold); line-height: 1.1; }
.price span { font-size: 12px; font-weight: 600; color: var(--dim); }

.name {
  font-size: 12px;
  color: var(--dim);
  line-height: 1.3;
  height: 16px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.add {
  width: 100%;
  height: 32px;
  padding: 0 8px;
  border-radius: 9px;
  font-size: 12.5px;
  font-weight: 600;
  background: #1d2530;
  color: var(--gold);
  border: 1px solid var(--line);
  white-space: nowrap;
}
.add:hover { border-color: var(--gold); }
.add.in {
  background: rgba(232, 234, 237, .08);
  color: var(--text);
  border-color: var(--text);
}

.more { text-align: center; padding: 14px 0 30px; }
.empty { text-align: center; color: var(--dim); padding: 40px 0 80px; }
.hidden { display: none !important; }

/* ── 商品弹窗 ── */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .66);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 50;
}
.sheet {
  width: min(420px, 100%);
  max-height: 92vh;
  overflow-y: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 18px;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.m-pic {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 14px;
  background: #0e1218;
  overflow: hidden;
}
.m-pic img { width: 100%; height: 100%; object-fit: contain; display: block; }
.x {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 34px;
  height: 34px;
  padding: 0;
  background: rgba(0, 0, 0, .5);
  color: #fff;
  border: none;
  font-size: 15px;
}
.m-name { color: var(--dim); font-size: 13px; }
.m-price { font-size: 28px; font-weight: 800; color: var(--gold); line-height: 1.1; }
.m-price span { font-size: 14px; color: var(--dim); }
.m-hint { font-size: 12px; color: var(--dim); }
.m-actions { display: flex; gap: 10px; }
.m-actions button { flex: 1; }

/* ── 购物车 ── */
.cart-btn {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 40;
  height: 50px;
  border-radius: 999px;
  padding: 0 20px;
  font-size: 15px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .45);
}

.cart {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(400px, 100%);
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 18px;
  background: var(--panel);
  border-left: 1px solid var(--line);
  overflow-y: auto;
}
.cart-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 17px;
  font-weight: 700;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line);
}
.cart-head .x { position: static; }
.cart-items { display: flex; flex-direction: column; gap: 12px; }
.cart-item {
  display: grid;
  grid-template-columns: 56px 1fr 32px;
  gap: 10px;
  align-items: center;
}
.cart-item .thumb {
  width: 56px;
  height: 56px;
  border-radius: 10px;
  background: #0e1218;
  overflow: hidden;
}
.cart-item .thumb img { width: 100%; height: 100%; object-fit: contain; display: block; }
.cart-name { font-size: 13px; color: var(--text); }
.cart-price { font-size: 14px; font-weight: 700; color: var(--gold); margin-top: 3px; }
.cart-del {
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--dim);
  border: 1px solid var(--line);
  font-size: 12px;
}

.cart-total {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 12px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  font-size: 14px;
  color: var(--dim);
}
.cart-total b { font-size: 26px; color: var(--gold); }

.cart input {
  height: 42px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #0e1218;
  color: var(--text);
  padding: 0 12px;
  font-size: 14px;
  outline: none;
}
.cart input:focus { border-color: #3b4657; }
.cart-id { font-size: 12px; color: var(--dim); padding: 0 2px; }
.cart-id b { color: var(--text); font-weight: 600; }
.cart-hint { font-size: 12px; color: var(--dim); }

.msg { font-size: 13px; color: var(--green); min-height: 18px; }
.msg.bad { color: #fca5a5; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 92px;
  transform: translateX(-50%);
  z-index: 80;
  padding: 10px 18px;
  border-radius: 12px;
  background: #1d2430;
  border: 1px solid #3a4a5e;
  font-size: 14px;
  max-width: 90vw;
}
.toast.bad { border-color: #7f3a3a; color: #fca5a5; }

/* ── 下单成功弹窗 ── */
.p-title { font-size: 16px; font-weight: 700; }
.p-amount { font-size: 32px; font-weight: 800; color: var(--gold); line-height: 1.1; }
.p-hint { font-size: 12px; color: var(--dim); }
.p-id { font-size: 13px; color: var(--dim); }
.p-contact {
  padding: 12px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  font-size: 15px;
}
.p-contact a { color: var(--gold); font-weight: 700; text-decoration: none; }
.p-contact a:hover { text-decoration: underline; }

/* ── 我的订单 ── */
.mo-list { display: flex; flex-direction: column; gap: 10px; }
.mo-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
}
.mo-id { font-size: 14px; }
.mo-state { font-size: 12px; margin-top: 4px; color: var(--dim); }
.mo-state.待处理 { color: var(--gold); }
.mo-state.已付款 { color: var(--green); }
.mo-actions { display: flex; gap: 8px; align-items: center; }
.mo-actions button { height: 32px; font-size: 13px; padding: 0 10px; }
.mo-contact { font-size: 12px; color: var(--text); text-decoration: none; white-space: nowrap; }
.mo-contact:hover { text-decoration: underline; }

@media (max-width: 620px) {
  .top { padding: 10px 12px; }
  .grid { padding: 12px; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(136px, 1fr)); }

  /* 手机：一行放下 */
  .bar { flex-wrap: wrap; gap: 8px; }
  .brand { display: none; }
  .bar select { max-width: 120px; flex: 0 0 auto; }
  .bar button.ghost { padding: 0 10px; font-size: 13px; }
  a.ghost { padding: 0 10px; font-size: 13px; }

  .chips { flex-wrap: nowrap; overflow-x: auto; gap: 8px; padding-bottom: 4px; }
  .chips button { flex: 0 0 auto; }

  .filters { flex-wrap: nowrap; gap: 8px; overflow-x: auto; padding-bottom: 2px; }
  .pill { max-width: 46vw; flex: 0 0 auto; }
  .pill.clear { max-width: none; }
}
