* { box-sizing: border-box; }

/* ===== 日间模式（默认，暖羊皮纸底色） ===== */
:root {
  color-scheme: light;
  --bg: #efe6d1;
  --surface: #faf5ea;
  --surface-2: #f2e9d8;
  --border: #d9c9a6;
  --gold: #a8842e;
  --gold-bright: #7c5f1e;
  --gold-deep: #c8a45c;
  --text: #3b2f1a;
  --text-dim: #7c6b4c;
  --green: #3f7a4e;
  --red: #b4553c;
  --header-bg: #f6eeda;
  --hint-bg: #f1e6c8;
  --code-bg: #e9dab2;
  --thumb-bg: #e6d9b8;
  --ok-bg: #e2efe3;
  --ok-border: #a9c9a8;
  --err-bg: #f5e3dd;
  --err-border: #d9a89a;
  --err-text: #b4553c;
  --card-shadow: 0 8px 20px rgba(90, 70, 30, 0.18);
}

/* ===== 夜间模式（点击按钮切换） ===== */
:root.theme-dark {
  color-scheme: dark;
  --bg: #14110d;
  --surface: #1e1a14;
  --surface-2: #27211a;
  --border: #38302a;
  --gold: #c9a86a;
  --gold-bright: #e0c890;
  --gold-deep: #8a6d3b;
  --text: #e9e1d2;
  --text-dim: #a3967f;
  --green: #7fae8a;
  --red: #d07a67;
  --header-bg: #0f0d0a;
  --hint-bg: #2a241a;
  --code-bg: #3a3220;
  --thumb-bg: #0f0d0a;
  --ok-bg: #1c2a20;
  --ok-border: #3a5a44;
  --err-bg: #2f1d1a;
  --err-border: #6a3a30;
  --err-text: #e09a88;
  --card-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

html { background: var(--bg); }

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

header {
  background: var(--header-bg);
  color: var(--text);
  padding: 14px 24px;
  display: flex;
  align-items: center;
  gap: 24px;
  border-bottom: 1px solid var(--gold-deep);
}

.theme-toggle {
  background: var(--surface-2);
  color: var(--gold);
  border: 1px solid var(--gold-deep);
  padding: 5px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
}
.theme-toggle:hover { background: var(--hint-bg); color: var(--gold-bright); }

header h1 {
  font-family: Georgia, "Noto Serif SC", "Songti SC", "SimSun", serif;
  font-size: 20px;
  margin: 0;
  color: var(--gold-bright);
  letter-spacing: 1px;
  font-weight: 700;
}

header h1 .brand-mark {
  color: var(--gold);
  font-size: 15px;
  margin-right: 8px;
}

header nav a {
  color: var(--text-dim);
  text-decoration: none;
  margin-right: 16px;
}
header nav a:hover { color: var(--gold-bright); }

main { max-width: 1100px; margin: 24px auto; padding: 0 16px; }

.flash {
  padding: 10px 14px;
  border-radius: 6px;
  margin-bottom: 16px;
  border: 1px solid;
}
.flash.ok { background: var(--ok-bg); color: var(--green); border-color: var(--ok-border); }
.flash.error { background: var(--err-bg); color: var(--err-text); border-color: var(--err-border); }

.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

button {
  background: var(--gold-deep);
  color: #1a1510;
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
}
button:hover { background: var(--gold); }
button.danger { background: #6a3a30; color: #f0d5cd; }
button.danger:hover { background: var(--red); color: #1a1510; }

table.list {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border);
}
table.list th, table.list td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  font-size: 14px;
}
table.list th { background: var(--surface-2); color: var(--text-dim); font-weight: 600; }
table.list td.empty { text-align: center; color: var(--text-dim); padding: 24px; }

.thumb { width: 48px; height: 66px; object-fit: contain; background: var(--thumb-bg); border-radius: 4px; }

.hint {
  background: var(--hint-bg);
  border: 1px solid var(--gold-deep);
  padding: 12px 16px;
  border-radius: 6px;
  margin-bottom: 16px;
  font-size: 14px;
  color: var(--gold-bright);
}
.hint code { background: var(--code-bg); color: var(--gold-bright); padding: 1px 5px; border-radius: 4px; }

.form { display: flex; flex-direction: column; gap: 14px; max-width: 460px; }
.form label { display: flex; flex-direction: column; gap: 6px; font-size: 14px; color: var(--text-dim); }
.form input, .form select {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  background: var(--surface-2);
  color: var(--text);
}
.form button { align-self: flex-start; }

.captcha-row { display: flex; align-items: center; gap: 10px; }
.captcha-row input { flex: 1; min-width: 0; min-height: 40px; }
.captcha-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  cursor: pointer;
  flex-shrink: 0;
}
.captcha-box img {
  width: 132px;
  height: 48px;
  border: 1px solid var(--border);
  border-radius: 6px;
  flex-shrink: 0;
}
.captcha-refresh {
  font-size: 12px;
  line-height: 1;
  color: var(--gold);
  white-space: nowrap;
}

