/* ============================================
   天天三国 - 组件样式
   按钮 · 卡牌 · 模态框 · Toast · 进度条
   ============================================ */

/* ============================================
   按钮
   ============================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-sm);
  padding: 0.625rem 1.25rem;
  font-family: var(--font-body);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-text);
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-base);
  position: relative;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  white-space: nowrap;
  line-height: 1.4;
}

.btn:hover {
  background: var(--color-bg-hover);
  border-color: var(--color-border-light);
  box-shadow: var(--shadow-sm);
}

.btn:active {
  transform: scale(0.96);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* 按钮按下涟漪 */
.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at var(--ripple-x, 50%) var(--ripple-y, 50%), rgba(255, 255, 255, 0.15) 0%, transparent 60%);
  opacity: 0;
  transition: opacity 0.3s;
}

.btn:active::after {
  opacity: 1;
}

/* 主要按钮 - 红金 */
.btn-primary {
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-light) 100%);
  border-color: var(--color-gold-dark);
  color: var(--color-gold-light);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
  box-shadow: 0 2px 8px rgba(139, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--color-primary-light) 0%, #c62828 100%);
  border-color: var(--color-gold);
  box-shadow: 0 4px 16px rgba(139, 0, 0, 0.4), var(--shadow-glow-gold);
}

