/* ==========================================================================
   发卡商城前台样式
   设计语言：低饱和中性底色 + 单一强调色（选中态用淡紫），大字号 Hero，圆角卡片。
   所有颜色走语义变量，明暗主题只需切换 :root[data-theme]。
   ========================================================================== */

:root {
  color-scheme: light;
  --page: #f5f6f8;
  --surface: #ffffff;
  --ink: #242b2a;
  --muted: #787f7d;
  --line: #dce1df;
  --line-soft: #edf0ee;
  --tab: #eceff0;
  --accent: #427f6d;
  --selected: #edf5f0;
  --field: #ffffff;
  --button: #2c3c35;
  --button-text: #ffffff;
  --shadow: 0 8px 32px rgba(37, 53, 46, 0.02);
  --focus: #427f6d;
  --plan-selected: #f8f7ff;
  --plan-edge: #c7c4ff;
  --plan-check: #625fc9;
  --danger: #b05244;
  --ok: #3f8f6f;
  --logo-ink: #0d0d0d;
  --radius: 14px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #151e1b;
  --surface: #1c2723;
  --ink: #e8efeb;
  --muted: #97a69f;
  --line: #35463e;
  --line-soft: #2b3932;
  --tab: #202e27;
  --accent: #9bcdb9;
  --selected: #2a4437;
  --field: #1c2723;
  --button: #d1e6d6;
  --button-text: #21372b;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.03);
  --focus: #99cfb8;
  --plan-selected: #2b2942;
  --plan-edge: #8f8be8;
  --plan-check: #aaa6ff;
  --danger: #e08b7c;
  --ok: #7fcfae;
  --logo-ink: #f4f6f5;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: var(--font);
  font-size: 13px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button,
a,
input,
select,
textarea {
  -webkit-tap-highlight-color: transparent;
}

button {
  cursor: pointer;
  border: 0;
  background: none;
}

button:disabled {
  cursor: not-allowed;
}

a {
  color: inherit;
  text-decoration: none;
}

p,
h1,
h2,
h3 {
  margin: 0;
}

img,
svg {
  display: block;
  max-width: 100%;
}

[hidden] {
  display: none !important;
}

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 8px;
  z-index: 100;
  padding: 8px 14px;
  border-radius: 8px;
  background: var(--button);
  color: var(--button-text);
}
.skip-link:focus {
  left: 12px;
}

/* ---------- 布局骨架 ---------- */

.site-shell {
  width: calc(100% - 88px);
  max-width: 1280px;
  margin: 0 auto;
  padding-bottom: 92px;
}

.site-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 24px;
  min-height: 86px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  width: max-content;
  min-width: 0;
}

.brand-mark {
  flex-shrink: 0;
  width: 58px;
  height: 40px;
}
.brand-mark svg,
.brand-mark img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.brand-wordmark {
  font-family: "Segoe UI", Arial, sans-serif;
  font-size: 27px;
  font-weight: 650;
  line-height: 1.15;
  letter-spacing: -1.1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 220px;
}

.category-tabs {
  justify-self: center;
  display: flex;
  align-items: center;
  gap: 4px;
  width: max-content;
  max-width: 100%;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--tab);
}

.category-tab {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex: 0 0 auto;
  min-height: 36px;
  padding: 8px 13px;
  border-radius: 10px;
  white-space: nowrap;
  color: var(--muted);
  font-size: 13px;
  font-weight: 570;
  line-height: 20px;
  transition: background 0.16s, color 0.16s, box-shadow 0.16s;
}

.category-tab svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  display: block;
}

.category-tab:hover {
  color: var(--ink);
}