.card-detail { display: flex; gap: 24px; flex-wrap: wrap; }
.card-image img { width: 244px; border-radius: 12px; box-shadow: var(--card-shadow); }
.card-info { flex: 1; min-width: 300px; }
table.info td { padding: 6px 12px 6px 0; font-size: 14px; }
table.info td:first-child { color: var(--text-dim); }

.search-box {
  width: 100%;
  max-width: 400px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  margin-bottom: 16px;
  background: var(--surface-2);
  color: var(--text);
}
.search-box:focus { border-color: var(--gold); outline: none; }

.set-groups {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.set-group {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.set-group-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  text-decoration: none;
  color: var(--text);
}
.set-group-header:hover { background: var(--surface-2); }

.set-icon {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
}
.set-icon.small { width: 20px; height: 20px; }

.set-group-main { flex: 1; }

.set-children {
  border-top: 1px solid var(--border);
  padding: 6px 14px 10px 54px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.set-child {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--text-dim);
  padding: 4px 8px;
  border-radius: 6px;
}
.set-child:hover { background: var(--hint-bg); color: var(--gold-bright); }

.set-name { font-weight: 600; font-size: 14px; color: var(--text); }
.set-meta { color: var(--text-dim); font-size: 12px; margin-top: 4px; }
.set-child .set-meta { margin-top: 0; margin-left: auto; }

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
}

.card-cell {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.card-cell img { width: 100%; border-radius: 6px; }
.card-cell-link { display: block; text-decoration: none; color: inherit; }
.card-cell-effect {
  font-size: 11px;
  color: var(--gold);
  text-decoration: none;
}
.card-cell-effect:hover { text-decoration: underline; }
.card-cell-name { font-size: 12px; font-weight: 600; color: var(--text); }
.card-cell-meta { font-size: 11px; color: var(--text-dim); }
.card-cell-price { font-size: 13px; font-weight: 600; color: var(--gold-bright); }

.badge-instock {
  display: inline-block;
  background: var(--hint-bg);
  color: var(--text-dim);
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 4px;
  border: 1px solid var(--border);
}
.add-btn { font-size: 12px; padding: 4px 10px; }

.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
  margin: 24px 0;
}
.pagination a { color: var(--gold); text-decoration: none; }
.pagination a:hover { color: var(--gold-bright); }

.form-inline {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 8px;
}
.form-inline input, .form-inline select {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  background: var(--surface-2);
  color: var(--text);
}
.form-inline input[name="name"] { flex: 1 1 220px; }
.form-inline input[name="set_code"], .form-inline input[name="number"] { width: 150px; }
.form-inline .scan-entry-btn {
  padding: 8px 16px;
  font-size: 14px;
}

.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 24px 0;
}

.toolbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.shop-contact {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 16px;
  white-space: pre-line;
  font-size: 14px;
}

.shop-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 14px;
}

.shop-search { margin-bottom: 16px; }
.shop-search .search-box { margin-bottom: 0; }

.shop-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  text-align: center;
}
.shop-card img { width: 100%; display: block; }
.shop-card-link { display: block; text-decoration: none; color: inherit; }
.shop-card-name { font-size: 13px; font-weight: 600; padding: 6px 8px 0; color: var(--text); }
.shop-card-meta { font-size: 11px; color: var(--text-dim); padding: 2px 8px; }
.shop-card-price { font-size: 15px; font-weight: 700; color: var(--red); padding: 4px 8px 10px; }