/* 次要按钮 */
.btn-secondary {
  background: linear-gradient(135deg, #2a2020 0%, #1e1212 100%);
  border-color: var(--color-border-light);
  color: var(--color-text-dim);
}

.btn-secondary:hover {
  color: var(--color-text);
  border-color: var(--color-gold-dark);
}

/* 小按钮 */
.btn-sm {
  padding: 0.375rem 0.75rem;
  font-size: 0.75rem;
}

/* 大按钮 */
.btn-lg {
  padding: 0.875rem 1.75rem;
  font-size: 1rem;
  border-radius: var(--radius-lg);
}

/* 全宽按钮 */
.btn-block {
  display: flex;
  width: 100%;
}

/* 危险按钮 */
.btn-danger {
  background: linear-gradient(135deg, #c62828, #e53935);
  border-color: #e57373;
  color: #fff;
}

/* 成功按钮 */
.btn-success {
  background: linear-gradient(135deg, #1b5e20, #2e7d32);
  border-color: #4caf50;
  color: #fff;
}

/* 警告按钮 - 出售等 */
.btn-warning {
  background: linear-gradient(135deg, #e65100, #f57c00);
  border-color: #ff9800;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  box-shadow: 0 2px 8px rgba(230, 81, 0, 0.3);
}

.btn-warning:hover {
  background: linear-gradient(135deg, #f57c00, #fb8c00);
  border-color: #ffb74d;
  box-shadow: 0 4px 16px rgba(230, 81, 0, 0.4);
}

/* ============================================
   卡牌 - 基础
   ============================================ */
.card {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--spacing-md);
  transition: transform var(--transition-base), box-shadow var(--transition-base);
  position: relative;
  overflow: hidden;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

/* 卡牌内部纹理 */
.card::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    linear-gradient(135deg, rgba(218, 165, 32, 0.03) 0%, transparent 50%),
    repeating-linear-gradient(
      45deg,
      transparent,
      transparent 10px,
      rgba(255, 255, 255, 0.005) 10px,
      rgba(255, 255, 255, 0.005) 20px
    );
  pointer-events: none;
}

/* ============================================
   武将卡牌
   ============================================ */
.hero-card {
  background: var(--color-bg-card);
  border: 2px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--spacing-sm);
  text-align: center;
  position: relative;
  overflow: hidden;
  transition: transform var(--transition-base), box-shadow var(--transition-base);
  cursor: pointer;
}

.hero-card:active {
  transform: scale(0.97);
}

/* 卡牌头像区 */
.hero-card-avatar {
  width: 100%;
  aspect-ratio: 3 / 4;
  background: linear-gradient(180deg, var(--color-bg-panel) 0%, var(--color-bg-dark) 100%);
  border-radius: var(--radius-sm);
  margin-bottom: var(--spacing-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  position: relative;
  overflow: hidden;
}
.hero-card-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* 势力色条 */
.hero-card-avatar::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 0.1875rem;
}

.hero-card[data-faction="shu"] .hero-card-avatar::after { background: var(--faction-shu); }
.hero-card[data-faction="wei"] .hero-card-avatar::after { background: var(--faction-wei); }
.hero-card[data-faction="wu"] .hero-card-avatar::after { background: var(--faction-wu); }
.hero-card[data-faction="qun"] .hero-card-avatar::after { background: var(--faction-qun); }

.hero-card-name {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 0.125rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hero-card-info {
  font-size: 0.6875rem;
  color: var(--color-text-dim);
}

/* 稀有度边框 */
.hero-card.rarity-n {
  border-color: var(--rarity-n);
}

.hero-card.rarity-r {
  border-color: var(--rarity-r);
  box-shadow: 0 0 10px rgba(33, 150, 243, 0.3);
  background: linear-gradient(135deg, rgba(33, 150, 243, 0.08), var(--color-bg-card) 60%);
}

/* R 流光效果 */
.hero-card.rarity-r::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: conic-gradient(
    from 0deg,
    transparent 0%,
    rgba(33, 150, 243, 0.06) 10%,
    transparent 20%
  );
  animation: spin 6s linear infinite;
  pointer-events: none;
}

.hero-card.rarity-sr {
  border-color: var(--rarity-sr);
  box-shadow: 0 0 12px rgba(156, 39, 176, 0.4);
  background: linear-gradient(135deg, rgba(156, 39, 176, 0.1), var(--color-bg-card) 60%);
  animation: glowSr 2.5s ease-in-out infinite;
}

/* SR 流光效果 */
.hero-card.rarity-sr::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: conic-gradient(
    from 0deg,
    transparent 0%,
    rgba(156, 39, 176, 0.08) 10%,
    transparent 20%
  );
  animation: spin 5s linear infinite;
  pointer-events: none;
}

@keyframes glowSr {
  0%, 100% { box-shadow: 0 0 12px rgba(156, 39, 176, 0.3); }
  50% { box-shadow: 0 0 20px rgba(156, 39, 176, 0.5), 0 0 6px rgba(156, 39, 176, 0.2); }
}

.hero-card.rarity-ssr {
  border-color: var(--rarity-ssr);
  background: linear-gradient(135deg, rgba(255, 152, 0, 0.1), rgba(156, 39, 176, 0.06), var(--color-bg-card) 60%);
  animation: glow 2s ease-in-out infinite;
}

/* SSR 流光效果 */
.hero-card.rarity-ssr::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: conic-gradient(
    from 0deg,
    transparent 0%,
    rgba(255, 152, 0, 0.1) 10%,
    transparent 20%
  );
  animation: spin 4s linear infinite;
  pointer-events: none;
}

/* ============================================
   模态框
   ============================================ */
.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--spacing-md);
  animation: fadeIn 0.2s ease-out;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.modal-content {
  position: relative;
  width: 100%;
  max-width: 22.5rem;
  max-height: 80vh;
  background: var(--color-bg-panel);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  overflow: hidden;
  animation: bounceIn 0.35s ease-out;
  box-shadow: var(--shadow-lg), 0 0 40px rgba(0, 0, 0, 0.3);
}

/* 模态框顶部装饰 */
.modal-content::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 0.125rem;
  background: linear-gradient(90deg, var(--color-primary), var(--color-gold), var(--color-primary));
}

.modal-header {
  padding: var(--spacing-md) var(--spacing-md) var(--spacing-sm);
  text-align: center;
}

.modal-title {
  font-family: var(--font-display);
  font-size: 1.25rem;
  color: var(--color-gold);
}

.modal-body {
  padding: var(--spacing-sm) var(--spacing-md);
  overflow-y: auto;
  max-height: 50vh;
  color: var(--color-text);
  font-size: 0.875rem;
  line-height: 1.7;
}

.modal-footer {
  padding: var(--spacing-sm) var(--spacing-md) var(--spacing-md);
  display: flex;
  gap: var(--spacing-sm);
  justify-content: center;
}

