/* 赞助弹窗 — 墨韵禅意 · 自适应 */

html.sponsor-open,
html.sponsor-open body {
  overflow: hidden;
  overscroll-behavior: none;
}

.sp-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(0.75rem, env(safe-area-inset-top))
    max(0.75rem, env(safe-area-inset-right))
    max(0.75rem, env(safe-area-inset-bottom))
    max(0.75rem, env(safe-area-inset-left));
  background:
    radial-gradient(ellipse at 50% 20%, rgba(61, 107, 90, 0.12), transparent 55%),
    rgba(14, 18, 16, 0.58);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-sizing: border-box;
}

.sp-panel {
  position: relative;
  width: min(100%, 440px);
  max-height: min(88vh, 720px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background:
    linear-gradient(180deg, #fbfcf9 0%, #f3f5f1 100%);
  color: #1a1c1a;
  border: 1px solid rgba(26, 28, 26, 0.1);
  border-radius: 2px;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.65) inset,
    0 24px 64px rgba(0, 0, 0, 0.22);
}

.sp-panel::before {
  content: "";
  position: absolute;
  left: 1.25rem;
  right: 1.25rem;
  top: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, #3d6b5a, transparent);
  opacity: 0.55;
  pointer-events: none;
}

.sp-close {
  position: absolute;
  top: 0.55rem;
  right: 0.55rem;
  z-index: 2;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  color: #7a847c;
  transition: background .2s, color .2s;
}
.sp-close:hover {
  background: rgba(26, 28, 26, 0.06);
  color: #1a1c1a;
}

.sp-title {
  flex: 0 0 auto;
  margin: 0;
  padding: 1.45rem 2.75rem 0.85rem 1.35rem;
  font-family: "STKaiti", "KaiTi", "Kaiti SC", "Songti SC", serif;
  font-weight: 500;
  font-size: clamp(1.15rem, 3.8vw, 1.4rem);
  letter-spacing: 0.1em;
  line-height: 1.45;
  text-align: center;
  color: #1a1c1a;
}

.sp-body {
  flex: 1 1 auto;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding: 0 1.25rem 1.25rem;
  overscroll-behavior: contain;
}

.sp-desc {
  margin: 0 0 1.1rem;
  padding: 0.85rem 0.95rem;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(26, 28, 26, 0.07);
  color: #3e463f;
  line-height: 1.8;
  text-align: justify;
  text-justify: inter-ideograph;
  font-size: 0.9rem;
  letter-spacing: 0.02em;
}

.sp-plans {
  display: grid;
  gap: 0.65rem;
}

.sp-plan-btn {
  display: grid;
  grid-template-columns: minmax(4.5rem, auto) 1fr;
  grid-template-areas:
    "amount desc"
    "amount days";
  gap: 0.2rem 0.9rem;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  text-align: left;
  border: 1px solid rgba(26, 28, 26, 0.1);
  background: #fff;
  padding: 0.95rem 1rem;
  cursor: pointer;
  font: inherit;
  color: inherit;
  transition: border-color .2s, box-shadow .2s, transform .2s;
}
.sp-plan-btn:hover {
  border-color: rgba(42, 79, 66, 0.45);
  box-shadow: 0 6px 18px rgba(26, 28, 26, 0.06);
}
.sp-plan-btn:active {
  transform: scale(0.995);
}

.sp-plan-amount {
  grid-area: amount;
  align-self: center;
  justify-self: center;
  font-family: "STKaiti", "KaiTi", "Songti SC", serif;
  font-size: clamp(1.05rem, 3.5vw, 1.28rem);
  color: #2a4f42;
  letter-spacing: 0.04em;
  line-height: 1.25;
  text-align: center;
  max-width: 6.5rem;
  word-break: break-word;
}

.sp-plan-desc {
  grid-area: desc;
  font-size: 0.92rem;
  line-height: 1.55;
  color: #2e322e;
  word-break: break-word;
}

.sp-plan-days {
  grid-area: days;
  font-size: 0.75rem;
  color: #8a9188;
  letter-spacing: 0.04em;
}

.sp-plan-chosen {
  text-align: center;
  margin: 0 0 1rem;
  padding: 0.65rem 0.75rem;
  background: rgba(232, 239, 233, 0.65);
  border: 1px solid rgba(61, 107, 90, 0.15);
  color: #2e322e;
  font-size: 0.9rem;
  line-height: 1.55;
  word-break: break-word;
}
.sp-plan-chosen strong {
  color: #2a4f42;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.sp-qr-wrap {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.7rem;
  margin-bottom: 0.25rem;
}

.sp-pay-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.45rem;
}
.sp-pay-tabs button {
  min-height: 42px;
  border: 1px solid rgba(26, 28, 26, 0.1);
  background: #fff;
  cursor: pointer;
  letter-spacing: 0.12em;
  font: inherit;
  font-size: 0.9rem;
  color: #4a524c;
  transition: background .2s, border-color .2s, color .2s;
}
.sp-pay-tabs button.is-on {
  border-color: #2a4f42;
  background: #1a1c1a;
  color: #f3f5f1;
}