.category-tab[aria-pressed="true"] {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.category-tab.notice-tab {
  color: var(--plan-check);
  font-weight: 750;
}

.header-actions {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.text-button {
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
}
.text-button:hover {
  color: var(--ink);
}

.icon-button {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  font-size: 15px;
  color: var(--muted);
}
.icon-button:hover {
  background: var(--tab);
  color: var(--ink);
}

.login-button {
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}
.login-button:hover {
  border-color: var(--plan-edge);
}

/* ---------- Hero ---------- */

.category-hero {
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 30px;
  min-height: 226px;
  padding: 40px 0 44px;
  overflow-x: clip;
}

.hero-copy {
  min-width: 0;
}

.category-hero h1 {
  margin-bottom: 0;
  font-size: 62px;
  font-weight: 740;
  line-height: 1.1;
  letter-spacing: -3.4px;
}

.hero-art {
  position: relative;
  width: 52%;
  align-self: stretch;
  display: grid;
  place-items: center;
  --hero-mark-size: 168px;
}

.hero-logo {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--accent);
  pointer-events: none;
}
.hero-logo svg {
  width: var(--hero-mark-size);
  height: var(--hero-mark-size);
  display: block;
  animation: hero-breathe 5.2s ease-in-out infinite;
  transform-origin: center;
}

.category-hero.is-updating .hero-copy,
.category-hero.is-updating .hero-art {
  animation: arrive 0.28s ease both;
}

@keyframes hero-breathe {
  0%, 100% { scale: 0.92; }
  50% { scale: 1.06; }
}

@keyframes arrive {
  from { opacity: 0.3; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- 选购面板 ---------- */

.purchase-panel {
  display: grid;
  grid-template-columns: minmax(0, 0.81fr) minmax(0, 1.1fr);
  gap: 36px;
  min-height: 610px;
  padding: 30px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow);
}

.plans-pane {
  min-width: 0;
  padding-right: 36px;
  border-right: 1px solid var(--line);
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 17px;
}
.section-heading h2 {
  font-size: 17px;
  font-weight: 670;
  letter-spacing: -0.35px;
}
.section-heading > span {
  font-size: 10px;
  color: var(--muted);
  white-space: nowrap;
}

.delivery-status {
  padding: 3px 9px;
  border: 1px solid var(--plan-edge);
  border-radius: 999px;
  background: var(--plan-selected);
  color: var(--plan-check) !important;
  font-size: 11px !important;
  font-weight: 600;
}

.plan-search {
  display: flex;
  align-items: center;
  gap: 7px;
  max-width: 100%;
  margin: -3px 0 15px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line-soft);
  color: var(--muted);
}
.plan-search svg {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
}
.plan-search input {
  width: 100%;
  min-width: 0;
  height: 22px;
  padding: 2px 0;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--ink);
  font-size: 12px;
}
.plan-search input::placeholder {
  color: var(--muted);
  opacity: 0.85;
}

.plan-list {
  display: grid;
  gap: 11px;
  align-content: start;
}

.plan-card {
  position: relative;
  display: block;
  width: 100%;
  min-height: 111px;
  padding: 16px 18px 15px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface);
  color: var(--ink);
  text-align: left;
  line-height: 1.5;
  overflow-wrap: anywhere;
  transition: background 0.16s, border-color 0.16s;
}
.plan-card:hover {
  border-color: #8faaa0;
}
.plan-card[aria-pressed="true"] {
  background: var(--plan-selected);
  border-color: var(--plan-edge);
  box-shadow: inset 0 0 0 0.35px var(--plan-edge);
}
.plan-card[aria-disabled="true"] {
  opacity: 0.55;
}

.plan-radio {
  position: absolute;
  top: 23px;
  right: 18px;
  width: 19px;
  height: 19px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  transition: background 0.16s, border-color 0.16s, transform 0.16s;
}
.plan-card[aria-pressed="true"] .plan-radio {
  background: var(--plan-check);
  border-color: var(--plan-check);
  transform: scale(1.02);
}
.plan-card[aria-pressed="true"] .plan-radio::after {
  content: "";
  position: absolute;
  left: 6px;
  top: 3px;
  width: 5px;
  height: 9px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  border-radius: 1px;
  transform: rotate(45deg);
}

.plan-price {
  margin-bottom: 9px;
  margin-right: 30px;
  font-size: 23px;
  font-weight: 680;
  letter-spacing: -0.8px;
  font-variant-numeric: tabular-nums;
  color: var(--plan-check);
}
.plan-price small {
  font-size: 12px;
  font-weight: 560;
}

.plan-title {
  display: block;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.6;
}

.plan-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 6px;
  margin-top: 8px;
  font-size: 11px;
  color: var(--muted);
}

