/* FlowsToken wallet top-up — Waffo active, Alipay maintenance (v=20260913waffomaint1) */

/*
 * FOUC guard — NARROW selectors only.
 * Do NOT use broad min-h-16 / div.grid:has(...) here: those match console sidebar
 * and clip the top menu / break scroll on non-wallet pages.
 */
#topup-amount,
label[for="topup-amount"],
div:has(> #topup-amount) {
  display: none !important;
}

/* Stock pay CTAs by explicit pay aria only */
button[data-slot="button"][aria-label="点击充值"],
button[data-slot="button"][aria-label^="点击充值"],
button[data-slot="button"][aria-label*="Waffo"],
button[data-slot="button"][aria-label*="Pancake"],
button[data-slot="button"][aria-label*="waffo"] {
  display: none !important;
}

/* JS-tagged stock nodes (only classes our wallet JS adds) */
.ft-stock-hide,
.ft-stock-online,
.ft-stock-presets,
.ft-stock-preset,
.ft-stock-custom,
.ft-stock-pay,
button.ft-waffo-pay-btn,
button[data-ft-waffo-cta="1"] {
  display: none !important;
}

/* Custom overlay is a sibling of stock sections — not matched by FOUC :has() hides */

button[aria-label="Waffo Pancake"] span,
button[aria-label="Waffo Pancake"] svg,
button.ft-waffo-pay-btn span,
button.ft-waffo-pay-btn svg,
button.ft-waffo-pay-btn .ft-waffo-cta-label,
button[data-ft-waffo-cta="1"] span,
button[data-ft-waffo-cta="1"] svg {
  color: #F4F7F5 !important;
  stroke: currentColor;
}

.ft-usd-input-wrap {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  width: 100%;
  min-width: 0;
}
.ft-usd-input-wrap .ft-usd-prefix {
  flex: 0 0 auto;
  font-weight: 700;
  font-size: 1.125rem;
  line-height: 1;
  color: inherit;
  opacity: 0.9;
  padding-left: 0.15rem;
  user-select: none;
}
.ft-usd-input-wrap input#topup-amount {
  flex: 1 1 auto;
  min-width: 0;
  width: 100%;
}