.sp-qr-single {
  text-align: center;
  padding: 0.85rem;
  background: #fff;
  border: 1px solid rgba(26, 28, 26, 0.08);
}
.sp-qr-single img {
  width: min(100%, 220px);
  max-width: 72vw;
  height: auto;
  aspect-ratio: 1;
  object-fit: contain;
  display: block;
  margin: 0 auto;
  background: #fff;
}
.sp-qr-single.is-wechat {
  border-color: rgba(7, 193, 96, 0.28);
  box-shadow: inset 0 0 0 1px rgba(7, 193, 96, 0.08);
}

.sp-dl {
  width: 100%;
  margin: 0;
}

.sp-waiting {
  margin: 0;
  text-align: center;
  color: #6a726c;
  font-size: 0.84rem;
  line-height: 1.65;
  padding: 0 0.25rem;
}

.sp-tip {
  text-align: center;
  color: #8a9188;
  margin: 0.75rem 0;
  font-size: 0.9rem;
}

.sp-actions {
  display: grid;
  gap: 0.55rem;
  margin-top: 0.85rem;
}

.sp-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  width: 100%;
  box-sizing: border-box;
  border: 1px solid transparent;
  cursor: pointer;
  font: inherit;
  font-size: 0.92rem;
  letter-spacing: 0.1em;
  padding: 0 1rem;
  transition: background .2s, color .2s, border-color .2s;
}
.sp-btn-primary {
  background: #1a1c1a;
  color: #f3f5f1;
}
.sp-btn-primary:hover {
  background: #2a4f42;
}
.sp-btn-ghost {
  background: transparent;
  border-color: rgba(26, 28, 26, 0.18);
  color: #2e322e;
}
.sp-btn-ghost:hover {
  background: rgba(26, 28, 26, 0.04);
}

/* 手机端 */
@media (max-width: 640px) {
  .sp-overlay {
    align-items: flex-end;
    padding: 0;
  }
  .sp-panel {
    width: 100%;
    max-height: min(92vh, 100%);
    border-radius: 14px 14px 0 0;
    border-left: 0;
    border-right: 0;
    border-bottom: 0;
  }
  .sp-panel::before {
    left: 20%;
    right: 20%;
    top: 0.45rem;
    height: 3px;
    border-radius: 99px;
    background: rgba(26, 28, 26, 0.12);
    opacity: 1;
  }
  .sp-title {
    padding: 1.55rem 3rem 0.75rem 1.1rem;
    font-size: 1.18rem;
  }
  .sp-body {
    padding: 0 1.05rem calc(1.15rem + env(safe-area-inset-bottom));
  }
  .sp-desc {
    font-size: 0.86rem;
    line-height: 1.75;
    text-align: left;
  }
  .sp-plan-btn {
    grid-template-columns: 1fr;
    grid-template-areas:
      "amount"
      "desc"
      "days";
    gap: 0.3rem;
    padding: 0.9rem 0.95rem;
  }
  .sp-plan-amount {
    justify-self: start;
    text-align: left;
    max-width: 100%;
    font-size: 1.2rem;
  }
  .sp-qr-single img {
    width: min(100%, 200px);
  }
}

@media (min-width: 641px) and (max-height: 700px) {
  .sp-panel { max-height: 92vh; }
  .sp-qr-single img { width: min(100%, 180px); }
}

@media (prefers-reduced-motion: reduce) {
  .sp-plan-btn,
  .sp-btn,
  .sp-close,
  .sp-pay-tabs button {
    transition: none;
  }
}