.tag {
  display: inline-flex;
  align-items: center;
  padding: 1px 7px;
  border-radius: 5px;
  border: 1px solid var(--line);
  font-size: 10px;
  line-height: 16px;
  white-space: nowrap;
}
.tag.green {
  color: var(--ok);
  border-color: color-mix(in srgb, var(--ok) 35%, transparent);
}
.tag.blue {
  color: var(--plan-check);
  border-color: var(--plan-edge);
}
.tag.orange {
  color: #c77a2e;
  border-color: color-mix(in srgb, #c77a2e 35%, transparent);
}
:root[data-theme="dark"] .tag.orange {
  color: #e5a565;
}

.plan-stock {
  font-variant-numeric: tabular-nums;
}

.plan-empty {
  padding: 26px 10px;
  border: 1px dashed var(--line);
  border-radius: 13px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

/* ---------- 下单表单 ---------- */

.checkout-pane {
  min-width: 0;
}

.section-description {
  margin-bottom: 20px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.9;
}

.form-status {
  margin-bottom: 14px;
  padding: 10px 13px;
  border: 1px solid var(--plan-edge);
  border-radius: 9px;
  background: var(--plan-selected);
  color: var(--plan-check);
  font-size: 12px;
}
.form-status.is-error {
  border-color: color-mix(in srgb, var(--danger) 40%, transparent);
  background: color-mix(in srgb, var(--danger) 8%, transparent);
  color: var(--danger);
}

.order-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 17px 16px;
  min-height: 110px;
  margin-bottom: 27px;
  align-content: start;
}
.order-fields > div {
  min-width: 0;
}

.field-caption {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 11px;
}

.order-fields label,
.form-label {
  display: block;
  margin-bottom: 7px;
  font-size: 13px;
  font-weight: 450;
}

.order-fields input {
  display: block;
  width: 100%;
  min-width: 0;
  height: 40px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--field);
  color: var(--ink);
  font-size: 13px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.order-fields input::placeholder {
  color: var(--muted);
  opacity: 0.85;
}
.order-fields input:focus {
  outline: none;
  border-color: var(--plan-edge);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--plan-edge) 18%, transparent);
}

.captcha-group {
  display: flex;
  align-items: center;
  gap: 10px;
}
.captcha-group input {
  flex: 1;
  min-width: 0;
}
.captcha-img {
  flex-shrink: 0;
  width: 112px;
  height: 40px;
  border: 1px solid var(--plan-edge);
  border-radius: 7px;
  background: var(--plan-selected);
  object-fit: contain;
  cursor: pointer;
}
:root[data-theme="dark"] .captcha-img {
  background: #fff;
}

.selection-summary {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 18px 0;
  border-top: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
}

.selected-copy {
  min-width: 0;
}
.selected-copy strong {
  display: block;
  font-size: 15px;
  font-weight: 650;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.quantity-block {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  flex-shrink: 0;
  max-width: 48%;
}

.quantity-control {
  display: inline-flex;
  align-items: center;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--field);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.quantity-control:focus-within {
  border-color: var(--plan-edge);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--plan-edge) 18%, transparent);
}
.quantity-control button {
  width: 34px;
  height: 100%;
  font-size: 16px;
  color: var(--muted);
}
.quantity-control button:hover:not(:disabled) {
  color: var(--ink);
}
.quantity-control button:disabled {
  opacity: 0.35;
}
.quantity-control input {
  width: 48px;
  height: 100%;
  border: 0;
  outline: none;
  background: transparent;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  -moz-appearance: textfield;
}
.quantity-control input::-webkit-outer-spin-button,
.quantity-control input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.detail-link {
  margin-top: 9px;
  padding: 7px 10px;
  border: 1px solid var(--plan-edge);
  border-radius: 8px;
  background: var(--plan-selected);
  color: var(--plan-check);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, transform 0.15s;
}
.detail-link:hover {
  border-color: var(--plan-check);
  transform: translateY(-1px);
}

/* ---------- 支付方式 ---------- */

.payments {
  margin: 0;
  padding: 20px 0 0;
  border: 0;
}
.payments legend {
  float: none;
  width: auto;
  padding: 0;
}

.payment-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.payment-option {
  position: relative;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--field);
  text-align: left;
  transition: border-color 0.15s, background 0.15s;
}
.payment-option:hover {
  border-color: #8faaa0;
}
.payment-option[aria-pressed="true"] {
  border-color: var(--plan-edge);
  background: var(--plan-selected);
  box-shadow: inset 0 0 0 0.3px var(--plan-edge);
}
.payment-option[aria-pressed="true"]::after {
  content: "✓";
  position: absolute;
  top: 6px;
  right: 9px;
  color: var(--plan-check);
  font-size: 11px;
  font-weight: 700;
}

