/* Server-authoritative payment catalog and confirmation surface. */
#paywall-page {
  position: fixed;
  inset: 0;
  z-index: calc(var(--z-modal, 200) + 70);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #000;
  color: #fff;
}

#paywall-page.hidden,
.pw-review[hidden],
.pw-review-backdrop[hidden],
.pw-renewal-banner[hidden] {
  display: none;
}

.pw-nav {
  position: relative;
  z-index: 2;
  display: flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: space-between;
  height: var(--nav-height, 48px);
  padding: 0 16px;
}

.pw-back-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: 0;
  background: none;
  cursor: pointer;
}

.pw-nav-title {
  margin: 0;
  color: #fff;
  font-size: 17px;
  font-weight: 600;
}

.pw-nav-spacer {
  width: 44px;
}

.pw-body {
  flex: 1;
  overflow-y: auto;
  padding: 4px 20px calc(24px + env(safe-area-inset-bottom, 0px));
  scrollbar-width: none;
}

.pw-body::-webkit-scrollbar {
  display: none;
}

.pw-status {
  min-height: 24px;
  margin: 0 0 14px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 13px;
  line-height: 1.45;
}

.pw-status--error,
.pw-review-status.pw-status--error {
  color: #ff8a80;
}

.pw-renewal-banner {
  margin: 0 0 20px;
  padding: 14px 16px;
  border: 1px solid rgba(245, 200, 91, 0.42);
  border-radius: 14px;
  color: #fff4cf;
  background: rgba(245, 200, 91, 0.12);
  font-size: 14px;
  line-height: 1.45;
}

.pw-renewal-banner strong {
  display: block;
  margin-bottom: 4px;
  color: #ffd45d;
  font-size: 15px;
}

.pw-renewal-banner p {
  margin: 0;
}

.pw-renewal-banner time {
  font-weight: 700;
}

.pw-retry-btn {
  min-height: 44px;
  margin-left: 10px;
  padding: 6px 14px;
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 18px;
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
  font: inherit;
  cursor: pointer;
}

.pw-section {
  margin-bottom: 28px;
}

.pw-section-header,
.pw-coins-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.pw-crown-icon,
.pw-coin-icon {
  width: 24px;
  height: 24px;
  object-fit: contain;
}

.pw-section-title {
  margin: 0;
  color: #fff;
  font-size: 20px;
  font-weight: 700;
  line-height: 1.2;
}

.pw-section-desc,
.pw-empty {
  margin: 0 0 14px;
  color: rgba(255, 255, 255, 0.55);
  font-size: 13px;
  line-height: 1.45;
}

.plan-list {
  display: grid;
  gap: 12px;
}

.coins-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.coins-grid .pw-empty {
  grid-column: 1 / -1;
}

.pw-product-card {
  min-width: 0;
  min-height: 112px;
  padding: 16px;
  border: 2px solid transparent;
  border-radius: 14px;
  color: #fff;
  background: #2b2d3c;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.pw-product-card:active {
  transform: scale(0.98);
}

.pw-product-card--selected {
  border-color: #f5c85b;
}

.pw-product-card:focus-visible,
.pw-retry-btn:focus-visible,
.pw-confirm-btn:focus-visible,
.pw-review-close:focus-visible,
.pw-legal-links a:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

.pw-product-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.pw-product-name {
  overflow-wrap: anywhere;
  color: #fff;
  font-size: 16px;
  font-weight: 650;
}

.pw-product-price {
  flex-shrink: 0;
  color: #fff;
  font-size: 18px;
  font-weight: 750;
}

.pw-product-quantity {
  display: block;
  margin-top: 8px;
  color: #ffd45d;
  font-size: 15px;
  font-weight: 650;
}

.pw-product-description {
  display: block;
  margin-top: 8px;
  overflow-wrap: anywhere;
  color: rgba(255, 255, 255, 0.62);
  font-size: 12px;
  line-height: 1.4;
}

.pw-review {
  margin-top: 4px;
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 16px;
  background: #171820;
}

.pw-review-backdrop,
.pw-review-close {
  display: none;
}

.pw-review-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.pw-review-heading {
  margin: 0 0 14px;
  font-size: 19px;
}