.login-box {
  max-width: 360px;
  margin: 80px auto;
  background: var(--surface);
  border: 1px solid var(--gold-deep);
  border-radius: 10px;
  padding: 24px;
}

.form textarea {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
  resize: vertical;
  background: var(--surface-2);
  color: var(--text);
}

.public-url-bar {
  background: var(--hint-bg);
  border: 1px solid var(--gold-deep);
  padding: 10px 14px;
  border-radius: 6px;
  margin-bottom: 16px;
  font-size: 14px;
  color: var(--gold-bright);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
.public-url-bar a {
  color: var(--gold);
  font-weight: 600;
  word-break: break-all;
}
.public-url-label { font-weight: 600; margin-right: 4px; }
.public-url-sep { color: var(--gold-deep); }

.cart-link { color: var(--gold); text-decoration: none; font-weight: 600; }
header .cart-link { color: var(--gold-bright); margin-left: auto; }
header .cart-link:hover { color: var(--gold); text-decoration: underline; }

/* 头像（导航栏昵称左侧，微信头像尺寸 40px 圆形） */
.header-user {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid var(--gold-deep);
  box-sizing: border-box;
}
.user-avatar-fallback {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--gold-deep);
  color: #1a1510;
  font-size: 18px;
  font-weight: 700;
  box-sizing: border-box;
}

/* 个人中心头像 + 上传 */
.me-avatar-row {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
}
.me-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--gold-deep);
  flex-shrink: 0;
  box-sizing: border-box;
}
.me-avatar-fallback {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--gold-deep);
  color: #1a1510;
  font-size: 28px;
  font-weight: 700;
  box-sizing: border-box;
}
.avatar-form {
  display: flex;
  align-items: center;
}
.me-avatar-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: 50%;
  transition: opacity 0.15s;
}
.me-avatar-label:hover { opacity: 0.85; }
.me-avatar-label input { display: none; }
.me-avatar-hint {
  font-size: 13px;
  color: var(--text-dim);
}

.cart-badge {
  display: inline-block;
  min-width: 18px;
  text-align: center;
  background: var(--red);
  color: #1a1510;
  border-radius: 10px;
  padding: 1px 6px;
  font-size: 12px;
  margin-left: 2px;
  font-weight: 700;
}

.add-cart-btn {
  margin-top: 6px;
  width: 100%;
  background: var(--gold-deep);
  color: #1a1510;
  border: none;
  padding: 7px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
}
.add-cart-btn:hover { background: var(--gold); }
.add-cart-btn.added { background: #3a5a44; color: #d6f0dc; }

.cart-add-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 8px 8px;
}
.cart-add-row .add-cart-btn { margin-top: 0; width: auto; padding: 6px 12px; }

.wish-add-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.wish-add-row .add-cart-btn { margin-top: 0; width: auto; padding: 6px 10px; font-size: 12px; }
.wish-finish-select {
  padding: 6px 26px 6px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23888888' stroke-width='1.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
}

.cart-set { font-size: 12px; color: var(--text-dim); margin-top: 2px; }
.qty-cell { white-space: nowrap; }
.qty-btn {
  width: 28px;
  height: 28px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  color: var(--text);
}
.qty-btn:hover { background: var(--surface); border-color: var(--gold-deep); }
.qty { display: inline-block; min-width: 24px; text-align: center; }
.remove-btn {
  background: var(--surface);
  color: var(--red);
  border: 1px solid var(--err-border);
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
}
.remove-btn:hover { background: var(--err-bg); }

.cart-total {
  text-align: right;
  font-size: 16px;
  margin: 16px 0 24px;
}
.cart-total strong { color: var(--gold-bright); font-size: 18px; }

.wish-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 8px;
}
.wish-row .thumb { width: 40px; height: 55px; }
.wish-row-info { flex: 1; min-width: 0; }
.wish-row-link { flex-shrink: 0; line-height: 0; }
.wish-row-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
}
.wish-row-name:hover { color: var(--gold-bright); }

.checkout-form { max-width: 460px; }

.success-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px 24px;
  font-size: 14px;
}
.success-box p { margin: 8px 0; }

.order-meta {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 16px;
  font-size: 14px;
}
.order-meta p { margin: 6px 0; }

