/* Adopted S3 fresh/stable geometry. Business state and modal stack are unchanged. */
html:has(body.watch-active), html:has(body.modal-open) { scrollbar-gutter: auto; }
body.watch-active { overflow: hidden; }
.overlay { width: 100vw; inset: 0 auto 0 0; }
.episode-sheet { width: 100%; max-width: none; border-radius: 30px 30px 0 0; background: radial-gradient(ellipse at 8% 0, rgb(255 23 79 / 14%), transparent 60%), linear-gradient(#17030d, #08030d 58%, #030104); }
.episode-sheet .dialog-header { position: relative; min-height: 70px; padding: 16px 60px; }
.episode-sheet .dialog-header h2 { flex: 1; font-size: 22px; line-height: 33px; font-weight: 600; text-align: center; }
.episode-sheet .dialog-header .icon-btn { position: absolute; right: 10px; top: 12px; }
.episode-sheet .dialog-body { padding: 16px 20px calc(22px + env(safe-area-inset-bottom)); }
.episode-sheet .episode-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.episode-sheet .episode-cell { position: relative; aspect-ratio: 1; min-width: 44px; min-height: 44px; padding: 8px 4px 18px; border-radius: 11px; background: rgb(255 255 255 / 5%); font-size: 21px; line-height: 26px; font-weight: 700; }
.episode-sheet .episode-cell > svg { position: absolute; top: 6px; right: 6px; width: 21px; height: 21px; padding: 3px; border-radius: 6px; color: white; background: linear-gradient(135deg, #ff174f, #c600ff); }
.episode-sheet .episode-cell .lock-label { position: absolute; left: 2px; right: 2px; bottom: 5px; justify-content: center; color: #ffd4e5; font-size: 10px; line-height: 13px; }
.episode-sheet .episode-cell.is-current { border: 2.667px solid #ff174f; background: linear-gradient(135deg, rgb(255 23 79 / 20%), rgb(198 0 255 / 10%)); box-shadow: 0 0 14px rgb(255 23 79 / 24%); }
.episode-sheet .episode-cell.is-current > svg { top: auto; right: auto; bottom: 5px; left: calc(50% - 8px); width: 16px; height: 16px; padding: 0; border-radius: 0; background: none; }
/* Keep separate badge, number and status rows even in the smallest 4-column cell. */
.episode-sheet .episode-cell.is-current > span { line-height: 22px; }
.episode-sheet .episode-cell.is-locked > svg { top: 0; right: 1px; bottom: auto; left: auto; width: 21px; height: 21px; padding: 3px; border-radius: 6px; background: linear-gradient(135deg, #ff174f, #c600ff); }
.episode-sheet .episode-cell.is-locked > span { position: absolute; top: max(22px, calc(50% - 18px)); left: 4px; right: 4px; height: 22px; line-height: 22px; text-align: center; }
.episode-sheet .episode-cell.is-locked .lock-label { bottom: 0; line-height: 12px; }

.overlay:has(.membership-dialog) { align-items: flex-end; padding: 0; background: rgb(0 0 0 / 20%); backdrop-filter: none; }
.membership-dialog { width: 100%; max-width: 520px; max-height: 92dvh; border: 0; border-radius: 16px 16px 0 0; background: rgb(24 14 16 / 98%); }
.membership-dialog .dialog-header { min-height: 50px; padding: 4px 10px 0 16px; }
.membership-dialog .dialog-header h2 { font-size: 15px; line-height: 22px; font-weight: 400; }
.membership-dialog .dialog-body { padding: 0 16px calc(15px + env(safe-area-inset-bottom)); }
.membership-dialog .dialog-body > * + * { margin-top: 12px; }
.membership-dialog .membership-lock { height: 30px; margin: 0 0 8px; }
.membership-dialog .membership-lock svg { width: 26px; height: 26px; }
.membership-dialog .membership-title { max-width: none; margin: 0; font-size: 16px; line-height: 23px; font-weight: 500; letter-spacing: 0; }
.membership-dialog .membership-intro { font-size: 12px; line-height: 18px; }
.membership-dialog .membership-card { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; min-height: 78px; padding: 12px 14px; border-radius: 11px; border: 2px solid #ff912c; background: linear-gradient(115deg, #531e11, #1b0d14 76%); }
.membership-dialog .quote-slot { font-size: 21px; line-height: 26px; font-weight: 900; }
.membership-dialog .membership-description strong { font-size: 14px; line-height: 20px; font-weight: 900; color: #ff912c; }
.membership-dialog .membership-description span { margin-top: 4px; font-size: 12px; line-height: 17px; }
.membership-dialog .purchase-disabled:disabled { min-height: 46px; padding: 10px 14px; border-radius: 3px; background: #ff3f56; color: #fff; opacity: .55; }
.membership-dialog .restore-action { min-height: 44px; padding: 8px; font-size: 12px; }
.membership-dialog .fine-print { font-size: 11px; line-height: 16px; }
.membership-dialog .dialog-body > .fine-print:last-child { margin-top: 8px; }

.account-drawer { width: 88vw; max-width: none; }
.account-menu { gap: 0; }
.account-menu .menu-item { min-height: 59px; margin: 7px 0; padding: 14px; border: 1px solid rgb(255 23 79 / 12%); border-radius: 15px; background: rgb(255 255 255 / 4.3%); }
@media (min-width: 600px) {
 .episode-sheet { max-width: 404px; }
 .episode-sheet .dialog-body { padding-inline: 32px; }
 .membership-dialog { width: 520px; }
 .account-drawer { width: 340px; max-width: 340px; }
}
@media (max-width: 360px) {
 .membership-dialog .quote-slot { font-size: 18px; line-height: 24px; }
 .membership-dialog .membership-card { padding-inline: 10px; }
}
