/* ========== 全局样式 ========== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC',
    'Hiragino Sans GB', 'Microsoft YaHei', 'Helvetica Neue', Helvetica, Arial,
    sans-serif;
  overflow-x: hidden;
}

input {
  -webkit-appearance: none;
  appearance: none;
}

/* 安全区域适配 */
.pb-safe {
  padding-bottom: max(1rem, env(safe-area-inset-bottom));
}

/* ========== Loading 动画 ========== */
.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid rgba(255, 255, 255, 0.15);
  border-top-color: #6C5CE7;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ========== 页面过渡 ========== */
.page {
  animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ========== 充值卡片 ========== */
.recharge-card {
  background: #16213E;
  border: 2px solid transparent;
  border-radius: 16px;
  padding: 16px 8px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}

.recharge-card:active {
  transform: scale(0.96);
}

.recharge-card.selected {
  border-color: #6C5CE7;
  background: linear-gradient(135deg, rgba(108, 92, 231, 0.15), rgba(233, 69, 96, 0.1));
  box-shadow: 0 0 20px rgba(108, 92, 231, 0.2);
}

.recharge-card.selected::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 0 32px 32px 0;
  border-color: transparent #6C5CE7 transparent transparent;
}

.recharge-card.selected::before {
  content: '✓';
  position: absolute;
  top: 2px;
  right: 4px;
  color: white;
  font-size: 10px;
  font-weight: bold;
  z-index: 1;
}

.recharge-card .diamond-count {
  font-size: 1.25rem;
  font-weight: 800;
  background: linear-gradient(135deg, #FFD700, #FFA500);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 4px;
}

.recharge-card .price {
  font-size: 0.875rem;
  color: rgba(255, 255, 255, 0.9);
  font-weight: 600;
}

.recharge-card .desc {
  font-size: 0.625rem;
  color: rgba(255, 255, 255, 0.4);
  margin-top: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ========== Toast 动画 ========== */
#toast.show {
  display: block;
  animation: toastIn 0.3s ease-out;
}

#toast.hide {
  animation: toastOut 0.3s ease-in forwards;
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translate(-50%, -20px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

@keyframes toastOut {
  from {
    opacity: 1;
    transform: translate(-50%, 0);
  }
  to {
    opacity: 0;
    transform: translate(-50%, -20px);
  }
}

/* ========== Modal 动画 ========== */
#modal.show .bg-dark-card {
  transform: scale(1);
}

/* ========== 滚动条 ========== */
::-webkit-scrollbar {
  width: 0;
  height: 0;
}

/* ========== 输入框聚焦发光 ========== */
input:focus {
  box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.15);
}

/* ========== 登录方式切换 Tab ========== */
.login-mode-tabs {
  display: flex;
  justify-content: center;
  gap: 40px;
  margin-bottom: 8px;
}

.login-mode-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  padding: 4px 0;
  transition: all 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}

.login-mode-tab span {
  font-size: 15px;
  color: rgba(255, 255, 255, 0.4);
  font-weight: 400;
  transition: all 0.2s ease;
}

.login-mode-tab.active span {
  color: #ffffff;
  font-size: 16px;
  font-weight: 600;
}

.login-mode-tab .tab-indicator {
  width: 24px;
  height: 3px;
  border-radius: 2px;
  margin-top: 6px;
  background: transparent;
  transition: background 0.2s ease;
}

.login-mode-tab.active .tab-indicator {
  background: #6C5CE7;
}

/* ========== 按钮涟漪效果 ========== */
.ripple {
  position: relative;
  overflow: hidden;
}

.ripple::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.3) 0%, transparent 70%);
  opacity: 0;
  transition: opacity 0.3s;
}

.ripple:active::after {
  opacity: 1;
  transition: opacity 0s;
}

/* ========== 用户头像图片 ========== */
#user-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ========== 支付方式按钮切换 ========== */
.pay-type-btn {
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.4);
  border: 1.5px solid rgba(255, 255, 255, 0.1);
  transition: all 0.2s ease;
}

.pay-type-btn:active {
  transform: scale(0.95);
}

.pay-type-btn.active[data-type="alipay"],
#pay-alipay-btn.active {
  background: rgba(59, 130, 246, 0.2);
  color: #60A5FA;
  border-color: rgba(59, 130, 246, 0.3);
}

.pay-type-btn.active[data-type="wechat"],
#pay-wechat-btn.active {
  background: rgba(34, 197, 94, 0.2);
  color: #4ADE80;
  border-color: rgba(34, 197, 94, 0.3);
}

/* ========== 微信内打开提示遮罩 ========== */
.wechat-mask-bg {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
}

.wechat-mask-tip {
  position: absolute;
  top: 12px;
  right: 16px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  color: white;
  z-index: 1;
}

.wechat-mask-tip .tip-arrow {
  animation: bounceUp 1.2s ease-in-out infinite;
  margin-bottom: 12px;
}

.wechat-mask-tip .tip-text {
  text-align: right;
  padding: 20px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(8px);
}

@keyframes bounceUp {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-12px);
  }
}