.order-actions {
  margin-top: 20px;
  display: flex;
  gap: 16px;
  align-items: center;
}

.link-danger {
  background: none;
  border: none;
  color: var(--red);
  cursor: pointer;
  padding: 0;
  font-size: 14px;
  margin-left: 10px;
}
.link-danger:hover { text-decoration: underline; }

.foil-tag {
  display: inline-block;
  background: var(--code-bg);
  color: var(--gold-bright);
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 4px;
  margin-left: 6px;
  font-weight: 600;
}

.foil-btn { background: var(--gold-deep); color: #1a1510; }
.foil-btn:hover { background: var(--gold); }

.etched-btn { background: #4a3a6a; color: #e6dcf5; }
.etched-btn:hover { background: #6a4a9a; }

.etched-tag {
  display: inline-block;
  background: #2e2740;
  color: #c3b0e0;
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 4px;
  margin-left: 6px;
  font-weight: 600;
}

.surge-btn { background: #1f4a52; color: #cde8ee; }
.surge-btn:hover { background: #2a6a75; }

.surge-tag {
  display: inline-block;
  background: #1e3438;
  color: #9fd0da;
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 4px;
  margin-left: 6px;
  font-weight: 600;
}

.lang-tag {
  display: inline-block;
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 4px;
  margin-left: 6px;
  font-weight: 600;
}
.lang-en { background: #2a2a2a; color: #c9c9c9; }
.lang-zhs { background: #3a1f1f; color: #e0a0a0; }
.lang-zht { background: #3a2a1a; color: #d0b090; }
.lang-ja { background: #3a1f2e; color: #e0a0c0; }
.stamp-tag {
  display: inline-block;
  background: #8a3a2a;
  color: #f6d5c0;
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 4px;
  margin-left: 6px;
  font-weight: 600;
}

.finish-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  justify-content: center;
  padding: 4px 8px 8px;
  flex-basis: 100%;
}
.finish-buttons .add-btn,
.finish-buttons .add-cart-btn {
  margin: 0;
  padding: 4px 8px;
  font-size: 12px;
  width: auto;
  white-space: nowrap;
}
.qty-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 8px 0;
}

.qty-select {
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
}

.nav-badge {
  display: inline-block;
  min-width: 16px;
  text-align: center;
  background: var(--red);
  color: #1a1510;
  border-radius: 8px;
  padding: 0 5px;
  font-size: 11px;
  line-height: 16px;
  margin-left: 3px;
  font-weight: 700;
}

.trend-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 24px;
  max-width: 700px;
}

.muted { color: var(--text-dim); font-size: 13px; }
.muted a { color: var(--text-dim); }

.oracle-box {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 13px;
  color: var(--text-dim);
  white-space: pre-line;
  margin: 8px 0;
}

.stock-input, .sold-input {
  width: 64px;
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  background: var(--surface-2);
  color: var(--text);
}
.sold-input { width: 80px; }
.stock-input.saved, .sold-input.saved {
  border-color: var(--green);
  background: var(--ok-bg);
  color: var(--green);
}

#card-preview {
  position: fixed;
  z-index: 9999;
  display: none;
  pointer-events: none;
}
#card-preview img {
  width: 260px;
  border-radius: 12px;
  box-shadow: var(--card-shadow);
  display: block;
}

.scan-entry-btn {
  display: inline-block;
  background: var(--gold-deep);
  color: #1a1510;
  text-decoration: none;
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  margin-left: 8px;
}
.scan-entry-btn:hover { background: var(--gold); }

.wish-scan-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
}
.wish-scan-box {
  background: var(--surface);
  border-radius: 12px;
  padding: 16px;
  max-width: 560px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
}
.wish-scan-box .toolbar { margin-bottom: 12px; }
.wish-scan-box #wish-scan-video {
  display: block;
  width: 100%;
  max-height: 360px;
  object-fit: contain;
  background: #000;
}

.scan-area {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 24px;
  max-width: 520px;
}
.scan-video-wrap {
  background: #000;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--gold-deep);
}
#scan-video {
  display: block;
  width: 100%;
  max-height: 420px;
  object-fit: contain;
  background: #000;
}
.scan-controls {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.scan-controls .qty-select {
  flex: 1;
  max-width: 320px;
  padding: 6px 10px;
}
.scan-status {
  font-size: 14px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
}
.scan-error { margin-bottom: 12px; }
#manual-link { display: inline-block; margin-bottom: 14px; }

.scan-mode {
  font-size: 13px;
  color: var(--gold);
  font-weight: 600;
  margin-left: auto;
}

.confirm-box {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  background: var(--surface);
  border: 2px solid var(--gold);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 20px;
  max-width: 640px;
}
.confirm-box img {
  width: 180px;
  border-radius: 8px;
  flex-shrink: 0;
}
.confirm-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.confirm-name { font-size: 20px; font-weight: 700; color: var(--text); }
.confirm-meta { font-size: 13px; color: var(--text-dim); }
.confirm-price { font-size: 16px; font-weight: 700; color: var(--gold-bright); }
.scan-price-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.scan-price-row label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-dim);
  white-space: nowrap;
}
.scan-price-row input {
  flex: 1;
  max-width: 180px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 15px;
  background: var(--surface-2);
  color: var(--text);
}
.scan-cell-price {
  width: 100%;
  box-sizing: border-box;
  padding: 6px 8px;
  margin: 6px 0 2px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  background: var(--surface-2);
  color: var(--text);
}
.confirm-buttons {
  justify-content: flex-start;
  padding: 4px 0 0;
  flex-basis: auto;
}
.confirm-buttons .add-btn {
  padding: 8px 18px;
  font-size: 14px;
}
.confirm-default {
  outline: 3px solid var(--gold);
  outline-offset: 1px;
}

