/* ═══════════════════════════════════════════
   皮球侠 · 公共样式
   所有页面共享：变量 / 重置 / 导航 / 弹窗 / 按钮
   ═══════════════════════════════════════════ */

/* ── CSS 变量 ── */
:root {
  --bg:          #fafaf9;
  --bg-tint:     #f6f5f4;
  --paper:       #ffffff;
  --line:        #e5e3df;
  --line-2:      #c8c4be;
  --ink:         #1a1a1a;
  --ink-2:       #37352f;
  --muted:       #5d5b54;
  --faint:       #787671;
  /* 暖琥珀色 — 有温度，不刺眼 */
  --amber:       #b06820;
  --amber-soft:  #f5e8d0;
  --amber-deep:  #7a4810;
  --green:       #166534;
  /* history.html 兼容别名 */
  --orange:       var(--amber);
  --orange-soft:  var(--amber-soft);
}

/* ── 重置 ── */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--ink-2);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", sans-serif;
  font-size: 16px; line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

/* ── 容器（index 用 .container，其他页用 .wrap）── */
.container, .wrap { max-width: 720px; margin: 0 auto; padding: 24px 20px 80px; }

/* ── 导航栏 ── */
.top-bar {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 32px;
}
.nav {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 28px;
}
.nav-left { display: flex; align-items: center; gap: 12px; }
.nav-right { display: flex; align-items: center; gap: 12px; }
.logo { font-weight: 700; font-size: 17px; color: var(--ink); letter-spacing: -0.3px; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
.logo-img { height: 22px; width: 22px; object-fit: contain; display: block; mix-blend-mode: multiply; }
.nav-links { display: flex; align-items: center; gap: 16px; }
.nav-link { font-size: 13px; color: var(--faint); text-decoration: none; transition: color 0.15s; background: none; border: none; padding: 0; cursor: pointer; font-family: inherit; }
.nav-link:hover { color: var(--ink); }
.nav-login { background: none; border: none; padding: 0; cursor: pointer; font-family: inherit; }
.nav-pro {
  font-size: 13px; font-weight: 500; color: var(--ink);
  text-decoration: none; padding: 6px 14px;
  border: 1px solid var(--line-2); border-radius: 8px;
  transition: border-color 0.15s;
}
.nav-pro:hover { border-color: var(--ink); }
.back-btn {
  display: inline-flex; align-items: center; gap: 5px;
  color: var(--muted); font-size: 13px; font-weight: 400; text-decoration: none;
  padding: 6px 12px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--paper);
  transition: all 0.15s; cursor: pointer; font-family: inherit;
}
.back-btn:hover { color: var(--ink); border-color: var(--line-2); }

