:root {
  --accent: #0064db;
  --accent-hover: #0054ba;
  --accent-soft: #e8f2ff;
  --ink: #182230;
  --muted: #5e6b7c;
  --line: #dce3ec;
  --surface: #ffffff;
  --surface-subtle: #f5f7fa;
  --danger: #c9362b;
  --success: #16835c;
  font-family: "Microsoft YaHei UI", "PingFang SC", system-ui, sans-serif;
  color: var(--ink);
  background: var(--surface-subtle);
}
.recharge-preview { padding: 14px 16px; margin: 0 0 20px; border-radius: 6px; background: var(--accent-soft); color: #20456f; font-size: 14px; line-height: 1.7; font-variant-numeric: tabular-nums; }

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { min-width: 320px; }

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--surface-subtle);
  color: var(--ink);
  letter-spacing: 0;
}

button, input { font: inherit; }
button { letter-spacing: 0; }

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

::selection { color: #fff; background: var(--accent); }

:focus-visible {
  outline: 3px solid rgba(22, 119, 255, 0.32);
  outline-offset: 2px;
}

.site-header {
  height: 72px;
  padding: 0 max(24px, calc((100vw - 1120px) / 2));
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: #fff;
  background: var(--ink);
  font-size: 20px;
  font-weight: 800;
}

.brand strong, .brand small { display: block; }
.brand strong { font-size: 16px; }
.brand small { margin-top: 2px; color: var(--muted); font-size: 12px; }

.secure-label {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--success);
  font-size: 13px;
  font-weight: 700;
}

.secure-label svg { width: 17px; }
.header-actions { display: flex; align-items: center; gap: 22px; }
.header-link { display: inline-flex; align-items: center; gap: 7px; color: var(--ink); font-size: 13px; font-weight: 700; text-decoration: none; }
.header-link:hover { color: var(--accent); }
.header-link svg { width: 17px; }

main { width: min(1120px, calc(100% - 48px)); margin: 0 auto; }

.intro {
  min-height: 172px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 48px;
}

.intro h1 { margin: 0; font-size: 30px; line-height: 1.2; letter-spacing: 0; }
.intro p { margin: 10px 0 0; color: var(--muted); font-size: 15px; }

.steps {
  display: grid;
  grid-template-columns: repeat(3, 118px);
  margin: 0;
  padding: 0;
  list-style: none;
}

.steps li {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  color: #637186;
  font-size: 12px;
}

.steps li::after {
  content: "";
  position: absolute;
  z-index: 0;
  top: 13px;
  left: calc(50% + 17px);
  width: calc(100% - 34px);
  height: 1px;
  background: var(--line);
}

.steps li:last-child::after { display: none; }
.steps span {
  position: relative;
  z-index: 1;
  width: 27px;
  height: 27px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--surface-subtle);
  font-variant-numeric: tabular-nums;
}
.steps .is-current { color: var(--accent); font-weight: 700; }
.steps .is-current span { border-color: var(--accent); color: #fff; background: var(--accent); }

.payment-shell {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(300px, 0.65fr);
  margin-bottom: 64px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface);
}

#order-form { padding: 40px 48px 44px; }

.form-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 30px;
}

.form-heading h2 { margin: 0; font-size: 20px; }

.channel-label {
  padding: 5px 10px;
  border-radius: 999px;
  color: var(--accent);
  background: var(--accent-soft);
  font-size: 12px;
  font-weight: 700;
}

.field { margin: 0 0 21px; padding: 0; border: 0; }
.field label, .field legend { display: block; margin-bottom: 9px; font-size: 13px; font-weight: 700; }

