:root {
  --bg: #f5f6f8;
  --panel: #ffffff;
  --border: #e6e8ec;
  --text: #1b1f27;
  --muted: #7b8291;
  --accent: #2563eb;
  --accent-soft: #eaf0fe;
  --price: #e0393e;
  --radius: 10px;
  --font-body: 'Inter', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  --font-mono: 'JetBrains Mono', 'SFMono-Regular', Consolas, monospace;
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }

/* ---- Topbar ---- */
.topbar {
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 30;
}
.topbar-inner {
  max-width: 1080px; margin: 0 auto;
  padding: 14px 20px;
  display: flex; align-items: center; gap: 28px;
}
.brand { font-weight: 700; font-size: 18px; letter-spacing: 0.3px; }
.brand-dot { color: var(--accent); }
.main-nav { display: flex; gap: 22px; }
.main-nav a { font-size: 14px; color: var(--muted); padding: 6px 0; border-bottom: 2px solid transparent; }
.main-nav a.active, .main-nav a:hover { color: var(--text); border-color: var(--accent); }

/* ---- Announce ---- */
.announce {
  background: #fff8e6; color: #8a5a00;
  font-size: 12.5px; text-align: center;
  padding: 9px 16px; border-bottom: 1px solid #f2e2b8;
}

/* ---- Tabs ---- */
.tabs-bar { background: var(--panel); border-bottom: 1px solid var(--border); }
.tabs-inner {
  max-width: 1080px; margin: 0 auto; padding: 10px 20px;
  display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none;
}
.tabs-inner::-webkit-scrollbar { display: none; }
.tab-btn {
  white-space: nowrap;
  background: none; border: 1px solid var(--border);
  color: var(--muted); font-size: 13px;
  padding: 7px 15px; border-radius: 999px;
}
.tab-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.tab-btn:hover:not(.active) { border-color: var(--accent); color: var(--accent); }

/* ---- Grid ---- */
.grid-wrap { max-width: 1080px; margin: 0 auto; padding: 24px 20px 60px; }
.loading { text-align: center; color: var(--muted); padding: 60px 0; font-size: 13.5px; }
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}
.product-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex; flex-direction: column; gap: 8px;
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}
.product-card:hover { box-shadow: 0 4px 18px rgba(0,0,0,0.06); transform: translateY(-1px); }
.card-img-wrap {
  margin: -16px -16px 4px;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: var(--bg);
  border-radius: var(--radius) var(--radius) 0 0;
}
.card-img-wrap img { display: block; width: 100%; height: 100%; object-fit: cover; }
.card-series-tag {
  font-size: 11px; color: var(--accent);
  background: var(--accent-soft);
  display: inline-block; padding: 2px 8px; border-radius: 999px;
  width: fit-content;
}
.card-name { font-size: 14.5px; font-weight: 600; line-height: 1.4; }
.card-spec { font-size: 12px; color: var(--muted); line-height: 1.5; min-height: 16px; }
.card-bottom { display: flex; align-items: center; justify-content: space-between; margin-top: 4px; }
.card-price { font-family: var(--font-mono); font-size: 18px; font-weight: 700; color: var(--price); }
.buy-btn {
  background: var(--accent); color: #fff; border: none;
  font-size: 12.5px; font-weight: 600;
  padding: 7px 14px; border-radius: 8px;
}
.buy-btn:hover { background: #1d4fd0; }
.sold-out .card-price { color: var(--muted); }
.sold-out .buy-btn { background: var(--border); color: var(--muted); pointer-events: none; }

/* ---- Footer ---- */
.site-footer { text-align: center; padding: 30px 20px; color: var(--muted); font-size: 12px; }

/* ---- Modal ---- */
.modal-mask {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(20, 24, 32, 0.5);
  display: flex; align-items: center; justify-content: center;
  padding: 16px; overflow-y: auto;
}
.modal-mask[hidden] { display: none !important; }
.modal {
  background: var(--panel);
  border-radius: 16px;
  padding: 28px;
  max-width: 380px; width: 100%;
  position: relative;
  max-height: 92vh; overflow-y: auto;
}
.modal-close {
  position: absolute; top: 14px; right: 14px;
  background: none; border: none; color: var(--muted); font-size: 22px; line-height: 1;
}
.modal-title { font-size: 17px; font-weight: 700; margin: 0 0 4px; padding-right: 20px; }
.modal-img-wrap { margin: -8px 0 14px; border-radius: 10px; overflow: hidden; background: var(--bg); }
.modal-img-wrap[hidden] { display: none !important; }
.modal-img-wrap img { display: block; width: 100%; max-height: 160px; object-fit: cover; }
.qty-stepper { display: flex; align-items: center; gap: 10px; margin-top: 4px; }
.qty-btn {
  width: 32px; height: 32px; flex-shrink: 0;
  background: var(--bg); border: 1px solid var(--border); color: var(--text);
  border-radius: 8px; font-size: 16px; line-height: 1;
}
.qty-btn:hover { border-color: var(--accent); color: var(--accent); }
.qty-input {
  width: 56px; text-align: center;
  background: var(--bg); border: 1px solid var(--border); color: var(--text);
  padding: 7px 4px; border-radius: 8px; font-size: 13.5px; font-family: var(--font-mono);
}
.qty-input:focus { outline: none; border-color: var(--accent); }
.pay-amount-note { font-size: 12px; color: var(--price); text-align: center; margin: -10px 0 14px; }
.modal-price { font-family: var(--font-mono); font-size: 22px; font-weight: 700; color: var(--price); margin: 0 0 18px; }

.field-label { display: block; font-size: 12.5px; color: var(--muted); margin: 14px 0 6px; }
.field-label:first-of-type { margin-top: 0; }
.req { color: var(--price); }
.field-input {
  width: 100%; background: var(--bg);
  border: 1px solid var(--border); color: var(--text);
  padding: 10px 12px; border-radius: 8px; font-size: 13.5px;
  font-family: inherit; resize: vertical;
}
.field-input:focus { outline: none; border-color: var(--accent); }
.info-notice { font-size: 12px; color: var(--muted); margin: 12px 0 0; line-height: 1.5; }
.info-notice a { color: var(--accent); text-decoration: underline; }

.pay-methods { display: flex; gap: 10px; margin-top: 4px; }
.pay-btn {
  flex: 1; background: var(--bg); border: 1px solid var(--border);
  color: var(--text); padding: 11px; border-radius: 8px; font-size: 13.5px; font-weight: 500;
}
.pay-btn.active { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); font-weight: 600; }