/* ── 通用按钮 ── */
.submit {
  width: 100%; background: var(--ink); color: #fff;
  border: none; border-radius: 10px;
  padding: 17px 24px; font-size: 16px; font-weight: 600;
  cursor: pointer; font-family: inherit;
  transition: opacity 0.15s, background 0.15s;
  letter-spacing: 0.3px; margin-top: 12px;
}
.submit:hover { background: #111; }
.submit:active { opacity: 0.85; }
.submit:disabled { background: var(--line); color: var(--faint); cursor: not-allowed; }

/* ── 错误提示 ── */
.error {
  color: #c0392b; font-size: 13px; margin-top: 10px;
  padding: 10px 14px; background: #fdf0ed;
  border: 1px solid #f5cfca; border-radius: 8px;
  display: none; line-height: 1.55;
}
.error.show { display: block; }

/* ── 加载动画 ── */
.loading { display: none; text-align: center; padding: 36px 0; color: var(--muted); font-size: 14px; }
.loading.show { display: block; }
.ball-bounce {
  display: inline-block; font-size: 36px;
  animation: bounce 0.65s infinite cubic-bezier(.5,.05,.5,1) alternate;
}
@keyframes bounce { from { transform: translateY(0); } to { transform: translateY(-16px); } }
.loading-title { margin-top: 14px; font-size: 15px; font-weight: 600; color: var(--ink); }
.loading-tag { margin-top: 10px; display: inline-block; font-size: 12px; font-weight: 600; color: var(--amber-deep); background: var(--amber-soft); padding: 4px 14px; border-radius: 20px; }
.loading-tip { margin-top: 14px; font-size: 13px; color: var(--muted); max-width: 260px; margin-left: auto; margin-right: auto; line-height: 1.65; min-height: 44px; opacity: 1; transition: opacity 0.4s ease; }
.loading-tip.fade { opacity: 0; }

/* ── 页脚 ── */
footer {
  margin-top: 0;
  padding-top: 24px;
  padding-bottom: 80px;
  border-top: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 12px;
}
.footer-brand { font-size: 13px; font-weight: 600; color: var(--ink); }
.footer-links { display: flex; gap: 20px; }
.footer-links a { font-size: 12px; color: var(--faint); text-decoration: none; }
.footer-links a:hover { color: var(--ink); }
.footer-copy { font-size: 11px; color: var(--faint); width: 100%; }

/* ═══════════════════════════════════════════
   弹窗系统
   ═══════════════════════════════════════════ */

.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.4);
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000; padding: 20px;
  opacity: 0; pointer-events: none;
  transition: opacity 0.2s;
}
.modal-overlay.open { opacity: 1; pointer-events: auto; }
.modal-card {
  background: var(--paper);
  border-radius: 16px; padding: 24px;
  max-width: 540px; width: 100%;
  max-height: 90vh; overflow-y: auto;
  transform: translateY(16px);
  transition: transform 0.22s cubic-bezier(.22,.68,0,1.2);
  box-shadow: 0 24px 64px rgba(0,0,0,0.14), 0 0 0 1px rgba(0,0,0,0.06);
}
.modal-overlay.open .modal-card { transform: translateY(0); }
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px;
}
.modal-title { font-size: 17px; font-weight: 700; color: var(--ink); letter-spacing: -0.3px; }
.modal-close {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--bg-tint); border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; color: var(--muted); font-family: inherit;
  transition: background 0.15s, color 0.15s; flex-shrink: 0;
}
.modal-close:hover { background: var(--line); color: var(--ink); }
.modal-note { text-align: center; font-size: 11px; color: var(--faint); margin: 0 0 14px; }