.modal-footer .btn {
  flex: 1;
  max-width: 8.75rem;
}

/* 模态框关闭动画 */
.modal.closing {
  animation: fadeOut 0.2s ease-out forwards;
}

.modal.closing .modal-content {
  animation: slideDown 0.2s ease-out forwards;
}

/* ============================================
   Toast 通知
   ============================================ */
#toast-container {
  position: fixed;
  top: 3.5rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2000;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--spacing-sm);
  width: 100%;
  max-width: 25rem;
  padding: 0 var(--spacing-md);
  pointer-events: none;
}

.toast {
  width: 100%;
  padding: 0.75rem var(--spacing-md);
  border-radius: var(--radius-md);
  font-size: 0.8125rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  animation: toastIn 0.3s ease-out;
  pointer-events: auto;
  box-shadow: var(--shadow-md);
  border: 1px solid;
}

.toast.removing {
  animation: toastOut 0.3s ease-out forwards;
}

.toast-icon {
  font-size: 1rem;
  flex-shrink: 0;
}

.toast-message {
  flex: 1;
}

.toast-info {
  background: linear-gradient(135deg, rgba(52, 152, 219, 0.15), rgba(52, 152, 219, 0.08));
  border-color: rgba(52, 152, 219, 0.3);
  color: #85c1e9;
}

.toast-success {
  background: linear-gradient(135deg, rgba(46, 204, 113, 0.15), rgba(46, 204, 113, 0.08));
  border-color: rgba(46, 204, 113, 0.3);
  color: #82e0aa;
}

.toast-error {
  background: linear-gradient(135deg, rgba(231, 76, 60, 0.15), rgba(231, 76, 60, 0.08));
  border-color: rgba(231, 76, 60, 0.3);
  color: #f1948a;
}

.toast-warning {
  background: linear-gradient(135deg, rgba(243, 156, 18, 0.15), rgba(243, 156, 18, 0.08));
  border-color: rgba(243, 156, 18, 0.3);
  color: #f9e79f;
}

/* ============================================
   加载遮罩
   ============================================ */
.spinner-overlay {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-md);
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.spinner {
  width: 2.75rem;
  height: 2.75rem;
  border: 3px solid var(--color-border);
  border-top-color: var(--color-gold);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.spinner-text {
  font-size: 0.875rem;
  color: var(--color-gold);
  font-family: var(--font-display);
  animation: breathe 2s ease-in-out infinite;
}

/* 内联小spinner */
.spinner-inline {
  display: inline-block;
  width: 1rem;
  height: 1rem;
  border: 2px solid var(--color-border);
  border-top-color: var(--color-gold);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  vertical-align: middle;
}

/* ============================================
   进度条
   ============================================ */
.progress-bar {
  width: 100%;
  height: 0.5rem;
  background: rgba(0, 0, 0, 0.4);
  border-radius: 0.25rem;
  overflow: hidden;
  position: relative;
}

.progress-bar-fill {
  height: 100%;
  border-radius: 0.25rem;
  transition: width 0.5s ease-out;
  position: relative;
}

/* 进度条光泽 */
.progress-bar-fill::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 50%;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.2), transparent);
  border-radius: 0.25rem 0.25rem 0 0;
}