/* ===== 移动端响应式（手机买家） ===== */
.mobile-cart-bar { display: none; }

@media (max-width: 640px) {
  body { font-size: 15px; }
  main { margin: 12px auto; padding: 0 10px; }
  body.shop-page { padding-bottom: 70px; }

  /* 顶栏吸顶、缩小、店名可截断 */
  header {
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 10px 12px;
    gap: 12px;
    flex-wrap: nowrap;
  }
  .brand {
    flex: 1;
    min-width: 0;
  }
  .brand h1 {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 17px;
  }
  .market-page .mana-dots { margin-top: 2px; }
  header .cart-link { white-space: nowrap; flex-shrink: 0; }
  .header-cart { display: none; }
  .theme-toggle { padding: 6px 10px; font-size: 13px; }

  /* 卡片网格：两列，卡图更大更好点 */
  .shop-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
  .shop-card-name { font-size: 12px; padding: 6px 6px 0; }
  .shop-card-meta { font-size: 10px; padding: 2px 6px; }
  .shop-card-price { font-size: 15px; padding: 4px 6px 8px; }

  /* 触控目标加大到手指友好尺寸 */
  .qty-select { padding: 8px 6px; font-size: 14px; min-height: 40px; }
  .search-box { min-height: 40px; }
  .cart-add-row { gap: 8px; padding: 6px 8px 10px; }
  .cart-add-row .add-cart-btn {
    padding: 10px 14px;
    font-size: 14px;
    min-height: 40px;
    flex: 1;
  }

  /* 详情页：图片与信息上下堆叠 */
  .card-detail { flex-direction: column; gap: 16px; }
  .card-image { text-align: center; }
  .card-image img {
    width: 100%;
    max-width: 320px;
    margin: 0 auto;
    display: block;
    border-radius: 14px;
  }
  .card-info { min-width: 0; width: 100%; }
  .card-info .add-cart-btn {
    width: 100%;
    max-width: none;
    padding: 14px;
    font-size: 16px;
    min-height: 48px;
  }

  /* 底部固定购物车栏 */
  .mobile-cart-bar {
    display: flex;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 200;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    background: var(--header-bg);
    border-top: 1px solid var(--gold-deep);
  }
  .mobile-cart {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text);
    text-decoration: none;
    font-size: 15px;
    font-weight: 600;
  }
  .mobile-checkout {
    background: var(--gold-deep);
    color: #1a1510;
    text-decoration: none;
    padding: 12px 22px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 15px;
    flex-shrink: 0;
  }
  .mobile-checkout:active { background: var(--gold); }

  /* 购物车表格 → 卡片式布局 */
  .cart-table,
  .cart-table tbody,
  .cart-table tr,
  .cart-table td { display: block; }
  .cart-table thead { display: none; }
  .cart-table tr {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px;
    margin-bottom: 10px;
  }
  .cart-table td {
    border: none;
    padding: 5px 0;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 15px;
  }
  .cart-table td::before {
    content: attr(data-label);
    color: var(--text-dim);
    font-size: 12px;
    min-width: 44px;
    flex-shrink: 0;
  }
  .cart-table td[data-label=""]::before { display: none; }
  /* 卡图一行居中大图 */
  .cart-table td[data-label="卡图"] {
    justify-content: center;
    padding: 4px 0 8px;
  }
  .cart-table td[data-label="卡图"]::before { display: none; }
  .cart-table .thumb { width: 110px; height: 154px; }
  /* 删除按钮靠右 */
  .cart-table td[data-label=""] { justify-content: flex-end; }
  .cart-table .remove-btn { padding: 8px 14px; font-size: 14px; min-height: 40px; }
  .cart-table .cart-qty-select { flex: 1; max-width: 150px; padding: 10px 8px; font-size: 15px; }

  /* 收货表单占满、输入更易点 */
  .checkout-form { max-width: none; }
  .checkout-form input,
  .checkout-form textarea {
    font-size: 16px;
    padding: 12px 10px;
  }
  .checkout-form button[type="submit"] {
    width: 100%;
    padding: 14px;
    font-size: 16px;
    min-height: 48px;
  }

  /* 心愿单：搜索区按钮 + 单卡行控件触控加大 */
  #wish-search-btn,
  .scan-entry-btn {
    min-height: 40px;
    padding: 8px 14px;
    font-size: 14px;
  }
  .form-inline button {
    min-height: 40px;
    padding: 8px 16px;
  }
  .me-avatar-row {
    flex-wrap: wrap;
  }
  .wish-finish-select {
    height: 40px;
    padding: 8px 26px 8px 10px;
    font-size: 14px;
  }
  .wish-add-row .add-wish-btn {
    min-height: 40px;
    padding: 8px 12px;
    font-size: 14px;
  }
  #wish-scan-close {
    min-height: 40px;
    min-width: 44px;
    padding: 8px 12px;
    font-size: 14px;
  }
  .wish-row { gap: 8px; }
  .wish-row .remove-btn {
    min-height: 40px;
    padding: 8px 12px;
    font-size: 14px;
  }
  .wanted-del-btn {
    min-height: 40px;
    padding: 8px 12px;
    font-size: 14px;
  }
  .wish-row .wish-qty-select {
    min-height: 40px;
    padding: 8px 6px;
    font-size: 15px;
  }

  /* 系列浏览：子系列链接触控加大 */
  .set-child {
    padding: 10px 8px;
    min-height: 40px;
  }
}