.payment-icon {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
}
.payment-icon.alipay { background: #1677ff; }
.payment-icon.wxpay { background: #07c160; }
.payment-icon.qqpay { background: #12b7f5; }
.payment-icon.usdt { background: #26a17b; }
.payment-icon.other { background: var(--muted); }

.payment-name {
  font-size: 13px;
  font-weight: 550;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.payment-empty {
  grid-column: 1 / -1;
  padding: 14px;
  border: 1px dashed var(--line);
  border-radius: 10px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

/* ---------- 合计与提交 ---------- */

.checkout-bottom {
  padding-top: 22px;
}

.total-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
}
.total-row > .field-caption {
  flex-shrink: 0;
  margin-bottom: 0;
  white-space: nowrap;
}

.total-and-action {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-left: auto;
}

.total-copy {
  flex-shrink: 0;
  text-align: right;
}
.total-copy strong {
  display: block;
  font-size: 30px;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -1px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.total-copy > small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
  white-space: nowrap;
}

.continue-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 132px;
  padding: 13px 22px;
  border-radius: 11px;
  background: var(--button);
  color: var(--button-text);
  font-size: 14px;
  font-weight: 650;
  transition: filter 0.15s, opacity 0.15s;
}
.continue-button:hover:not(:disabled) {
  filter: brightness(1.12);
}
.continue-button:disabled {
  opacity: 0.4;
}

/* ---------- 页脚 ---------- */

.site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 60px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}
.footer-links {
  display: flex;
  align-items: center;
  gap: 18px;
}

/* 页脚备用联系方式（QQ 等）：有值才显示 */
.footer-contact {
  color: var(--muted);
  font-size: 12px;
}
.footer-contact[hidden] {
  display: none;
}
.footer-contact b {
  color: var(--ink);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  user-select: all;
}
.footer-links button,
.footer-links a {
  color: var(--muted);
  font-size: 12px;
}
.footer-links button:hover,
.footer-links a:hover {
  color: var(--ink);
}

/* ---------- 右侧悬浮快捷入口 ---------- */

.float-actions {
  position: fixed;
  z-index: 40;
  top: 50%;
  right: calc(12px + env(safe-area-inset-right, 0px));
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 24px;
  width: 74px;
}

.float-actions > * {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  width: 100%;
  min-height: 40px;
  margin: 0;
  padding: 8px 2px;
  border: 1px solid var(--plan-edge);
  border-radius: 9px;
  background: var(--plan-selected);
  color: var(--plan-check);
  font-size: 11px;
  font-weight: 650;
  line-height: 1.4;
  white-space: nowrap;
  text-align: center;
  box-shadow: 0 4px 14px rgba(23, 21, 42, 0.05);
  transition: background 0.15s, border-color 0.15s;
}
.float-actions > *:hover {
  border-color: var(--plan-check);
  background: color-mix(in srgb, var(--plan-selected) 72%, var(--plan-edge));
}
.float-actions > *::after {
  flex: 0 0 auto;
  content: "↗";
  font-size: 11px;
  font-weight: 500;
  opacity: 0.78;
}
.float-actions > .detail-float::after {
  content: "›";
  font-size: 14px;
}
.float-actions > button.support-float::after {
  content: "›";
  font-size: 14px;
}
.float-actions .float-stack {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

/* ---------- 弹窗 ---------- */

dialog {
  width: min(520px, calc(100vw - 32px));
  max-height: 85dvh;
  padding: 25px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.13);
  overscroll-behavior: contain;
}
dialog::backdrop {
  background: rgba(21, 35, 28, 0.33);
  backdrop-filter: blur(5px);
}

.dialog-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}
.dialog-heading h2 {
  font-size: 19px;
  font-weight: 650;
  letter-spacing: -0.5px;
}
.dialog-heading button {
  font-size: 25px;
  font-weight: 300;
  line-height: 1;
  color: var(--muted);
}
.dialog-heading button:hover {
  color: var(--ink);
}

.dialog-body {
  max-height: 60dvh;
  overflow: auto;
  padding: 0 2px;
}

.product-detail-facts {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 15px;
  border: 1px solid var(--plan-edge);
  border-radius: 9px;
  background: var(--plan-selected);
}
.product-detail-facts strong {
  font-size: 21px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.product-detail-facts span {
  color: var(--plan-check);
  font-size: 11px;
  font-weight: 600;
}

.rich-content {
  margin-top: 14px;
  font-size: 13px;
  line-height: 1.9;
  overflow-wrap: anywhere;
}
.rich-content > :where(:first-child) { margin-top: 0; }
.rich-content > :where(:last-child) { margin-bottom: 0; }
.rich-content :where(h1, h2, h3, h4, h5, h6) {
  margin: 1.4em 0 0.6em;
  font-weight: 700;
  line-height: 1.35;
}
.rich-content :where(h1) { font-size: 1.5em; }
.rich-content :where(h2) { font-size: 1.3em; }
.rich-content :where(h3) { font-size: 1.15em; }
.rich-content :where(p, ul, ol, dl, table, pre, blockquote, figure) { margin: 0 0 1em; }
.rich-content :where(ul, ol) { padding-left: 1.6em; }
.rich-content :where(ul) > :where(li) { list-style: disc; }
.rich-content :where(ol) > :where(li) { list-style: decimal; }
.rich-content :where(li) { margin: 0.25em 0; }
.rich-content :where(blockquote) {
  padding: 0.6em 1em;
  border-left: 3px solid var(--plan-edge);
  border-radius: 0 6px 6px 0;
  background: var(--plan-selected);
}
.rich-content :where(code) {
  padding: 0.15em 0.4em;
  border-radius: 4px;
  background: var(--tab);
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 0.9em;
}
.rich-content :where(pre) {
  padding: 1em;
  border-radius: 8px;
  background: var(--tab);
  overflow-x: auto;
}
.rich-content :where(pre code) { padding: 0; background: none; }
.rich-content :where(a) { color: var(--plan-check); text-decoration: underline; }
.rich-content :where(img) { max-width: 100%; height: auto; border-radius: 6px; }
.rich-content :where(hr) { margin: 1.6em 0; border: 0; border-top: 1px solid var(--line); }
.rich-content :where(table) { width: 100%; border-collapse: collapse; display: block; overflow-x: auto; }
.rich-content :where(th, td) { padding: 0.5em 0.75em; border: 1px solid var(--line); }
.rich-content :where(th) { background: var(--tab); font-weight: 600; text-align: left; }

/* ---------- 提示条 ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 25px;
  z-index: 999;
  max-width: calc(100% - 32px);
  padding: 10px 18px;
  border-radius: 10px;
  background: var(--button);
  color: var(--button-text);
  font-size: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.13);
  opacity: 0;
  transform: translate(-50%, 15px);
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
}
.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ---------- 独立页面（查单 / 结果） ---------- */

.page-main {
  max-width: 560px;
  margin: 0 auto;
  padding: 56px 0 40px;
}

.page-card {
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.page-card h1 {
  margin-bottom: 6px;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.6px;
}
.page-card > p {
  margin-bottom: 22px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.8;
}

.stack-form {
  display: grid;
  gap: 16px;
}
.stack-form label {
  display: block;
  margin-bottom: 7px;
  font-size: 13px;
  font-weight: 450;
}
.stack-form input {
  width: 100%;
  height: 40px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--field);
  font-size: 13px;
}
.stack-form input:focus {
  outline: none;
  border-color: var(--plan-edge);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--plan-edge) 18%, transparent);
}
.stack-form .continue-button {
  width: 100%;
}

.result-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}
.result-status.pending {
  border: 1px solid var(--plan-edge);
  background: var(--plan-selected);
  color: var(--plan-check);
}
.result-status.paid {
  border: 1px solid color-mix(in srgb, var(--ok) 40%, transparent);
  background: color-mix(in srgb, var(--ok) 10%, transparent);
  color: var(--ok);
}
.result-status.closed {
  border: 1px solid var(--line);
  background: var(--tab);
  color: var(--muted);
}