/* HP条 - 绿到红渐变 */
.progress-hp .progress-bar-fill {
  background: linear-gradient(90deg, #e74c3c, #f39c12, #2ecc71);
  background-size: 300% 100%;
}

/* EXP条 */
.progress-exp .progress-bar-fill {
  background: linear-gradient(90deg, var(--color-info), #5dade2);
}

/* MP条 */
.progress-mp .progress-bar-fill {
  background: linear-gradient(90deg, #8e44ad, #bb6bd9);
}

/* 进度条标签 */
.progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.6875rem;
  color: var(--color-text-dim);
  margin-bottom: 0.125rem;
}

/* 大进度条 */
.progress-bar-lg {
  height: 0.875rem;
  border-radius: 0.4375rem;
}

.progress-bar-lg .progress-bar-fill {
  border-radius: 0.4375rem;
}

/* ============================================
   徽章
   ============================================ */
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.25rem;
  height: 1.25rem;
  padding: 0 0.375rem;
  font-size: 0.6875rem;
  font-weight: 700;
  border-radius: 0.625rem;
  background: var(--color-danger);
  color: #fff;
  line-height: 1;
}

.badge-gold {
  background: linear-gradient(135deg, var(--color-gold-dark), var(--color-gold));
  color: #1a1a1a;
}

.badge-info {
  background: var(--color-info);
}

.badge-sm {
  min-width: 0.5rem;
  height: 0.5rem;
  padding: 0;
  font-size: 0;
}

/* ============================================
   货币显示
   ============================================ */
.currency {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.currency-icon {
  font-size: 1.1em;
}

.currency-amount {
  color: var(--color-text);
}

.currency-gold .currency-amount { color: var(--color-gold); }
.currency-gems .currency-amount { color: #bb86fc; }
.currency-stamina .currency-amount { color: var(--color-success); }

/* ============================================
   星级显示
   ============================================ */
.star-display {
  display: inline-flex;
  gap: 0.0625rem;
  font-size: 0.875rem;
  line-height: 1;
}

.star-filled {
  color: var(--color-gold);
  text-shadow: 0 0 4px rgba(218, 165, 32, 0.5);
}

.star-empty {
  color: var(--color-border);
}

/* ============================================
   稀有度标签
   ============================================ */
.rarity-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.75rem;
  height: 1.125rem;
  padding: 0 0.375rem;
  font-size: 0.625rem;
  font-weight: 800;
  border-radius: 0.1875rem;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.rarity-n {
  background: rgba(158, 158, 158, 0.2);
  color: var(--rarity-n);
  border: 1px solid rgba(158, 158, 158, 0.3);
}

.rarity-r {
  background: rgba(33, 150, 243, 0.15);
  color: var(--rarity-r);
  border: 1px solid rgba(33, 150, 243, 0.3);
  text-shadow: 0 0 4px rgba(33, 150, 243, 0.2);
}

.rarity-sr {
  background: rgba(156, 39, 176, 0.15);
  color: var(--rarity-sr);
  border: 1px solid rgba(156, 39, 176, 0.3);
  text-shadow: 0 0 4px rgba(156, 39, 176, 0.3);
}

.rarity-ssr {
  background: linear-gradient(135deg, rgba(156, 39, 176, 0.2), rgba(255, 152, 0, 0.2));
  color: var(--rarity-ssr-glow);
  border: 1px solid rgba(255, 152, 0, 0.4);
  text-shadow: 0 0 6px rgba(255, 152, 0, 0.5);
  animation: borderGlow 2s ease-in-out infinite;
}

/* ============================================
   势力标签
   ============================================ */
.faction-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.125rem 0.5rem;
  font-size: 0.6875rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
}

.faction-shu {
  background: rgba(229, 57, 53, 0.15);
  color: var(--faction-shu);
  border: 1px solid rgba(229, 57, 53, 0.3);
}

.faction-wei {
  background: rgba(30, 136, 229, 0.15);
  color: var(--faction-wei);
  border: 1px solid rgba(30, 136, 229, 0.3);
}

.faction-wu {
  background: rgba(67, 160, 71, 0.15);
  color: var(--faction-wu);
  border: 1px solid rgba(67, 160, 71, 0.3);
}

.faction-qun {
  background: rgba(253, 216, 53, 0.15);
  color: var(--faction-qun);
  border: 1px solid rgba(253, 216, 53, 0.3);
}

/* ============================================
   空状态
   ============================================ */
.empty-state {
  text-align: center;
  padding: var(--spacing-xl) var(--spacing-md);
  color: var(--color-text-dim);
}

.empty-state-icon {
  font-size: 3rem;
  margin-bottom: var(--spacing-md);
  opacity: 0.5;
}

.empty-state-text {
  font-size: 0.875rem;
  line-height: 1.6;
}

/* ============================================
   表单组
   ============================================ */
.form-group {
  margin-bottom: var(--spacing-md);
}

.form-label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--color-text-dim);
  margin-bottom: var(--spacing-xs);
}

.form-input {
  width: 100%;
  padding: 0.625rem var(--spacing-md);
  font-size: 0.875rem;
}

