/* ============================================================
   Payment Modals — login + payment + unlock flow
   ============================================================ */

/* ----- Modal backdrop ----- */
.pm-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 9998;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: pmFadeIn 0.2s ease;
}

.pm-modal {
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  max-width: 440px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  animation: pmSlideUp 0.3s ease;
}

.pm-modal-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid #f0e6d6;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.pm-modal-header h3 {
  font-family: 'Noto Serif SC', serif;
  font-size: 18px;
  color: #8b0000;
  letter-spacing: 1px;
  margin: 0;
}

.pm-close {
  background: none;
  border: none;
  font-size: 24px;
  color: #9ca3af;
  cursor: pointer;
  line-height: 1;
  padding: 0 4px;
}
.pm-close:hover { color: #6b4c3b; }

.pm-modal-body {
  padding: 20px 24px 24px;
}

.pm-footer-note {
  padding: 12px 24px;
  background: #fbf6ea;
  border-top: 1px solid #f0e6d6;
  font-size: 12px;
  color: #6b4c3b;
  text-align: center;
  border-radius: 0 0 14px 14px;
}

/* ----- Login modal ----- */
.pm-login-desc {
  color: #6b4c3b;
  font-size: 14px;
  line-height: 1.7;
  margin-bottom: 16px;
}
.pm-field label {
  display: block;
  font-size: 13px;
  color: #6b4c3b;
  margin-bottom: 6px;
  font-weight: 500;
}
.pm-field input[type="email"],
.pm-field input[type="text"],
.pm-field input[type="password"] {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid #e8d5b7;
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  background: #fffaf0;
  transition: border-color 0.15s;
}
.pm-field input:focus {
  outline: none;
  border-color: #d4a017;
  background: #fff;
}

.pm-btn-primary {
  width: 100%;
  padding: 13px;
  background: linear-gradient(135deg, #8b0000, #c41e3a);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  letter-spacing: 2px;
}
.pm-btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(139, 0, 0, 0.3);
}
.pm-btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.pm-btn-secondary {
  width: 100%;
  padding: 11px;
  background: #fbf6ea;
  color: #6b4c3b;
  border: 1px solid #e8d5b7;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  margin-top: 10px;
}
.pm-btn-secondary:hover {
  background: #f5ecd9;
}

.pm-error {
  color: #c41e3a;
  font-size: 13px;
  margin-top: 10px;
  text-align: center;
}

/* ----- Payment modal — method selector ----- */
.pm-product-info {
  background: linear-gradient(135deg, #fdf6ec, #fffaf0);
  border: 1.5px solid #d4a017;
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 20px;
}
.pm-product-info h4 {
  font-family: 'Noto Serif SC', serif;
  color: #1a1a2e;
  font-size: 15px;
  margin: 0 0 4px;
}
.pm-product-info p {
  font-size: 12px;
  color: #6b4c3b;
  line-height: 1.6;
  margin: 0;
}
.pm-price {
  display: inline-block;
  font-family: 'Noto Serif SC', serif;
  font-size: 26px;
  font-weight: 700;
  color: #c41e3a;
  margin-top: 6px;
}

.pm-methods {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 8px;
}
.pm-method-btn {
  padding: 18px 12px;
  background: #fff;
  border: 2px solid #e8d5b7;
  border-radius: 10px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  color: #6b4c3b;
  transition: all 0.15s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.pm-method-btn:hover {
  border-color: #d4a017;
  background: #fffdf5;
  transform: translateY(-1px);
}
.pm-method-btn .pm-method-icon {
  font-size: 28px;
  line-height: 1;
}
.pm-method-btn.wechat .pm-method-icon { color: #09bb07; }
.pm-method-btn.alipay .pm-method-icon { color: #1677ff; }

/* ----- Payment QR display ----- */
.pm-qr-wrap {
  text-align: center;
}
.pm-qr-image {
  max-width: 200px;
  width: 100%;
  height: auto;
  border: 4px solid #fff;
  border-radius: 12px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
  margin: 8px auto;
}
.pm-qr-placeholder {
  width: 200px;
  height: 200px;
  margin: 8px auto;
  background: #f5f0e8;
  border: 2px dashed #d4a017;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #6b4c3b;
  font-size: 12px;
  text-align: center;
  padding: 20px;
}
.pm-order-info {
  background: #fbf6ea;
  border-radius: 8px;
  padding: 10px 14px;
  margin: 14px 0;
  font-size: 13px;
  color: #2d1b0e;
  line-height: 1.7;
  text-align: left;
}
.pm-order-info strong { color: #8b0000; font-size: 14px; }
.pm-order-info code {
  display: inline-block;
  background: #fff;
  padding: 2px 8px;
  border-radius: 4px;
  font-family: monospace;
  color: #c41e3a;
  font-size: 13px;
  border: 1px solid #e8d5b7;
  user-select: all;
}
.pm-instructions {
  font-size: 12px;
  color: #6b4c3b;
  line-height: 1.8;
  white-space: pre-wrap;
  padding: 10px 0;
  text-align: left;
}

/* ----- Status indicator ----- */
.pm-status {
  text-align: center;
  padding: 14px;
  border-radius: 8px;
  font-size: 14px;
  margin: 12px 0;
  font-weight: 500;
}
.pm-status.pending {
  background: #fef3c7;
  color: #92400e;
}
.pm-status.paid {
  background: #d1fae5;
  color: #065f46;
  font-weight: 700;
}
.pm-status.failed {
  background: #fee2e2;
  color: #991b1b;
}
.pm-status .pm-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid #92400e;
  border-top-color: transparent;
  border-radius: 50%;
  animation: pmSpin 0.8s linear infinite;
  vertical-align: middle;
  margin-right: 6px;
}

/* ----- Animations ----- */
@keyframes pmFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes pmSlideUp {
  from { transform: translateY(30px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
@keyframes pmSpin {
  to { transform: rotate(360deg); }
}

/* ----- Mobile ----- */
@media (max-width: 480px) {
  .pm-modal {
    max-width: 100%;
    margin: 0;
    border-radius: 12px 12px 0 0;
    max-height: 95vh;
  }
  .pm-backdrop {
    align-items: flex-end;
    padding: 0;
  }
  .pm-methods {
    grid-template-columns: 1fr;
  }
}

/* ============================================================
   Paywall Card — inline gated content CTA
   Shown in place of locked sections with a big "解锁" button
   ============================================================ */
.pm-paywall-card {
  position: relative;
  max-width: 560px;
  margin: 32px auto;
  padding: 36px 32px 28px;
  background: linear-gradient(160deg, #fffaf0 0%, #fdf6ec 60%, #fbf1d3 100%);
  border: 2px solid #d4a017;
  border-radius: 16px;
  text-align: center;
  box-shadow: 0 8px 28px rgba(212, 160, 23, 0.25);
  overflow: hidden;
  font-family: 'Noto Sans SC', 'PingFang SC', 'Microsoft YaHei', sans-serif;
}

.pm-paywall-card::before {
  /* Decorative gold gradient bar at the top */
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 6px;
  background: linear-gradient(90deg, #d4a017, #f0d060, #d4a017);
}

.pm-paywall-lock {
  font-size: 46px;
  line-height: 1;
  margin-bottom: 12px;
  filter: drop-shadow(0 2px 6px rgba(212, 160, 23, 0.4));
}

.pm-paywall-title {
  font-family: 'Noto Serif SC', serif;
  font-size: 22px;
  font-weight: 700;
  color: #8b0000;
  letter-spacing: 2px;
  margin-bottom: 10px;
}

.pm-paywall-desc {
  font-size: 14px;
  color: #6b4c3b;
  line-height: 1.7;
  margin-bottom: 18px;
  max-width: 440px;
  margin-left: auto;
  margin-right: auto;
}

.pm-paywall-subtitle {
  font-size: 13px;
  color: #8b0000;
  font-weight: 500;
  margin-bottom: 16px;
  padding: 8px 16px;
  background: rgba(139, 0, 0, 0.06);
  border-radius: 20px;
  display: inline-block;
}

.pm-paywall-features-heading {
  font-family: 'Noto Serif SC', serif;
  font-size: 15px;
  font-weight: 700;
  color: #8b0000;
  margin: 20px 0 12px;
  letter-spacing: 1px;
}

.pm-paywall-features {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 12px auto 22px;
  max-width: 440px;
  text-align: left;
}

.pm-paywall-feat {
  font-size: 13.5px;
  color: #2d1b0e;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.75);
  border-left: 3px solid #d4a017;
  border-radius: 4px;
  line-height: 1.5;
  transition: all 0.2s;
}

.pm-paywall-feat:hover {
  background: rgba(255, 255, 255, 0.95);
  transform: translateX(2px);
}

/* ====== Free version fade mask (渐变遮罩, 示意"未完待续") ====== */
.sv-free-fade-mask {
  position: relative;
  height: 120px;
  margin-top: -80px;  /* 覆盖最后一章末尾部分 */
  background: linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 252, 245, 0.6) 40%,
    rgba(255, 250, 240, 0.9) 70%,
    rgba(255, 250, 240, 1) 100%
  );
  pointer-events: none;
  border-radius: 0 0 12px 12px;
}

/* "精简预览" 徽章 */
.sv-free-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  color: #8b4513;
  background: linear-gradient(135deg, #fff8dc, #ffe4b5);
  padding: 2px 10px;
  border-radius: 10px;
  margin-left: 8px;
  letter-spacing: 1px;
  vertical-align: middle;
  border: 1px solid #d4a017;
}

.pm-paywall-btn {
  display: inline-block;
  padding: 14px 44px;
  background: linear-gradient(135deg, #8b0000 0%, #c41e3a 100%);
  color: #fff;
  border: none;
  border-radius: 30px;
  font-size: 16px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  letter-spacing: 2px;
  box-shadow: 0 4px 16px rgba(139, 0, 0, 0.35);
  transition: transform 0.15s, box-shadow 0.15s;
}
.pm-paywall-btn strong {
  font-weight: 700;
  font-size: 18px;
  margin-left: 4px;
}
.pm-paywall-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(139, 0, 0, 0.5);
}

.pm-paywall-sub {
  font-size: 12px;
  color: #6b4c3b;
  margin-top: 10px;
}

.pm-paywall-card.compact {
  padding: 22px 20px;
  max-width: 100%;
  margin: 16px 0;
}
.pm-paywall-card.compact .pm-paywall-lock { font-size: 32px; margin-bottom: 8px; }
.pm-paywall-card.compact .pm-paywall-title { font-size: 17px; margin-bottom: 6px; }
.pm-paywall-card.compact .pm-paywall-desc { font-size: 13px; margin-bottom: 12px; }
.pm-paywall-card.compact .pm-paywall-features { margin: 10px auto 16px; }
.pm-paywall-card.compact .pm-paywall-btn { padding: 11px 32px; font-size: 14px; }

/* Wrapper applied to a locked content section — shows a gradient fade +
   paywall card overlay, letting users see a teaser at the top */
.pm-gated-section {
  position: relative;
  overflow: hidden;
}

.pm-gated-section > .pm-gated-content {
  /* Increased from 320 → 560 so users see more of what they're buying */
  max-height: 560px;
  overflow: hidden;
  position: relative;
  filter: blur(0.5px);
}

.pm-gated-section > .pm-gated-content::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  /* Taller fade so the bottom is unreadable but the top reads clearly */
  height: 260px;
  background: linear-gradient(to bottom, transparent 0%, rgba(245, 240, 232, 0.95) 75%, #f5f0e8 100%);
  pointer-events: none;
}

@media (max-width: 600px) {
  .pm-paywall-card { padding: 24px 18px 22px; margin: 20px 0; }
  .pm-paywall-title { font-size: 18px; }
  .pm-paywall-lock { font-size: 36px; }
  .pm-paywall-btn { padding: 12px 28px; font-size: 14px; }
}