.order-review {
  margin: 20px 0 22px;
}
.order-review > div {
  display: flex;
  justify-content: space-between;
  gap: 25px;
  margin-bottom: 13px;
  font-size: 12px;
}
.order-review dt {
  flex-shrink: 0;
  color: var(--muted);
}
.order-review dd {
  margin: 0;
  text-align: right;
  overflow-wrap: anywhere;
}
.order-review dd.amount {
  font-size: 22px;
  font-weight: 650;
}

.secret-box {
  position: relative;
  padding: 16px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: 8px;
  background: var(--page);
}
.secret-box h3 {
  margin-bottom: 10px;
  font-size: 13px;
  font-weight: 650;
}
.secret-code {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--field);
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 14px;
  line-height: 1.8;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  user-select: all;
}
.secret-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 10px;
}
.secret-actions button {
  min-height: 36px;
  padding: 6px 14px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  font-size: 12px;
  font-weight: 550;
}
.secret-actions button:first-child {
  border-color: var(--button);
  background: var(--button);
  color: var(--button-text);
}
.secret-actions button:hover {
  border-color: var(--accent);
}

.result-note {
  margin-top: 16px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.8;
}

/* ---------- 私域交付：微信联系卡片 ---------- */

.wechat-box {
  margin-top: 18px;
  padding: 18px;
  border: 1px solid var(--plan-edge, var(--line));
  border-radius: 12px;
  background: var(--page);
}
.wechat-box h3 {
  margin-bottom: 8px;
  font-size: 15px;
  font-weight: 680;
}
.wechat-lead {
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.8;
}
.wechat-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--field);
}
.wechat-row + .wechat-row,
.wechat-row + .wechat-qr,
.wechat-qr + .wechat-row {
  margin-top: 10px;
}
.wechat-label {
  flex-shrink: 0;
  color: var(--muted);
  font-size: 12px;
}
.wechat-id {
  flex: 1;
  min-width: 0;
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 15px;
  font-weight: 650;
  overflow-wrap: anywhere;
  user-select: all;
}
.wechat-row button {
  flex-shrink: 0;
  min-height: 34px;
  padding: 6px 13px;
  border: 1px solid var(--button);
  border-radius: 7px;
  background: var(--button);
  color: var(--button-text);
  font-size: 12px;
  font-weight: 550;
}
.wechat-row button:hover {
  border-color: var(--accent);
}
.wechat-qr {
  display: block;
  width: min(220px, 100%);
  margin: 12px auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}
