[data-shop-url] {
  color: #1d2c43;
  font: 14px/1.45 "Microsoft YaHei UI", "Segoe UI", sans-serif;
  accent-color: #1769de;
}

:where([data-shop-url]) * { box-sizing: border-box; }
:where([data-shop-url]) [hidden] { display: none !important; }
body[data-shop-url] { margin: 0; padding: 12px 16px 16px; background: #fff; }
:where([data-shop-url]) main { max-width: 840px; margin-inline: auto; }
:where([data-shop-url]) h2, :where([data-shop-url]) p { margin: 0; }
:where([data-shop-url]) h2 { font-size: 16px; }
:where([data-shop-url]) button { font: inherit; cursor: pointer; color: inherit; background: #fff; border: 1px solid #c6d4e8; border-radius: 5px; padding: 5px 12px; }
:where([data-shop-url]) button:disabled { cursor: default; }
:where([data-shop-url]) button:focus-visible { outline: 2px solid #1769de; outline-offset: 2px; }
:where([data-shop-url]) .link { color: #275c9d; border: 1px solid #e0e8f3; border-radius: 6px; background: #f8faff; padding: 4px 10px; font-size: 12px; white-space: nowrap; }
:where([data-shop-url]) .link:hover { background: #eef4fc; }
:where([data-shop-url]) .primary { background: #1769de; border-color: #1769de; color: #fff; }
:where([data-shop-url]) .row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
:where([data-shop-url]) fieldset { margin: 0; padding: 0; border: 0; min-width: 0; }
:where([data-shop-url]) .buy-heading { justify-content: flex-end; margin-bottom: 12px; }
:where([data-shop-url]) .offer { margin: 10px 0; padding: 8px 10px; border: 1px solid #dce5f1; border-radius: 7px; }
:where([data-shop-url]) .offer summary { color: #275c9d; cursor: pointer; }
:where([data-shop-url]) .offer-fields, :where([data-shop-url]) .referral-actions { display: flex; gap: 8px; flex-wrap: wrap; }
:where([data-shop-url]) .offer-fields { margin-top: 8px; }
:where([data-shop-url]) .offer-fields input { width: min(140px, 100%); padding: 5px 8px; font: inherit; border: 1px solid #c6d4e8; border-radius: 5px; }
:where([data-shop-url]) .offer p { margin-top: 6px; font-size: 12px; }
:where([data-shop-url]) .referral-code-panel { margin-bottom: 14px; padding: 12px; border: 1px solid #dce5f1; border-radius: 9px; background: #f8faff; }
:where([data-shop-url]) .referral-code { display: flex; align-items: center; justify-content: space-between; gap: 10px 16px; flex-wrap: wrap; }
:where([data-shop-url]) .referral-code-value { display: grid; gap: 2px; }
:where([data-shop-url]) .referral-code-value span { color: #50627d; font-size: 12px; }
:where([data-shop-url]) .referral-code-value strong { font: 700 19px/1.25 "Cascadia Mono", "Consolas", monospace; letter-spacing: .05em; }
:where([data-shop-url]) .referral-code .link { background: #fff; }
:where([data-shop-url]) .referral-code .link:hover { background: #eef4fc; }
:where([data-shop-url]) .referral-balance-header { margin-bottom: 8px; }
:where([data-shop-url]) .referral-balances { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
:where([data-shop-url]) .referral-balances > div { flex: 1 0 76px; border: 1px solid #dce5f1; border-radius: 7px; padding: 8px; }
:where([data-shop-url]) .referral-balances strong { display: block; margin-top: 2px; }
:where([data-shop-url]) .referral-withdrawal-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
:where([data-shop-url]) .referral-withdrawal-actions button { white-space: nowrap; }
:where([data-shop-url]) .referral-withdrawal-actions button:disabled { background: #eef3fa; color: #50627d; border-color: #dce5f1; }
:where([data-shop-url]) #referral-withdrawal-availability { font-size: 12px; color: #50627d; }
:where([data-shop-url]) #referral-withdrawal-availability:empty { display: none; }
:where([data-shop-url]) .referral-withdrawal { display: grid; gap: 10px; margin: 10px 0; padding: 8px 10px; border: 1px solid #dce5f1; border-radius: 7px; }
:where([data-shop-url]) .referral-withdrawal-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); gap: 8px; }
:where([data-shop-url]) .referral-withdrawal label { display: grid; gap: 3px; }
:where([data-shop-url]) .referral-withdrawal input:not([type=hidden]) { width: 100%; padding: 6px 8px; font: inherit; border: 1px solid #c6d4e8; border-radius: 5px; }
:where([data-shop-url]) .referral-withdrawal [type=submit] { justify-self: start; }
:where([data-shop-url]) .referral-withdrawal [type=submit]:disabled { opacity: .6; }
:where([data-shop-url]) .referral-code-panel p:not(:empty), :where([data-shop-url]) #referral-withdrawal-message:not(:empty) { margin-top: 6px; color: #50627d; font-size: 12px; }
:where([data-shop-url]) #referral-withdrawal-history { margin-top: 12px; }
:where([data-shop-url]) .referral-rules { margin: 12px 0; padding: 10px 12px; border: 1px solid #dce5f1; border-radius: 7px; background: #f8faff; }
:where([data-shop-url]) .referral-rules ul { margin: 6px 0 0; padding-inline-start: 1.3em; }
:where([data-shop-url]) .referral-rules li + li { margin-top: 4px; }
:where([data-shop-url]) .referral-result { display: flex; flex-wrap: wrap; gap: 4px 12px; justify-content: space-between; padding: 7px 0; border-bottom: 1px solid #edf1f6; font-size: 12px; }
:where([data-shop-url]) #referral-message:empty { display: none; }
:where([data-shop-url]) #referral-message { margin-bottom: 8px; }

:where([data-shop-url]) .plans {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-auto-rows: 1fr;
  gap: 10px;
}

:where([data-shop-url]) .plan, :where([data-shop-url]) .channel { position: relative; cursor: pointer; }
:where([data-shop-url]) .plan input, :where([data-shop-url]) .channel input, :where([data-shop-url]) .sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

:where([data-shop-url]) .plan {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  min-width: 0;
  min-height: 104px;
  padding: 11px 13px;
  border: 1px solid #dce5f1;
  border-radius: 9px;
  background: #f8faff;
}

:where([data-shop-url]) .plan:hover, :where([data-shop-url]) .channel:hover { border-color: #8eadd8; }
:where([data-shop-url]) .plan:has(:checked), :where([data-shop-url]) .channel:has(:checked) { border-color: #1769de; background: #edf5ff; }
:where([data-shop-url]) .plan:has(:checked) { box-shadow: inset 0 0 0 1px #1769de; }
:where([data-shop-url]) .plan:has(:focus-visible), :where([data-shop-url]) .channel:has(:focus-visible) { outline: 2px solid #1769de; outline-offset: 2px; }
:where([data-shop-url]) .plan:has(:checked)::after {
  content: "";
  position: absolute;
  top: 12px;
  right: 13px;
  width: 8px;
  height: 5px;
  border: solid #1769de;
  border-width: 0 0 2px 2px;
  transform: rotate(-45deg);
}
:where([data-shop-url]) .plan-heading { display: flex; flex-wrap: wrap; align-items: center; gap: 3px 6px; max-width: 100%; padding-right: 18px; }
:where([data-shop-url]) .plan-name { font-weight: 650; overflow-wrap: anywhere; }
:where([data-shop-url]) .plan-tag { background: #fef3c7; color: #92400e; border-radius: 999px; padding: 0 6px; font-size: 11px; font-weight: 700; white-space: nowrap; }
:where([data-shop-url]) .plan-price { color: #154e99; font-size: 27px; line-height: 1.12; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
:where([data-shop-url]) .plan-price span { margin-right: 2px; font-size: 15px; }
:where([data-shop-url]) .plan--gold {
  border-color: #f59e0b;
  background: linear-gradient(180deg, #fffaf0 0%, #fff 62%);
}
:where([data-shop-url]) .plan--gold:hover { border-color: #b45309; }
:where([data-shop-url]) .plan--gold .plan-price { color: #a5500b; }
:where([data-shop-url]) .plan--gold:has(:checked) {
  border-color: #b45309;
  background: #fff5dc;
  box-shadow: inset 0 0 0 1px #b45309;
}
:where([data-shop-url]) .plan--gold:has(:checked)::after { border-color: #92400e; }
:where([data-shop-url]) .plan-description {
  font-size: 12px;
  color: #586981;
  white-space: pre-line;
  overflow-wrap: anywhere;
}

:where([data-shop-url]) .pay-actions {
  flex-wrap: wrap;
  margin-top: 12px;
  padding: 10px 11px;
  border: 1px solid #e6edf6;
  border-radius: 9px;
  background: #f8faff;
}
:where([data-shop-url]) .channels { display: flex; flex-wrap: wrap; gap: 6px; }
:where([data-shop-url]) .channel {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 9px;
  border: 1px solid #dce5f1;
  border-radius: 6px;
  background: #fff;
  font-size: 13px;
}
:where([data-shop-url]) .channel-mark { display: grid; place-items: center; width: 18px; height: 18px; color: #fff; background: #087bb8; border-radius: 4px; font-size: 11px; font-weight: 700; }
:where([data-shop-url]) .channel--wxpay .channel-mark { background: #188448; }
:where([data-shop-url]) .pay-confirmation {
  display: flex; align-items: center; gap: 8px; min-width: 0; margin-inline-start: auto;
}
:where([data-shop-url]) .pay-consent { display: flex; align-items: center; gap: 4px; }
:where([data-shop-url]) .pay-consent input { flex: none; width: 16px; height: 16px; margin: 0; }
:where([data-shop-url]) .pay-consent label { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
:where([data-shop-url]) .pay-consent a {
  display: inline-flex; align-items: center; color: #154e99; text-decoration: underline; white-space: nowrap;
}
:where([data-shop-url]) .pay-submit { flex-shrink: 0; min-width: 134px; min-height: 38px; border-radius: 6px; font-weight: 650; }
:where([data-shop-url]) .pay-submit:hover:not(:disabled) { background: #1057bc; }
:where([data-shop-url]) .pay-submit:disabled { color: #586981; background: #e7edf6; border-color: #e7edf6; }
:where([data-shop-url]) #buy-message { margin-top: 8px; }
:where([data-shop-url]) #buy-message { color: #9a3423; }
:where([data-shop-url]) dialog { width: min(370px, calc(100% - 16px)); max-height: calc(100% - 16px); padding: 12px 16px; color: inherit; background: #fff; border: 1px solid #d7e0ef; border-radius: 8px; }
:where([data-shop-url]) dialog::backdrop { background: #17254070; }
:where([data-shop-url]) dialog [data-close][aria-label] { border: 0; padding: 0 5px; font-size: 20px; }
:where([data-shop-url]) #license-agreement-dialog { width: min(760px, calc(100% - 24px)); padding: 0; }
:where([data-shop-url]) #license-agreement-dialog iframe {
  display: block; width: 100%; height: min(70vh, 640px); border: 0;
}
:where([data-shop-url]) #payment {
  width: min(600px, calc(100% - 24px));
  max-height: calc(100% - 16px);
  padding: 0;
  border-radius: 12px;
  box-shadow: 0 16px 48px #17254026;
}
:where([data-shop-url]) .pay-header { padding: 9px 20px; border-bottom: 1px solid #e6edf6; }
:where([data-shop-url]) .pay-header h2 { font-size: 17px; }
:where([data-shop-url]) #payment .pay-header button { width: 30px; min-height: 30px; color: #586981; }
:where([data-shop-url]) #payment .pay-header button:hover { background: #eef4fc; }
:where([data-shop-url]) .pay-body {
  display: grid;
  grid-template-areas: "summary" "code" "message";
  gap: 10px;
  padding: 12px 20px;
  overflow-wrap: anywhere;
}
:where([data-shop-url]) #summary { grid-area: summary; display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; }
:where([data-shop-url]) #pay-amount { color: #154e99; font-size: 24px; line-height: 1.15; font-variant-numeric: tabular-nums; }
:where([data-shop-url]) #pay-plan { font-weight: 650; }
:where([data-shop-url]) .pay-order { flex-basis: 100%; color: #586981; font-size: 12px; }
:where([data-shop-url]) #pay-order-number { font-variant-numeric: tabular-nums; }
:where([data-shop-url]) #pay-code { grid-area: code; display: grid; place-items: center; }
:where([data-shop-url]) #pay-code iframe { display: block; border: 0; width: 216px; height: 216px; }
:where([data-shop-url]) #pay-code img { width: 200px; height: 200px; image-rendering: pixelated; }
:where([data-shop-url]) #pay-message { grid-area: message; color: #435672; }
:where([data-shop-url]) #pay-buttons { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; padding: 10px 20px; border-top: 1px solid #e6edf6; background: #f8faff; }
:where([data-shop-url]) #pay-buttons:not(:has(button:not([hidden]))) { display: none; }
:where([data-shop-url]) #pay-buttons button { min-height: 32px; }
:where([data-shop-url]) #check:not(:disabled):hover, :where([data-shop-url]) #refresh:not(:disabled):hover { background: #edf5ff; }
:where([data-shop-url]) #orders { width: min(460px, calc(100% - 16px)); }
:where([data-shop-url]) .orders-toolbar { justify-content: flex-end; }
:where([data-shop-url]) #orders-list { display: grid; gap: 6px; margin-top: 8px; }
:where([data-shop-url]) .recent-order { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 8px; text-align: left; overflow-wrap: anywhere; }
:where([data-shop-url]) .recent-order:hover { background: #f8faff; }
:where([data-shop-url]) .recent-order-number { display: block; color: #586981; font-size: 12px; font-variant-numeric: tabular-nums; }
:where([data-shop-url]) .recent-order-status { border-radius: 6px; padding: 3px 6px; color: #475569; background: #eef2f7; font-size: 12px; white-space: nowrap; }
:where([data-shop-url]) .recent-order-status[data-status="0"] { color: #854d0e; background: #fef3c7; }
:where([data-shop-url]) .recent-order-status[data-status="1"],
:where([data-shop-url]) .recent-order-status[data-status="2"] { color: #166534; background: #dcfce7; }
:where([data-shop-url]) .recent-order-status[data-status="4"] { color: #5b21b6; background: #ede9fe; }

@media (min-width: 500px) {
  :where([data-shop-url]) .pay-body:has(#pay-code:not([hidden])) {
    grid-template-columns: minmax(0, 1fr) 232px;
    grid-template-areas: "summary code" "summary message";
    gap: 4px 20px;
    padding-block: 8px 12px;
  }
  :where([data-shop-url]) .pay-body:has(#pay-code:not([hidden])) #summary {
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 10px;
  }
  :where([data-shop-url]) .pay-body:has(#pay-code:not([hidden])) #pay-amount { font-size: 34px; }
  :where([data-shop-url]) .pay-body:has(#pay-code:not([hidden])) .pay-order { flex-basis: auto; }
}

:where([data-shop-url]) #pay-code:not([hidden]) + #pay-message { text-align: center; }

@media (max-width: 499px) {
  :where([data-shop-url]) .pay-header, :where([data-shop-url]) #pay-buttons { padding: 5px 12px; }
  :where([data-shop-url]) .pay-body { gap: 4px; padding: 5px 12px; }
  :where([data-shop-url]) #pay-amount { font-size: 21px; }
  :where([data-shop-url]) #pay-code iframe { zoom: .9; }
  :where([data-shop-url]) #pay-message { font-size: 13px; }
  :where([data-shop-url]) #pay-buttons { position: sticky; bottom: 0; }
}

@media (max-width: 460px) {
  body[data-shop-url] { padding-inline: 10px; }
  :where([data-shop-url]) .plans { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  :where([data-shop-url]) .pay-confirmation--consent {
    width: 100%; margin-inline-start: 0; flex-direction: column; align-items: stretch; gap: 4px;
  }
  :where([data-shop-url]) .pay-consent { flex-wrap: wrap; font-size: 16px; }
  :where([data-shop-url]) .pay-consent input { width: 22px; height: 22px; }
  :where([data-shop-url]) .pay-consent label,
  :where([data-shop-url]) .pay-consent a,
  :where([data-shop-url]) .pay-confirmation--consent .pay-submit { min-height: 44px; }
}

@media (max-width: 350px) {
  :where([data-shop-url]) .pay-actions { align-items: stretch; flex-direction: column; }
  :where([data-shop-url]) .pay-confirmation { justify-content: flex-end; margin-inline-start: 0; }
  :where([data-shop-url]) .pay-submit:only-child { width: 100%; }
}

/* 独立购买页也加载此表，覆盖触屏手势和聚焦字号。 */
@media (any-pointer: coarse) {
  :where([data-shop-url]) :is(a, button, input, label, summary) {
    touch-action: manipulation;
  }

  :where([data-shop-url]) .offer-fields input,
  :where([data-shop-url]) .referral-withdrawal input:not([type=hidden]) {
    font-size: 16px;
  }
}