.submit-btn {
  display: block; width: 100%; margin-top: 22px;
  background: var(--accent); color: #fff; border: none;
  padding: 12px; border-radius: 9px; font-weight: 600; font-size: 14px;
}
.submit-btn.secondary { background: var(--bg); color: var(--text); border: 1px solid var(--border); }
.submit-btn:disabled { opacity: 0.55; }

.order-no { font-family: var(--font-mono); font-size: 12.5px; color: var(--muted); margin: 0 0 2px; }
.qr-img {
  display: block; width: 190px; height: 190px; object-fit: contain;
  background: #fff; border: 1px solid var(--border);
  border-radius: 10px; padding: 8px; margin: 14px auto;
}
.qr-img[hidden] { display: none !important; }
.qr-fallback { font-size: 12.5px; color: var(--price); text-align: center; }
.remark-tip {
  background: #fff8e6; border: 1px solid #f2e2b8;
  border-radius: 10px; padding: 12px 14px; margin: 16px 0;
  text-align: center;
}
.remark-label { font-size: 12px; color: #8a5a00; margin: 0 0 4px; }
.remark-value { font-family: var(--font-mono); font-size: 16px; font-weight: 700; color: #8a5a00; margin: 0; }
.pay-hint { font-size: 12px; color: var(--muted); line-height: 1.7; margin: 0 0 4px; }

/* ---- 支付成功 ---- */
.success-icon { font-size: 48px; text-align: center; margin-bottom: 8px; }
.order-copy-box {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 10px; padding: 14px; margin-bottom: 8px;
}
.order-copy-label { font-size: 12px; color: var(--muted); }
.order-copy-value {
  font-family: var(--font-mono); font-size: 16px; font-weight: 600;
  color: var(--accent); cursor: pointer; user-select: none;
  transition: opacity 0.15s ease;
}
.order-copy-value:hover { opacity: 0.7; }
.copy-toast {
  text-align: center; font-size: 13px; color: #0a8a4a; font-weight: 600;
  margin: 0 0 12px;
}

/* ---- Order search page ---- */
.search-wrap { max-width: 460px; margin: 0 auto; padding: 60px 20px; }
.search-card { background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 28px; }
.search-title { font-size: 18px; font-weight: 700; margin: 0 0 6px; }
.search-sub { font-size: 12.5px; color: var(--muted); margin: 0 0 20px; }
.search-error { color: var(--price); font-size: 12.5px; margin-top: 10px; }

.search-btn {
  display: block; width: 100%; margin-top: 22px;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #fff; border: none;
  padding: 13px; border-radius: 9px; font-weight: 600; font-size: 15px;
  cursor: pointer;
  transition: opacity 0.15s ease, transform 0.1s ease;
}
.search-btn:hover { opacity: 0.9; transform: translateY(-1px); }
.search-btn:active { transform: translateY(0); }
.search-btn:disabled { opacity: 0.55; transform: none; }
.result-card { margin-top: 24px; border-top: 1px solid var(--border); padding-top: 18px; }
.result-row { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; font-size: 13px; }
.result-row span { color: var(--muted); flex-shrink: 0; }
.result-row b { text-align: right; font-weight: 600; }
.status-badge { padding: 2px 10px; border-radius: 999px; font-size: 12px; }