.wechat-note {
  margin-top: 12px;
  padding: 11px 13px;
  border-left: 3px solid var(--accent);
  border-radius: 6px;
  background: var(--surface);
  font-size: 13px;
  line-height: 1.75;
}
.wechat-box .result-note {
  margin-top: 12px;
}

.page-links {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-top: 22px;
  color: var(--muted);
  font-size: 12px;
}
.page-links a:hover {
  color: var(--ink);
}

/* ---------- 响应式 ---------- */

@media (min-width: 1500px) {
  .category-hero { min-height: 246px; }
  .purchase-panel { min-height: 640px; }
}

@media (max-width: 1190px) {
  .site-shell { width: calc(100% - 60px); }
  .site-header { gap: 13px; }
  .category-tab { padding: 8px 10px; }
  .header-actions { gap: 12px; }
  .category-hero { min-height: 212px; }
  .category-hero h1 { font-size: 56px; }
  .purchase-panel { gap: 28px; padding: 26px; grid-template-columns: minmax(0, 0.78fr) minmax(0, 1.1fr); }
  .plans-pane { padding-right: 28px; }
  .total-and-action { gap: 14px; }
  .continue-button { min-width: 115px; padding: 12px 19px; }
  .total-copy strong { font-size: 27px; }
  .hero-art { --hero-mark-size: 152px; }
}

@media (max-width: 950px) {
  .site-header { grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; padding: 10px 0; }
  .category-tabs { grid-column: 2; grid-row: 1; justify-self: stretch; width: auto; min-width: 0; }
  .header-actions { grid-column: 3; grid-row: 1; gap: 12px; }
  .category-hero { min-height: 196px; padding: 30px 0 34px; }
  .purchase-panel { gap: 22px; padding: 23px; grid-template-columns: minmax(0, 0.83fr) minmax(0, 1.1fr); }
  .plans-pane { padding-right: 22px; }
  .payment-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .payment-option:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .total-row { align-items: flex-start; }
  .total-and-action { flex-wrap: wrap; justify-content: flex-end; gap: 13px; }
  .site-footer { margin-top: 50px; }
}