.pw-review-summary {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.pw-review-name,
.pw-review-description,
.pw-review-price,
.pw-review-status {
  margin: 0;
}

.pw-review-name {
  font-size: 16px;
  font-weight: 700;
}

.pw-review-description {
  margin-top: 6px;
  overflow-wrap: anywhere;
  color: rgba(255, 255, 255, 0.62);
  font-size: 12px;
  line-height: 1.45;
}

.pw-review-price {
  flex-shrink: 0;
  font-size: 22px;
  font-weight: 750;
}

.pw-legal-links {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin: 18px 0;
}

.pw-legal-links a {
  color: #8bbcff;
  font-size: 14px;
  text-decoration: underline;
}

.pw-legal-links .pw-legal-link--invalid {
  color: rgba(255, 255, 255, 0.38);
  cursor: not-allowed;
}

.pw-consent-label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  color: rgba(255, 255, 255, 0.85);
  font-size: 13px;
  line-height: 1.45;
  cursor: pointer;
}

.pw-consent-label input {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  margin: 0;
  accent-color: var(--color-primary, #e4486b);
}

.pw-review-status {
  min-height: 20px;
  margin-top: 12px;
  color: rgba(255, 255, 255, 0.66);
  font-size: 12px;
  line-height: 1.4;
}

.pw-confirm-btn {
  width: 100%;
  min-height: 48px;
  margin-top: 0;
  border: 0;
  border-radius: 12px;
  color: #fff;
  background: var(--color-primary, #e4486b);
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
}

.pw-review-actions {
  margin-top: 10px;
}

.pw-confirm-btn:disabled {
  color: rgba(255, 255, 255, 0.48);
  background: rgba(255, 255, 255, 0.12);
  cursor: not-allowed;
}

@media (max-width: 360px) {
  .pw-body {
    padding-right: 12px;
    padding-left: 12px;
  }

  .coins-grid {
    grid-template-columns: 1fr;
  }

  .pw-review-summary,
  .pw-product-heading {
    flex-direction: column;
    gap: 6px;
  }
}

@media (max-width: 767px) {
  body.pw-review-open {
    overscroll-behavior: none;
  }

  body.pw-review-open .pw-body {
    overflow: hidden;
  }

  .pw-review-backdrop {
    position: fixed;
    z-index: 3;
    inset: 0;
    display: block;
    background: rgba(0, 0, 0, 0.68);
  }

  .pw-review {
    position: fixed;
    z-index: 4;
    right: 0;
    bottom: 0;
    left: 0;
    max-height: 88vh;
    max-height: min(88dvh, 720px);
    margin: 0;
    padding: 20px 18px 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -18px 48px rgba(0, 0, 0, 0.45);
  }

  .pw-review-close {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    margin: -10px -10px 0 0;
    border: 0;
    border-radius: 50%;
    color: #fff;
    background: transparent;
    font-size: 30px;
    line-height: 1;
    cursor: pointer;
  }

  .pw-review-actions {
    position: sticky;
    bottom: 0;
    margin: 10px -18px 0;
    padding: 10px 18px calc(12px + env(safe-area-inset-bottom, 0px));
    background: #171820;
  }
}

@media (min-width: 768px) {
  .pw-body {
    width: 100%;
    max-width: 1120px;
    margin-right: auto;
    margin-left: auto;
    padding-right: 24px;
    padding-left: 24px;
  }

  .plan-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .coins-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* React episode unlock sheet — points-first checkout. */
.ep-unlock-overlay { position: absolute; z-index: 30; inset: 0; display: flex; align-items: flex-end; justify-content: center; padding: 16px 16px max(20px, env(safe-area-inset-bottom)); background: linear-gradient(180deg, rgba(0,0,0,.35), rgba(0,0,0,.86)); backdrop-filter: blur(8px); }
.ep-unlock-modal { width: min(100%, 520px); max-height: min(90dvh, 760px); overflow-y: auto; padding: 22px; color: #fff; border: 1px solid rgba(235,198,107,.22); border-radius: 22px; background: linear-gradient(150deg, #1d1a18, #111); box-shadow: 0 24px 80px rgba(0,0,0,.6); }
.ep-unlock-header { display: flex; align-items: start; justify-content: space-between; gap: 18px; }
.ep-unlock-kicker { display: block; margin-bottom: 5px; color: #d7ad54; font-size: 9px; font-weight: 900; letter-spacing: .18em; }
.ep-unlock-header h2 { margin: 0; font: 500 29px/1 "Iowan Old Style", Georgia, serif; }
.ep-unlock-header button { width: 40px; height: 40px; color: rgba(255,255,255,.65); border-radius: 50%; background: rgba(255,255,255,.05); font-size: 26px; }
.ep-unlock-balance { display: flex; align-items: center; justify-content: space-between; margin-top: 22px; padding: 13px 15px; border: 1px solid rgba(255,255,255,.07); border-radius: 12px; background: rgba(255,255,255,.035); }
.ep-unlock-balance > span { color: rgba(255,255,255,.45); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; }
.ep-unlock-balance strong { color: #e8c46d; font-size: 15px; }
.ep-unlock-balance i { font-style: normal; }
.ep-unlock-price { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 19px 2px; }
.ep-unlock-price div { display: grid; gap: 4px; }
.ep-unlock-price span { font-size: 14px; font-weight: 750; }
.ep-unlock-price small, .ep-unlock-footnote { color: rgba(255,255,255,.4); font-size: 10px; }
.ep-unlock-price > strong { color: #fff; font: 500 23px/1 "Iowan Old Style", Georgia, serif; }
.ep-unlock-options { display: grid; gap: 9px; padding: 16px 0; }
.ep-unlock-option { position: relative; display: flex; width: 100%; min-height: 68px; align-items: center; justify-content: space-between; gap: 14px; padding: 13px 15px; color: #fff; border: 1px solid rgba(255,255,255,.09); border-radius: 13px; background: rgba(255,255,255,.035); text-align: left; }
.ep-unlock-option > div { display: grid; min-width: 0; gap: 3px; }
.ep-unlock-option span { font-size: 14px; font-weight: 750; }
.ep-unlock-option small { color: rgba(255,255,255,.44); font-size: 10px; line-height: 1.4; }
.ep-unlock-option > strong { flex: 0 0 auto; color: #f0cd75; font-size: 15px; }
.ep-unlock-option > del { position: absolute; right: 15px; bottom: 7px; color: rgba(255,255,255,.3); font-size: 9px; }
.ep-unlock-option--full { min-height: 78px; border-color: rgba(232,189,91,.3); background: rgba(232,189,91,.075); }
.ep-unlock-option:disabled { opacity: .46; }
.ep-unlock-actions { display: grid; gap: 9px; }
.ep-unlock-primary { display: flex; width: 100%; min-height: 50px; align-items: center; justify-content: center; padding: 0 18px; color: #150c0d; border: 0; border-radius: 999px; background: linear-gradient(100deg, #e84d70, #f0a46f); font-size: 14px; font-weight: 850; text-align: center; box-shadow: 0 12px 34px rgba(232,77,112,.2); }
.ep-unlock-primary:disabled { opacity: .5; }
.ep-unlock-membership { display: flex; min-height: 58px; align-items: center; gap: 12px; padding: 10px 15px; color: #f3d77e; border: 1px solid rgba(232,189,91,.26); border-radius: 14px; background: rgba(232,189,91,.06); }
.ep-unlock-membership > span { font-size: 23px; }
.ep-unlock-membership > div { display: grid; gap: 2px; }
.ep-unlock-membership strong { font-size: 12px; }
.ep-unlock-membership small { color: rgba(255,255,255,.42); font-size: 9px; }
.ep-unlock-shortfall { margin: 0 0 10px; color: #f4b3c1; font-size: 12px; text-align: center; }
.ep-unlock-message { margin: 11px 0 0; color: #ff9caf; font-size: 12px; text-align: center; }
.ep-unlock-footnote { margin: 13px auto 0; max-width: 42ch; line-height: 1.5; text-align: center; }

@media (min-width: 768px) {
  .ep-unlock-overlay { align-items: center; }
  .ep-unlock-modal { padding: 28px; }
}