.input-wrap {
  height: 46px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 13px;
  border: 1px solid #cbd4df;
  border-radius: 6px;
  background: #fff;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.input-wrap:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(22, 119, 255, 0.11); }
.input-wrap.has-error { border-color: var(--danger); box-shadow: 0 0 0 3px rgba(201, 54, 43, 0.09); }
.input-wrap svg { width: 17px; color: #7b8797; }
.input-wrap input { min-width: 0; flex: 1; border: 0; outline: 0; color: var(--ink); background: transparent; }
.input-wrap input::placeholder { color: #657286; opacity: 1; }

.field-error { min-height: 17px; margin: 5px 0 0; color: var(--danger); font-size: 12px; }

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

.payment-method-option {
  min-width: 0;
  min-height: 58px;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 12px;
  border: 1px solid #cbd4df;
  border-radius: 6px;
  color: #415065;
  background: #fff;
  text-align: left;
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease, transform 100ms ease;
}

.payment-method-option:hover { border-color: #7eb2f7; }
.payment-method-option:active { transform: translateY(1px); }
.payment-method-option.is-selected { border-color: var(--accent); background: var(--accent-soft); }
.payment-method-option:disabled { cursor: not-allowed; opacity: 0.45; }
.payment-method-option > span:last-child { min-width: 0; }
.payment-method-option strong, .payment-method-option small { display: block; }
.payment-method-option strong { color: var(--ink); font-size: 14px; }
.payment-method-option small { margin-top: 3px; color: var(--muted); font-size: 11px; }

.method-icon {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  flex: none;
  border-radius: 6px;
  color: #fff;
}
.method-icon svg { width: 17px; }
.method-icon.is-alipay { background: #1677ff; }
.method-icon.is-wechat { background: #07a94e; }

.amount-options { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.amount-option {
  height: 42px;
  border: 1px solid #cbd4df;
  border-radius: 6px;
  color: #415065;
  background: #fff;
  cursor: pointer;
  transition: border-color 160ms ease, color 160ms ease, background 160ms ease, transform 100ms ease;
}
.amount-option:hover { border-color: #7eb2f7; color: var(--accent); }
.amount-option:active { transform: translateY(1px); }
.amount-option.is-selected { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); font-weight: 700; }

.custom-amount { margin-top: 12px; }
.amount-input { width: 220px; }
.amount-input > span { color: var(--muted); font-weight: 700; }

.notice { margin: 0 0 18px; padding: 11px 12px; border-radius: 6px; font-size: 13px; }
.notice-error { color: #912b23; background: #fff0ee; }

.primary-button, .secondary-button {
  width: 100%;
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border-radius: 6px;
  font-weight: 700;
  cursor: pointer;
  transition: background 160ms ease, transform 100ms ease, opacity 160ms ease;
}
.primary-button { border: 1px solid var(--accent); color: #fff; background: var(--accent); }
.primary-button:hover { background: var(--accent-hover); }
.primary-button:active, .secondary-button:active { transform: translateY(1px); }
.primary-button:disabled { cursor: wait; opacity: 0.62; }
.primary-button svg, .secondary-button svg { width: 18px; }

.agreement { margin: 11px 0 0; text-align: center; color: var(--muted); font-size: 12px; }

.order-guide {
  padding: 40px 34px;
  border-left: 1px solid var(--line);
  background: #f8fafd;
}

.payment-sign { display: flex; align-items: center; gap: 12px; padding-bottom: 27px; border-bottom: 1px solid var(--line); }
.payment-glyph { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 8px; color: #fff; background: #1677ff; font-size: 24px; font-weight: 800; }
.payment-sign.is-wechat .payment-glyph { background: #07a94e; }
.payment-sign strong, .payment-sign small { display: block; }
.payment-sign strong { font-size: 17px; }
.payment-sign small { margin-top: 3px; color: var(--muted); font-size: 12px; }

.order-guide dl { margin: 27px 0 0; }
.order-guide dl > div + div { margin-top: 25px; }
.order-guide dt { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 700; }
.order-guide dt svg { width: 17px; color: var(--accent); }
.order-guide dd { margin: 7px 0 0 25px; color: var(--muted); font-size: 12px; line-height: 1.75; }
.safety-note { display: flex; align-items: flex-start; gap: 8px; margin-top: 30px; padding-top: 19px; border-top: 1px solid var(--line); color: #5d6877; }
.safety-note svg { width: 16px; flex: none; margin-top: 2px; }
.safety-note p { margin: 0; font-size: 12px; line-height: 1.7; }

footer {
  width: min(1120px, calc(100% - 48px));
  margin: -30px auto 34px;
  display: flex;
  justify-content: space-between;
  color: #778394;
  font-size: 12px;
}
footer a { color: inherit; text-underline-offset: 3px; }

dialog {
  width: min(430px, calc(100% - 30px));
  max-height: calc(100dvh - 30px);
  padding: 0;
  border: 0;
  border-radius: 8px;
  color: var(--ink);
  background: var(--surface);
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.24);
  overflow: auto;
}
dialog::backdrop { background: rgba(17, 28, 44, 0.62); backdrop-filter: blur(3px); }

.dialog-head { display: flex; justify-content: space-between; gap: 20px; padding: 22px 24px 18px; border-bottom: 1px solid var(--line); }
.dialog-head h2 { margin: 0; font-size: 19px; }
.dialog-head p { margin: 5px 0 0; color: var(--muted); font-size: 12px; }
.dialog-body { padding: 24px; }

.icon-button { width: 36px; height: 36px; display: grid; place-items: center; flex: none; padding: 0; border: 1px solid var(--line); border-radius: 6px; color: #536175; background: #fff; cursor: pointer; }
.icon-button:hover { color: var(--accent); border-color: #a8c9f5; }
.icon-button:active { transform: translateY(1px); }
.icon-button svg { width: 18px; }
.icon-button.compact { width: 30px; height: 30px; }
.icon-button.compact svg { width: 15px; }

.payment-amount { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 18px; }
.payment-amount > span { color: var(--muted); font-size: 13px; }
.payment-amount strong { font-size: 20px; }
.payment-amount b { font-size: 30px; font-variant-numeric: tabular-nums; }

.qr-frame { position: relative; width: min(270px, 80vw); aspect-ratio: 1; display: grid; place-items: center; margin: 0 auto; padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: #fff; overflow: hidden; }
.qr-frame img { width: 100%; height: 100%; object-fit: contain; image-rendering: pixelated; }
.qr-skeleton { width: 100%; height: 100%; background: #eef2f6; animation: skeleton 1.2s ease-in-out infinite alternate; }
@keyframes skeleton { to { background: #e2e8ef; } }
.qr-error { display: flex; flex-direction: column; align-items: center; gap: 8px; color: var(--muted); text-align: center; }
.qr-error svg { width: 28px; color: var(--danger); }
.qr-error strong { color: var(--ink); font-size: 14px; }
.qr-error span { font-size: 12px; }

.order-reference { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 9px; margin-top: 16px; padding: 10px 12px; border-radius: 6px; background: var(--surface-subtle); }
.order-reference > span { color: var(--muted); font-size: 12px; }
.order-reference code { min-width: 0; overflow: hidden; color: #344258; font-family: ui-monospace, Consolas, monospace; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }

.payment-status { display: flex; align-items: center; gap: 12px; margin-top: 18px; padding: 12px 14px; border-radius: 6px; background: #f0f6ff; }
.payment-status strong, .payment-status small { display: block; }
.payment-status strong { font-size: 13px; }
.payment-status small { margin-top: 4px; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.status-pulse { width: 9px; height: 9px; flex: none; border-radius: 50%; background: var(--accent); }
.payment-status.is-paid { color: #0f6948; background: #eaf8f2; }
.payment-status.is-paid .status-pulse { background: var(--success); animation: none; }
.payment-status.is-closed { color: #7b332c; background: #fff0ee; }
.payment-status.is-closed .status-pulse { background: var(--danger); animation: none; }

.secondary-button { margin-top: 14px; border: 1px solid #9cc4f8; color: var(--accent); background: #fff; }
.secondary-button:hover { background: var(--accent-soft); }
.dialog-footnote { margin: 13px 0 0; color: var(--muted); text-align: center; font-size: 12px; }

.toast { position: fixed; z-index: 20; left: 50%; bottom: 24px; max-width: calc(100% - 32px); transform: translateX(-50%); padding: 10px 14px; border-radius: 6px; color: #fff; background: #263348; box-shadow: 0 10px 30px rgba(23, 34, 49, 0.22); font-size: 13px; }

@media (max-width: 800px) {
  .site-header { padding: 0 18px; }
  main { width: min(100% - 30px, 620px); }
  .intro { min-height: 0; padding: 34px 0 28px; flex-direction: column; align-items: stretch; gap: 27px; }
  .intro h1 { font-size: 26px; }
  .steps { grid-template-columns: repeat(3, 1fr); }
  .payment-shell { grid-template-columns: 1fr; }
  #order-form { padding: 30px 24px 32px; }
  .order-guide { padding: 28px 24px; border-top: 1px solid var(--line); border-left: 0; }
  footer { width: calc(100% - 30px); margin-top: -35px; }
}

@media (max-width: 480px) {
  .site-header { height: 64px; }
  .brand small { display: none; }
  .secure-label { font-size: 12px; }
  .secure-label { display: none; }
  .amount-options { grid-template-columns: repeat(2, 1fr); }
  .payment-methods { grid-template-columns: 1fr; }
  .amount-input { width: 100%; }
  .payment-shell { margin-bottom: 72px; }
  footer { flex-direction: column; align-items: center; gap: 7px; }
  .dialog-body { padding: 20px; }
}

@media (prefers-reduced-motion: reduce) {
  body:not(.game-page) *, body:not(.game-page) *::before, body:not(.game-page) *::after { scroll-behavior: auto !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