/* ── 套餐卡片（弹窗内 + 首页定价共用）── */
.modal-plans, .pricing-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}
.mplan, .pc {
  border: 1px solid var(--line); border-radius: 12px; padding: 16px;
  position: relative; display: flex; flex-direction: column;
  background: var(--paper);
}
.mplan.featured, .pc.featured { border-color: var(--ink); border-width: 1.5px; }
.mplan.pre-selected { border-color: var(--amber); background: #fefaf3; }
.mplan-badge {
  position: absolute; top: -10px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: #fff;
  font-size: 10px; font-weight: 600; letter-spacing: 0.5px;
  padding: 3px 10px; border-radius: 999px; white-space: nowrap;
  pointer-events: none;
}
.mplan-tier, .pc-tier {
  font-size: 10px; font-weight: 600; letter-spacing: 0.8px;
  text-transform: uppercase; color: var(--faint); margin-bottom: 10px;
}
.mplan.featured .mplan-tier, .pc.featured .pc-tier { color: var(--ink); }
.mplan-price, .pc-price {
  font-size: 26px; font-weight: 700; color: var(--ink);
  letter-spacing: -0.8px; line-height: 1; margin-bottom: 4px;
}
.mplan-price sub, .pc-price sub {
  font-size: 11px; font-weight: 400; color: var(--muted);
  vertical-align: baseline; letter-spacing: 0;
}
.mplan-desc, .pc-desc { font-size: 11px; color: var(--muted); margin: 4px 0 12px; line-height: 1.5; }
.mplan-divider, .pc-divider { border: none; border-top: 1px solid var(--line); margin: 0 0 12px; }
.mplan-list, .pc-list {
  list-style: none; padding: 0; margin: 0 0 14px;
  display: flex; flex-direction: column; gap: 6px; flex: 1;
}
.mplan-list li, .pc-list li {
  font-size: 12px; color: var(--ink-2);
  display: flex; gap: 5px; align-items: flex-start; line-height: 1.45;
}
.mplan-list li::before, .pc-list li::before {
  content: "✓"; color: #27ae60; font-weight: 700; flex-shrink: 0; font-size: 11px;
}
.mplan-list li.off, .pc-list li.off { color: var(--faint); }
.mplan-list li.off::before, .pc-list li.off::before { content: "–"; color: var(--line-2); }
.mplan-btn, .pc-btn {
  display: block; width: 100%; text-align: center;
  padding: 9px; border-radius: 7px; margin-top: auto;
  font-size: 12px; font-weight: 500; cursor: pointer;
  font-family: inherit; text-decoration: none; border: none;
  transition: all 0.15s;
}
.mplan-btn.outline, .pc-btn.outline {
  background: transparent; color: var(--ink); border: 1px solid var(--line-2);
}
.mplan-btn.outline:hover, .pc-btn.outline:hover { border-color: var(--ink); }
.mplan-btn.solid, .pc-btn.solid { background: var(--ink); color: #fff; }
.mplan-btn.solid:hover, .pc-btn.solid:hover { background: #000; }
.mplan-btn.soon { background: var(--bg-tint); color: var(--faint); border: 1px solid var(--line); cursor: default; }
.pc-note { font-size: 11px; color: var(--faint); text-align: center; margin-top: 10px; }
.mplan-savings {
  display: inline-block; background: #dcfce7; color: #15803d;
  font-size: 10px; font-weight: 700; padding: 2px 7px;
  border-radius: 999px; margin-left: 6px; letter-spacing: 0.2px;
  vertical-align: middle; position: relative; top: -2px;
}
.modal-guarantee {
  display: flex; align-items: center; justify-content: center;
  gap: 6px; flex-wrap: wrap;
  background: var(--bg-tint); border-radius: 10px;
  padding: 10px 14px; font-size: 12px; color: var(--muted);
  margin-bottom: 0;
}
.mg-sep { color: var(--line-2); }

/* ── 支付视图 ── */
.pay-view { display: none; text-align: center; padding: 8px 0 4px; }
.pay-view.show { display: block; }
.pay-back { background: none; border: none; color: var(--muted); font-size: 13px; cursor: pointer; font-family: inherit; padding: 0; margin-bottom: 20px; display: inline-flex; align-items: center; gap: 4px; }
.pay-back:hover { color: var(--ink); }
.pay-amount { font-size: 28px; font-weight: 700; color: var(--ink); letter-spacing: -0.8px; margin-bottom: 4px; }
.pay-plan-name { font-size: 13px; color: var(--muted); margin-bottom: 20px; }
.pay-qr { width: 180px; height: 180px; border: 1px solid var(--line); border-radius: 12px; margin: 0 auto 12px; background: var(--bg-tint); display: flex; align-items: center; justify-content: center; overflow: hidden; }
.pay-qr img { width: 100%; height: 100%; display: block; }
.pay-qr-hint { font-size: 13px; color: var(--muted); margin-bottom: 16px; }
.pay-status { font-size: 12px; color: var(--faint); min-height: 18px; }
.phone-step { padding: 16px 0 8px; }
.phone-hint { font-size: 13px; color: var(--ink-2); font-weight: 500; margin: 0 0 6px; }
.phone-hint-sub { font-size: 11px; color: var(--faint); margin: 0 0 12px; }
.phone-row { display: flex; gap: 8px; align-items: center; }
.phone-input { flex: 1; height: 40px; border: 1.5px solid var(--line); border-radius: 10px; padding: 0 12px; font-size: 15px; font-family: inherit; color: var(--ink); background: var(--bg); outline: none; }
.phone-input:focus { border-color: var(--amber); }
.phone-btn { height: 40px; padding: 0 16px; background: var(--ink); color: #fff; border: none; border-radius: 10px; font-size: 14px; font-weight: 600; font-family: inherit; cursor: pointer; white-space: nowrap; }
.phone-btn:hover { background: var(--ink-2); }

/* ── 激活码区块 ── */
.activate-section {
  background: var(--amber-soft); border: 1px solid #e8c97a;
  border-radius: 10px; padding: 12px 14px;
  margin-bottom: 14px;
}
.activate-section-label { font-size: 12px; color: var(--amber-deep); font-weight: 600; margin-bottom: 8px; }
.activate-section-row { display: flex; gap: 8px; }
.activate-input { flex: 1; height: 38px; border: 1.5px solid var(--line); border-radius: 10px; padding: 0 12px; font-size: 14px; font-family: inherit; color: var(--ink); background: var(--bg); outline: none; letter-spacing: 1px; text-transform: uppercase; }
.activate-input:focus { border-color: var(--amber); }
.activate-btn { height: 38px; padding: 0 16px; background: var(--ink); color: #fff; border: none; border-radius: 10px; font-size: 13px; font-weight: 600; font-family: inherit; cursor: pointer; }

/* ── 套餐分隔线 ── */
.plans-divider {
  text-align: center; font-size: 11px; color: var(--faint);
  margin: 0 0 14px; position: relative;
}
.plans-divider::before, .plans-divider::after {
  content: ''; position: absolute; top: 50%;
  width: calc(50% - 60px); height: 1px; background: var(--line);
}
.plans-divider::before { left: 0; }
.plans-divider::after { right: 0; }

/* ── 找回激活码 ── */
.find-result-ok { background: #f0faf0; border: 1px solid #b8e0b8; border-radius: 10px; padding: 14px 16px; }
.find-result-ok .find-token { font-family: monospace; font-size: 13px; word-break: break-all; color: var(--ink); background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; margin: 10px 0; }
.find-result-ok .find-copy { width: 100%; height: 36px; background: var(--ink); color: #fff; border: none; border-radius: 8px; font-size: 13px; font-weight: 600; cursor: pointer; font-family: inherit; }

/* ── 支付成功 ── */
.pay-success { display: none; }
.ps-icon { font-size: 40px; line-height: 1; margin-bottom: 10px; }
.ps-title { font-size: 20px; font-weight: 700; color: var(--ink); letter-spacing: -0.4px; margin-bottom: 4px; }
.ps-sub { font-size: 13px; color: var(--muted); margin-bottom: 20px; }
.ps-share { background: var(--bg-tint); border-radius: 12px; padding: 16px; margin-bottom: 4px; }
.ps-share-label { font-size: 12px; color: var(--muted); margin-bottom: 10px; line-height: 1.5; }
.ps-share-btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--ink); color: #fff; border: none;
  border-radius: 8px; padding: 10px 20px;
  font-size: 13px; font-weight: 500; cursor: pointer;
  font-family: inherit; transition: background 0.15s;
}
.ps-share-btn:hover { background: #000; }
.ps-share-btn.copied { background: #27ae60; }
.pay-spinner { display: inline-block; width: 12px; height: 12px; border: 2px solid var(--line); border-top-color: var(--muted); border-radius: 50%; animation: spin 0.8s linear infinite; vertical-align: middle; margin-right: 5px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Toast ── */
#__toast {
  position: fixed; bottom: 28px; left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #1a1a1a; color: #fff;
  padding: 10px 18px; border-radius: 10px;
  font-size: 13px; font-weight: 500;
  pointer-events: none; opacity: 0;
  transition: opacity 0.22s, transform 0.22s;
  z-index: 9999; white-space: nowrap; letter-spacing: 0.1px;
}

/* ── 响应式 ── */
@media (max-width: 767px) {
  .pricing-grid { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .modal-plans { grid-template-columns: 1fr; }
  .mplan.featured { order: -1; margin-top: 10px; }
  .modal-card { padding: 20px 16px; border-radius: 14px; }
  .mplan { padding: 14px 12px; }
  .mplan-btn { min-height: 44px; padding: 12px; }
}