.form-hint {
  font-size: 0.6875rem;
  color: var(--color-text-dim);
  margin-top: var(--spacing-xs);
}

.form-error {
  font-size: 0.6875rem;
  color: var(--color-danger);
  margin-top: var(--spacing-xs);
}

/* ============================================
   标签页
   ============================================ */
.tabs {
  display: flex;
  border-bottom: 1px solid var(--color-border);
  margin-bottom: var(--spacing-md);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.tab {
  flex: 1;
  padding: var(--spacing-sm) var(--spacing-md);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--color-text-dim);
  text-align: center;
  border: none;
  background: none;
  cursor: pointer;
  position: relative;
  transition: color var(--transition-base);
  white-space: nowrap;
}

.tab:hover {
  color: var(--color-text);
}

.tab.active {
  color: var(--color-gold);
}

.tab.active::after {
  content: '';
  position: absolute;
  bottom: -0.0625rem;
  left: 20%;
  right: 20%;
  height: 0.125rem;
  background: var(--color-gold);
  border-radius: 0.0625rem 0.0625rem 0 0;
}

/* ============================================
   分割线标题
   ============================================ */
.divider-title {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  margin: var(--spacing-lg) 0 var(--spacing-md);
  font-size: 0.75rem;
  color: var(--color-text-dim);
}

.divider-title::before,
.divider-title::after {
  content: '';
  flex: 1;
  height: 0.0625rem;
  background: var(--color-border);
}


/* ============================================
   金元宝图标
   ============================================ */
.gems-icon {
  display: inline-block;
  position: relative;
  width: 1.375rem;
  height: 0.875rem;
  background: linear-gradient(180deg, #FFE44D 0%, #FFD700 40%, #DAA520 70%, #B8860B 100%);
  border-radius: 40% 40% 50% 50% / 30% 30% 70% 70%;
  box-shadow: 0 1px 3px rgba(139, 69, 19, 0.5), inset 0 2px 4px rgba(255, 255, 200, 0.5), inset 0 -2px 3px rgba(139, 69, 19, 0.4);
  border: 1px solid #B8860B;
  font-size: 0;
  vertical-align: middle;
  overflow: visible;
}
.gems-icon::before {
  content: '';
  position: absolute;
  top: -0.25rem;
  left: 0.1875rem;
  right: 0.1875rem;
  height: 0.5rem;
  background: linear-gradient(180deg, #FFE44D 0%, #FFD700 60%, #DAA520 100%);
  border-radius: 50% 50% 20% 20% / 80% 80% 20% 20%;
  box-shadow: inset 0 2px 3px rgba(255, 255, 200, 0.6), 0 1px 2px rgba(139, 69, 19, 0.3);
  border: 1px solid #DAA520;
  border-bottom: none;
}
.gems-icon::after {
  content: '元';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -30%);
  font-size: 0.5rem;
  font-weight: 900;
  color: #8B4513;
  text-shadow: 0 0.5px 0 rgba(255, 255, 200, 0.5);
  font-family: var(--font-display);
  line-height: 1;
}
.gems-icon-sm {
  width: 1rem;
  height: 0.625rem;
}
.gems-icon-sm::before {
  top: -0.1875rem;
  left: 0.125rem;
  right: 0.125rem;
  height: 0.375rem;
}
.gems-icon-sm::after {
  font-size: 0.375rem;
}
.gold-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.25rem;
  height: 1.25rem;
  background: linear-gradient(135deg, #FFD700, #DAA520, #B8860B);
  color: #5c3000;
  font-size: 0.625rem;
  font-weight: 900;
  border-radius: 50%;
  box-shadow: 0 0 4px rgba(218, 165, 32, 0.5), inset 0 -2px 3px rgba(139, 69, 19, 0.4);
  text-shadow: 0 1px 1px rgba(255, 255, 255, 0.3);
  border: 1px solid #B8860B;
  font-family: var(--font-display);
  line-height: 1;
}

/* ============================================
   模态框遮罩层 (modal-overlay)
   ============================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--spacing-md);
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity 0.2s ease-out;
  pointer-events: none;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-overlay .modal-content {
  animation: none;
  max-width: min(90vw, 42.5rem);
  max-height: 85vh;
  width: 100%;
  transform: translateY(20px) scale(0.96);
  transition: transform 0.25s ease-out;
}

.modal-overlay.active .modal-content {
  transform: translateY(0) scale(1);
}

/* ============================================
   模态框关闭按钮 (modal-close)
   ============================================ */
.modal-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  padding: 0;
  font-size: 1.25rem;
  line-height: 1;
  color: var(--color-text-dim);
  background: transparent;
  border: 1px solid var(--color-border);
  border-radius: 50%;
  cursor: pointer;
  transition: all var(--transition-fast, 0.15s);
  flex-shrink: 0;
}