@media (max-width: 700px) {
  .site-shell { width: calc(100% - 36px); }
  .site-header { gap: 9px; }
  .brand { gap: 6px; }
  .brand-mark { width: 42px; height: 29px; }
  .brand-wordmark { font-size: 21px; letter-spacing: -0.8px; max-width: 120px; }
  .header-actions { gap: 7px; }
  .login-button { padding: 7px 9px; }
  .category-tabs { gap: 2px; padding: 4px; border-radius: 12px; overflow: hidden; scrollbar-width: none; }
  .category-tab { flex: 1; min-width: 0; min-height: 34px; gap: 3px; padding: 7px 4px; font-size: 11px; border-radius: 9px; }
  .category-tab svg { width: 16px; height: 16px; }
  .category-tab span { overflow: hidden; text-overflow: ellipsis; }
  /* 窄屏下分类只留图形，避免文字被挤成半个字符 */
  .category-tab[data-category] span { display: none; }
  .category-tab.notice-tab span { display: inline; }
  .category-hero { min-height: 172px; padding: 24px 0 30px; gap: 15px; }
  .category-hero h1 { margin-bottom: 0; font-size: 45px; letter-spacing: -2.2px; line-height: 1.12; }
  .hero-art { width: 42%; flex-shrink: 0; --hero-mark-size: clamp(104px, 26vw, 132px); }
  .purchase-panel { display: block; min-height: 0; padding: 20px 18px; border-radius: 17px; }
  .plans-pane { padding: 0 0 24px; border-right: 0; border-bottom: 1px solid var(--line); }
  .section-heading { margin-bottom: 15px; }
  .section-heading h2 { font-size: 16px; }
  .plan-search { margin-bottom: 12px; padding-bottom: 8px; }
  .plan-list { gap: 9px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .plan-card { min-height: 117px; padding: 13px 12px 11px; border-radius: 10px; }
  .plan-price { margin-right: 13px; margin-bottom: 9px; font-size: 21px; letter-spacing: -0.7px; }
  .plan-price small { font-size: 10px; }
  .plan-radio { top: 17px; right: 10px; width: 15px; height: 15px; border-radius: 5px; }
  .plan-card[aria-pressed="true"] .plan-radio::after { left: 4px; top: 2px; width: 4px; height: 7px; }
  .plan-title { font-size: 11px; line-height: 1.7; }
  .plan-foot { gap: 3px 5px; margin-top: 5px; font-size: 9px; }
  .checkout-pane { padding-top: 24px; }
  .section-description { margin-bottom: 20px; font-size: 10px; line-height: 1.9; }
  .order-fields { gap: 15px 12px; min-height: 0; margin-bottom: 24px; }
  .order-fields .captcha-field { grid-column: 1 / -1; }
  .order-fields label, .form-label { font-size: 12px; }
  .order-fields input { font-size: 12px; }
  .selection-summary { gap: 12px; padding: 16px 0; }
  .selected-copy strong { font-size: 13px; }
  .payment-list { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .payment-option { padding: 10px; }
  .payment-name { font-size: 12px; }
  .total-and-action { width: 100%; justify-content: space-between; }
  .total-copy { text-align: left; }
  .total-copy strong { font-size: 26px; }
  .continue-button { flex: 1; min-width: 120px; }
  .site-footer { flex-direction: column; align-items: flex-start; gap: 10px; margin-top: 40px; }
  /* 窄屏改为底部操作栏，避免遮挡套餐卡片 */
  .site-shell { padding-bottom: 88px; }
  .float-actions {
    top: auto;
    right: 0;
    left: 0;
    bottom: 0;
    transform: none;
    flex-direction: row;
    gap: 8px;
    width: auto;
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid var(--line);
    background: var(--surface);
  }
  .float-actions > * {
    flex: 1;
    min-height: 44px;
    padding: 8px 6px;
    font-size: 12px;
    box-shadow: none;
  }
  .page-main { padding: 30px 0 30px; }
  .page-card { padding: 22px 18px; border-radius: 17px; }
}

@media (max-width: 370px) {
  .site-shell { width: calc(100% - 24px); }
  .category-hero h1 { font-size: 40px; }
  .category-tab { padding: 7px 3px; font-size: 10px; }
  .purchase-panel { padding: 18px 14px; }
  .plan-price { font-size: 19px; }
  .plan-card { padding-left: 10px; padding-right: 10px; }
  .total-and-action { gap: 9px; }
  .continue-button { min-width: 88px; padding: 11px 12px; }
  .total-copy strong { font-size: 23px; }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