.ft-topup-overlay {
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  width: 100%;
  margin: 0 0 1.5rem;
  padding: 1.35rem 1.4rem 1.45rem;
  border-radius: 16px;
  border: 1px solid rgba(27, 77, 62, 0.18);
  background: linear-gradient(180deg, #f7faf8 0%, #eef5f1 100%);
  box-shadow: 0 10px 28px rgba(20, 61, 49, 0.07);
}
.ft-pay-boxes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
}
.ft-pay-box {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  padding: 1.1rem 1.15rem 1.15rem;
  border-radius: 14px;
  border: 1px solid rgba(27, 77, 62, 0.16);
  background: #fff;
  min-width: 0;
}
.ft-pay-box-title {
  font-weight: 700;
  font-size: 0.92rem;
  color: #143D31;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  line-height: 1.35;
}
.ft-pay-box-hint {
  font-size: 0.75rem;
  color: rgba(20, 61, 49, 0.72);
  line-height: 1.4;
}
.ft-pay-brands {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  opacity: 0.85;
}
.ft-brand {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 1.35rem;
  padding: 0 0.4rem;
  border-radius: 6px;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  border: 1px solid rgba(0,0,0,0.08);
  background: rgba(255,255,255,0.7);
  color: #333;
  user-select: none;
}
.ft-brand-wechat { color: #07C160; border-color: rgba(7,193,96,0.35); background: rgba(7,193,96,0.08); }
.ft-brand-visa { color: #1A1F71; }
.ft-brand-mc { color: #EB001B; }
.ft-brand-gpay { color: #4285F4; }
.ft-brand-apple { color: #111; }
.ft-pay-box .ft-topup-cta {
  margin-top: auto;
  padding: 0.85rem 0.9rem;
  font-size: 1rem !important;
  min-height: 78px;
}
.ft-waffo-box-cta {
  flex-direction: column;
}
.ft-pay-box-maintenance {
  background: rgba(255, 255, 255, 0.72);
  border-style: dashed;
}
.ft-alipay-maintenance-cta,
.ft-alipay-maintenance-cta:disabled {
  flex-direction: row;
  background: #edf2f6 !important;
  color: #607080 !important;
  border: 1px solid #d7e0e8 !important;
  box-shadow: none !important;
  cursor: not-allowed;
  opacity: 1;
}
.ft-alipay-maintenance-cta .ft-cta-icon {
  filter: grayscale(1);
  opacity: 0.62;
  background: rgba(255, 255, 255, 0.9);
}
@media (max-width: 640px) {
  .ft-pay-boxes { grid-template-columns: 1fr; }
}

/* --- Stripe three-entry layout (v20260916stripe3) --- */
.ft-pay-boxes-3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 900px) {
  .ft-pay-boxes-3 { grid-template-columns: 1fr; }
}
.ft-stripe-box-cta { flex-direction: column; }
.ft-topup-cta.ft-stripe-cta-row { flex-direction: row; gap: 0.5em; }
.ft-stripe-cta-row .ft-cta-icons { display: contents; }
.ft-stripe-cta-row .ft-cta-icon {
  height: 1.25em;
  vertical-align: middle;
}
.ft-waffo-fallback {
  margin-top: 0.75rem;
  display: flex;
  justify-content: center;
}
.ft-waffo-fallback-link {
  background: none;
  border: none;
  padding: 0.25rem 0.5rem;
  font-size: 0.78rem;
  color: rgba(20, 61, 49, 0.62);
  text-decoration: underline;
  cursor: pointer;
}
.ft-waffo-fallback-link:hover { color: #143D31; }

.ft-topup-toast {
  position: fixed;
  left: 50%;
  bottom: 2rem;
  transform: translateX(-50%) translateY(1rem);
  background: #143D31;
  color: #fff;
  padding: 0.6rem 1.1rem;
  border-radius: 10px;
  font-size: 0.85rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 9999;
}
.ft-topup-toast.is-on {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.ft-wechat-mask {
  position: fixed;
  inset: 0;
  background: rgba(14, 18, 32, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9998;
  padding: 1rem;
}
.ft-wechat-box {
  background: #fff;
  border-radius: 16px;
  padding: 1.4rem 1.5rem;
  max-width: 22rem;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.8rem;
  box-shadow: 0 12px 40px rgba(14, 18, 32, 0.2);
}
.ft-wechat-title { font-weight: 700; font-size: 1rem; color: #143D31; }
.ft-wechat-amount { font-size: 1.1rem; font-weight: 700; color: #07C160; font-variant-numeric: tabular-nums; }
.ft-wechat-qr {
  width: 220px;
  height: 220px;
  border: 1px solid rgba(27, 77, 62, 0.16);
  border-radius: 10px;
  background: #fff;
}
.ft-wechat-actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}
.ft-wechat-open {
  font-size: 0.82rem;
  color: #143D31;
  text-decoration: underline;
}
.ft-wechat-cancel {
  border: 1px solid rgba(27, 77, 62, 0.25);
  background: #fff;
  border-radius: 8px;
  padding: 0.35rem 0.9rem;
  font-size: 0.82rem;
  color: #143D31;
  cursor: pointer;
}

.ft-topup-overlay-title {
  font-weight: 700;
  font-size: 1.05rem;
  color: #143D31;
  letter-spacing: 0.01em;
}
.ft-topup-overlay-chips {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
  gap: 0.55rem;
}
.ft-topup-chip {
  appearance: none;
  border: 1px solid rgba(27, 77, 62, 0.25);
  background: #fff;
  color: #143D31;
  border-radius: 12px;
  padding: 0.75rem 0.7rem;
  cursor: pointer;
  min-width: 0;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
  font-weight: 700 !important;
  font-size: 1.15rem !important;
  line-height: 1.2;
}
.ft-topup-chip.is-active,
.ft-topup-chip:hover {
  border-color: #1B4D3E;
  background: #e7f2ec;
}
.ft-topup-chip.is-active {
  box-shadow: 0 0 0 2px rgba(27, 77, 62, 0.22);
}
.ft-topup-custom-row {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  font-size: 0.875rem;
  color: #143D31;
}
.ft-topup-custom-row label {
  font-weight: 600;
}
.ft-topup-mirror {
  background: #fff;
  border: 1px solid rgba(27, 77, 62, 0.22);
  border-radius: 12px;
  padding: 0.15rem 0.85rem;
  min-height: 2.75rem;
}
.ft-topup-custom-input {
  flex: 1 1 auto;
  min-width: 0;
  width: 100%;
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
  outline: none;
  font-size: 1.1rem;
  font-weight: 600;
  color: #143D31;
  padding: 0.65rem 0;
}
.ft-topup-custom-input::-webkit-outer-spin-button,
.ft-topup-custom-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.ft-topup-custom-input[type='number'] {
  -moz-appearance: textfield;
  appearance: textfield;
}
.ft-topup-cta {
  appearance: none;
  width: 100%;
  border: none;
  border-radius: 12px;
  padding: 0.95rem 1.1rem;
  cursor: pointer;
  font-size: 1.05rem !important;
  font-weight: 700 !important;
  letter-spacing: 0.02em;
  /* deep navy */
  background: #0F2B4C !important;
  color: #ffffff !important;
  border: 1px solid rgba(255, 255, 255, 0.14) !important;
  box-shadow: 0 6px 14px rgba(15, 43, 76, 0.22) !important;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
}
.ft-topup-cta:hover {
  background: #163A66 !important;
  color: #ffffff !important;
}
.ft-topup-cta:active {
  background: #0B2140 !important;
}
.ft-topup-cta:focus-visible {
  outline: none;
  box-shadow:
    inset 0 0 0 2px #ffffff,
    0 0 0 3px #1f4fd8 !important;
}
.ft-topup-cta:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
.ft-cta-label {
  line-height: 1.2;
}
.ft-cta-en {
  color: rgba(255, 255, 255, 0.75);
  font-weight: 500;
}
.ft-cta-icons {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}
.ft-cta-icon {
  height: 18px;
  width: auto;
  max-width: 36px;
  object-fit: contain;
  display: block;
  /* keep official logo colors; soft plate behind for contrast on pastel btn */
  background: rgba(255, 255, 255, 0.72);
  border-radius: 4px;
  padding: 2px 4px;
  box-sizing: content-box;
}
.ft-cta-icon-alipay {
  height: 20px;
  max-width: 28px;
}

@media (max-width: 480px) {
  .ft-topup-overlay {
    max-width: 100%;
    padding: 1.15rem 1.05rem 1.25rem;
  }
}

/* Add Funds title note — smaller than main title */
.ft-add-funds-title {
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.15rem 0.35rem;
}
.ft-add-funds-note {
  display: inline;
  margin-left: 0.25rem;
  font-size: 0.72em;
  font-weight: 450;
  line-height: 1.35;
  opacity: 0.72;
  letter-spacing: 0;
}
.ft-add-funds-desc {
  font-size: 0.8125rem !important;
  line-height: 1.45 !important;
  opacity: 0.85;
}
@media (max-width: 640px) {
  .ft-add-funds-note { display: none; }
}