/* ============ 玩家市场 ============ */
.market-seller-block { margin-bottom: 24px; }
.market-seller-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.market-seller-head h4 { margin: 0; font-size: 16px; }
.market-seller-head h4 a { color: var(--text); text-decoration: none; }
.market-seller-head h4 a:hover { color: var(--gold-bright); }

.offer-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 640px;
}
.offer-row {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
}
.offer-main { flex: 1; min-width: 0; }
.offer-name { font-weight: 600; font-size: 14px; }
.offer-meta { font-size: 12px; color: var(--text-dim); margin-top: 2px; }
.offer-price { font-weight: 700; color: var(--gold-bright); font-size: 16px; white-space: nowrap; }

.market-cart-group {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 12px;
}
.market-cart-head {
  font-size: 14px;
  margin-bottom: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.market-cart-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
}
.market-cart-item .thumb { width: 40px; height: 55px; }
.market-cart-info { flex: 1; min-width: 0; }
.market-cart-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}

.message-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 640px;
}
.message-item {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
  text-decoration: none;
  color: var(--text);
}
.message-item:hover { border-color: var(--gold-deep); }
.message-item-name { font-weight: 600; font-size: 14px; }
.message-item-preview {
  font-size: 13px;
  color: var(--text-dim);
  margin-top: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.message-thread {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 640px;
  margin-bottom: 16px;
}
.message-bubble {
  max-width: 75%;
  padding: 8px 12px;
  border-radius: 12px;
  font-size: 14px;
}
.message-bubble.mine {
  align-self: flex-end;
  background: var(--gold-deep);
  color: #1a1510;
}
.message-bubble.theirs {
  align-self: flex-start;
  background: var(--surface-2);
  color: var(--text);
}
.message-content { white-space: pre-wrap; word-break: break-word; }
.message-time { font-size: 11px; opacity: 0.7; margin-top: 4px; }

.message-form { display: flex; gap: 8px; max-width: 640px; }
.message-form input {
  flex: 1;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--text);
}
.message-form button {
  padding: 10px 20px;
  background: var(--gold-deep);
  color: #1a1510;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
}