.modal-close:hover {
  color: var(--color-danger, #e74c3c);
  border-color: var(--color-danger, #e74c3c);
  background: rgba(231, 76, 60, 0.1);
}

/* ============================================
   模态框头部布局修复
   ============================================ */
.modal-overlay .modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--spacing-md);
  border-bottom: 1px solid var(--color-border);
}

.modal-overlay .modal-header h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.125rem;
  color: var(--color-gold);
}

/* 弹窗手机适配 */
@media (max-width: 480px) {
  .modal-overlay {
    padding: var(--spacing-sm);
  }
  .modal-overlay .modal-content {
    max-width: 100%;
    max-height: 90vh;
    border-radius: var(--radius-lg);
  }
  .modal-overlay .modal-header {
    padding: var(--spacing-sm) var(--spacing-md);
  }
  .modal-overlay .modal-header h3 {
    font-size: 1rem;
  }
  .modal-overlay .modal-body {
    max-height: 70vh;
  }
}

/* ============================================
   移动端响应式 - 组件
   ============================================ */
@media (max-width: 768px) {
  /* Modal sizing — fit within mobile viewport */
  .modal-content {
    width: 95vw;
    max-width: 95vw;
    max-height: 85vh;
    overflow-y: auto;
  }

  .modal-body {
    padding: 0.75rem;
    max-height: 60vh;
  }

  .modal-header {
    padding: var(--spacing-sm) var(--spacing-md);
  }

  .modal-title {
    font-size: 1.0625rem;
  }

  .modal-footer .btn {
    max-width: none;
    min-height: 2.75rem;
  }
}

@media (max-width: 480px) {
  /* Touch target — min 44px for all interactive elements */
  .btn,
  .action-btn,
  button {
    min-height: 2.75rem;
  }

  .btn-sm {
    min-height: 2.25rem;
  }

  /* Tabs — scrollable, tappable */
  .tab {
    min-height: 2.75rem;
    padding: var(--spacing-sm) 0.75rem;
    font-size: 0.75rem;
  }

  /* Toast — full width on mobile */
  #toast-container {
    max-width: 100%;
    padding: 0 var(--spacing-sm);
  }

  .toast {
    font-size: 0.75rem;
    padding: 0.625rem 0.75rem;
  }

  /* Hero card — smaller on mobile */
  .hero-card {
    padding: var(--spacing-xs);
  }

  .hero-card-avatar {
    font-size: 2rem;
  }

  .hero-card-name {
    font-size: 0.6875rem;
  }

  .hero-card-info {
    font-size: 0.625rem;
  }
}

/* ============================================
   分页栏
   ============================================ */
.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 0.75rem 0;
  margin-top: 0.5rem;
}
.pagination-bar .btn-prev,
.pagination-bar .btn-next {
  padding: 0.375rem 1rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--color-gold);
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md, 0.375rem);
  cursor: pointer;
  transition: all 0.2s;
}
.pagination-bar .btn-prev:hover:not(:disabled),
.pagination-bar .btn-next:hover:not(:disabled) {
  background: var(--color-bg-hover);
  border-color: var(--color-gold-dark);
}
.pagination-bar .btn-prev:disabled,
.pagination-bar .btn-next:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}
.pagination-bar .page-info {
  font-size: 0.75rem;
  color: var(--color-text-dim);
  min-width: 6.25rem;
  text-align: center;
}
