.membership-modal-layer {
  position: fixed;
  inset: 0;
  z-index: 230;
  display: grid;
  place-items: center;
  padding: 18px;
}

.membership-modal-layer[hidden] { display: none !important; }
.membership-backdrop { position: absolute; inset: 0; background: rgba(19, 24, 27, .48); backdrop-filter: blur(3px); }
.membership-modal {
  position: relative;
  width: min(100%, 520px);
  max-height: min(90dvh, 720px);
  overflow-y: auto;
  padding: 28px;
  border: 1px solid #e5e6ed;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(22, 28, 45, .24);
}
.membership-close {
  position: absolute;
  top: 13px;
  right: 14px;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #737980;
  background: #f3f4f5;
}
.membership-close svg { width: 17px; height: 17px; }
.membership-close { font-size: 24px; }
.membership-heading { display: flex; align-items: center; gap: 12px; padding-right: 30px; }
.membership-mark { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 12px; color: #fff; background: linear-gradient(145deg, #7c62dd, #b16ab4); }
.membership-mark svg { width: 21px; height: 21px; }
.membership-heading p { margin: 0 0 4px; color: #887fba; font-size: 9px; font-weight: 850; letter-spacing: .15em; }
.membership-heading h2 { margin: 0; color: #252637; font-size: 25px; line-height: 1.12; }
.membership-intro { margin: 17px 0 14px; color: #727681; font-size: 12px; line-height: 1.55; }
.membership-status { display: flex; flex-direction: column; gap: 3px; margin: 0 0 14px; padding: 10px 12px; border: 1px solid #ebe7fb; border-radius: 10px; color: #6f6593; background: #faf8ff; font-size: 11px; line-height: 1.35; }
.membership-status strong { color: #5846a6; font-size: 12px; }
.membership-plans { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.membership-plan { position: relative; min-height: 126px; display: flex; flex-direction: column; align-items: flex-start; padding: 14px 11px 12px; border: 1px solid #e4e6e9; border-radius: 11px; color: #343642; background: #fbfcfd; text-align: left; transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease; }
.membership-plan:hover { border-color: #b4a4ed; transform: translateY(-1px); }
.membership-plan.selected { border-color: #7c62dd; box-shadow: 0 0 0 2px rgba(124, 98, 221, .14); background: #faf8ff; }
.membership-plan.featured { border-color: #e2c281; }
.membership-badge { position: absolute; top: -9px; right: 8px; padding: 3px 6px; border-radius: 999px; color: #765522; background: #fbebc4; font-size: 8px; font-weight: 850; }
.membership-plan-title { color: #6f747d; font-size: 10px; font-weight: 750; line-height: 1.25; }
.membership-plan strong { margin-top: 9px; color: #272935; font-size: 21px; line-height: 1; }
.membership-plan small { margin-top: auto; padding-top: 10px; color: #9ca1a7; font-size: 9px; }
.membership-empty { grid-column: 1 / -1; margin: 12px 0; color: #9a9fa5; font-size: 11px; text-align: center; }
.membership-checkout-status { min-height: 30px; margin: 11px 0 7px; color: #777b84; font-size: 10px; line-height: 1.45; }
.membership-checkout-status.error { color: #b24747; }
.membership-buy { width: 100%; min-height: 46px; border-radius: 9px; color: #fff; background: #00a651; font-size: 13px; font-weight: 850; box-shadow: 0 8px 16px rgba(0, 166, 81, .17); }
.membership-buy:hover { background: #008d45; }
.membership-buy:disabled { cursor: wait; opacity: .6; }
.membership-cancel { width: 100%; margin-top: 6px; padding: 8px; color: #7a7f86; background: transparent; font-size: 11px; }
.membership-note { display: block; margin-top: 9px; color: #a0a5aa; font-size: 9px; line-height: 1.45; text-align: center; }
.membership-legal { font-size: 12px; text-align: center; margin: 14px 0; color: #624bb7; }
.membership-order { padding: 10px 0; border-top: 1px solid #ece9f3; font-size: 12px; }
.membership-order small { display: block; font-size: 10px; overflow-wrap: anywhere; color: #727681; margin: 5px 0; }
.membership-order button { color: #624bb7; background: #faf8ff; border-radius: 6px; padding: 8px; }
.chapter-membership { width: 100%; margin-top: 10px; }
.membership-promo { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 16px; margin: 16px auto; background: #f3efff; border-radius: 12px; color: #5846a6; }
.membership-promo small { display: block; margin-top: 4px; font-size: 11px; }
.membership-promo button { flex-shrink: 0; border-radius: 8px; color: #fff; background: #7356dc; padding: 10px; font-size: 12px; }
#top > .membership-promo { width: calc(100% - 30px); }

@media (max-width: 600px) {
  .membership-modal-layer { align-items: end; padding: 0; }
  .membership-modal { width: 100%; max-height: min(90dvh, 720px); padding: 25px 19px max(19px, env(safe-area-inset-bottom)); border-radius: 17px 17px 0 0; animation: membership-sheet-in .22s ease-out; }
  .membership-modal::before { content: ""; position: absolute; top: 8px; left: 50%; width: 38px; height: 4px; border-radius: 4px; background: #e1e3e6; transform: translateX(-50%); }
  .membership-heading h2 { font-size: 23px; }
}
@keyframes membership-sheet-in { from { opacity: .35; transform: translateY(18px); } to { opacity: 1; transform: translateY(0); } }

.profile-wallet-actions { display: flex; align-items: center; gap: 7px; }
.profile-membership-button { min-height: 38px; padding: 0 10px; border: 1px solid #7c62dd; border-radius: 8px; color: #624bb7; background: #faf8ff; font-size: 10px; font-weight: 800; }
.profile-membership-button:hover { background: #f0edff; }

.paywall-cta-actions { display: flex; align-items: center; gap: 8px; }
.paywall-cta-actions .paywall-cta-button { flex: 1; }
.paywall-membership-button { min-height: 39px; padding: 0 12px; border: 1px solid #7c62dd; border-radius: 8px; color: #624bb7; background: #faf8ff; font-size: 11px; font-weight: 800; white-space: nowrap; }
.paywall-membership-button:hover { background: #f0edff; }
@media (max-width: 460px) { .paywall-cta-actions { align-items: stretch; flex-direction: column; } .paywall-membership-button { width: 100%; } }
@media (max-width: 360px) { .profile-wallet-actions { flex-direction: column; } .membership-plan { padding-inline: 7px; } .membership-plan strong { font-size: 18px; } }