.me-stats {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.me-stat {
  flex: 1;
  min-width: 90px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  text-align: center;
}
.me-stat-num { font-size: 22px; font-weight: 700; color: var(--gold-bright); }
.me-stat-label { font-size: 12px; color: var(--text-dim); margin-top: 4px; }

.me-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 360px;
}

.admin-nick { color: var(--gold-bright); font-weight: 700; }

.market-seller-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.market-seller-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
  cursor: pointer;
  color: var(--text);
}
.market-seller-row:hover { border-color: var(--gold-deep); }
.seller-row-name { font-weight: 600; font-size: 15px; }
.seller-row-count { font-size: 12px; color: var(--text-dim); flex: 1; }
.seller-row-arrow { font-size: 14px; color: var(--text-dim); }

.market-seller-expand {
  padding: 8px 14px 10px;
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 8px 8px;
  background: var(--surface);
}
.expand-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.expand-cards {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  flex: 1;
  -webkit-overflow-scrolling: touch;
}
.market-img-card {
  position: relative;
  flex-shrink: 0;
  line-height: 0;
}
.market-img-card img {
  width: 60px;
  height: 84px;
  border-radius: 4px;
  display: block;
}
.finish-corner {
  position: absolute;
  right: 3px;
  bottom: 3px;
  font-size: 9px;
  line-height: 1.4;
  padding: 0 4px;
  border-radius: 3px;
  font-weight: 600;
  white-space: nowrap;
  pointer-events: none;
}
.finish-corner.stamp { background: #8a3a2a; color: #f6d5c0; }
.seller-enter {
  flex-shrink: 0;
  font-size: 13px;
  color: var(--gold);
  text-decoration: none;
  white-space: nowrap;
  font-weight: 600;
}

.wanted-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 640px;
}
.wanted-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
}
.wanted-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.wanted-user { font-size: 12px; color: var(--text-dim); }
.wanted-cards {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.wanted-item {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 5px 8px 5px 5px;
}
.wanted-item-main {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
  text-decoration: none;
  color: inherit;
}
.wanted-item-del { flex-shrink: 0; }
.wanted-del-btn { padding: 4px 8px; font-size: 12px; }
.wanted-item-img {
  width: 30px;
  height: 42px;
  border-radius: 3px;
  flex-shrink: 0;
}
.wanted-item-info { min-width: 0; }
.wanted-item-name { font-size: 13px; font-weight: 600; }
.wanted-note { font-size: 13px; color: var(--text-dim); margin-top: 8px; }
.wanted-draft-item {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  margin-bottom: 8px;
}

.wanted-publish-btn {
  display: block;
  text-align: center;
  background: var(--gold-deep);
  color: #1a1510;
  text-decoration: none;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 14px;
}
.wanted-publish-btn:active { background: var(--gold); }

.home-wanted-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}
.home-wanted-card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  text-decoration: none;
  color: var(--text);
}
.home-wanted-card:hover { border-color: var(--gold-deep); }
.home-wanted-user { font-size: 13px; font-weight: 600; }
.home-wanted-cards {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  margin-top: 4px;
}
.home-wanted-name { font-size: 13px; color: var(--text); }
.home-wanted-note {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.home-wanted-more {
  display: block;
  text-align: center;
  font-size: 13px;
  color: var(--gold);
  text-decoration: none;
  padding: 8px 0;
}

.rating-options {
  display: flex;
  gap: 12px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.rating-opt {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 15px;
  cursor: pointer;
}

.seller-reviews {
  margin-bottom: 16px;
  max-width: 640px;
}
.reviews-summary {
  font-size: 14px;
  margin-bottom: 8px;
}
.reviews-rate { font-weight: 700; color: var(--gold-bright); }
.reviews-count { color: var(--text-dim); font-size: 13px; }
.reviews-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.review-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
}
.review-head {
  display: flex;
  align-items: center;
  gap: 8px;
}
.review-nick { font-weight: 600; font-size: 13px; }
.review-tag { font-size: 12px; padding: 2px 8px; border-radius: 4px; }
.review-tag.good { background: #2a4a2a; color: #b8e0b8; }
.review-tag.mid { background: #4a4a2a; color: #e0d0a0; }
.review-tag.bad { background: #4a2a2a; color: #e0a0a0; }
.review-content { font-size: 13px; margin-top: 6px; white-space: pre-wrap; }
.review-time { font-size: 11px; color: var(--text-dim); margin-top: 4px; }

/* 市场底部导航（移动端） */
.market-bottom-nav { display: none; }

@media (max-width: 640px) {
  .market-page .header-nav { display: none; }
  .market-page .header-user { margin-left: auto; }
  .market-bottom-nav {
    display: flex;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 200;
    background: var(--header-bg);
    border-top: 1px solid var(--gold-deep);
  }
  .mbn-item {
    flex: 1;
    text-align: center;
    padding: 11px 0 9px;
    color: var(--text);
    text-decoration: none;
    font-size: 12px;
  }
  .mbn-item:active { color: var(--gold-bright); }
  .mbn-item .cart-badge { margin-left: 3px; }
}

/* ===== 万智牌主题市场美化 ===== */
.market-page {
  background: radial-gradient(ellipse at top, var(--surface-2) 0%, var(--bg) 70%);
}

/* 品牌标题：金色魔法风格 */
.market-page header h1 {
  color: var(--gold-bright);
  font-weight: 800;
  letter-spacing: 1px;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}

/* 卡片：万智牌金色卡框 */
.market-page .shop-card,
.market-page .card-cell {
  border: 2px solid var(--gold-deep);
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.25);
}
.market-page .shop-card:hover,
.market-page .card-cell:hover {
  border-color: var(--gold-bright);
  box-shadow: 0 5px 18px rgba(0, 0, 0, 0.35);
}

/* 价格：金色醒目 */
.market-page .shop-card-price,
.market-page .card-cell-price,
.market-page .offer-price,
.market-page .reviews-rate {
  color: var(--gold-bright);
  font-weight: 800;
}

/* 按钮：金色魔法渐变 */
.market-page .add-cart-btn,
.market-page .wanted-publish-btn {
  background: linear-gradient(180deg, var(--gold-deep), var(--gold));
  border: 1px solid var(--gold-bright);
  color: #1a1510;
  font-weight: 700;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.2);
}

/* 卖家行 / 报价行：金色左边框 */
.market-page .market-seller-row,
.market-page .offer-row {
  border-left: 3px solid var(--gold-deep);
}

/* 底部导航：魔法风格 */
.market-bottom-nav {
  border-top: 2px solid var(--gold-deep);
  box-shadow: 0 -3px 14px rgba(0, 0, 0, 0.35);
}

/* 求购卡片 / 卖家店铺卡片：金色描边 */
.market-page .wanted-card,
.market-page .home-wanted-card,
.market-page .review-item {
  border-left: 3px solid var(--gold-deep);
}

/* 品牌区（标题 + 五色法力装饰） */
.brand {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}
.brand h1 { margin: 0; }

/* 五色法力装饰点 */
.mana-dots {
  display: inline-flex;
  gap: 3px;
  margin-top: 3px;
}
.mana-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}
.mana-dot.w { background: #f5f0dc; border: 1px solid #a99; }
.mana-dot.u { background: #4a90d9; }
.mana-dot.b { background: #6a4a8a; }
.mana-dot.r { background: #d94a3a; }
.mana-dot.g { background: #4a9a4a; }

.icp-footer {
  text-align: center;
  padding: 18px 10px 28px;
  font-size: 12px;
  color: #999;
}
.icp-footer a {
  color: #999;
  text-decoration: none;
}
.icp-footer a:hover {
  color: #666;
  text-decoration: underline;
}
