/* Bead Plus: the paywall, "You're in.", Settings › Bead Plus and Your answers, the Terms of Use drawer.
   Price hierarchy (Apple 3.1.2(c), Google Play's subscriptions policy, plan 2.11; checked by tests/unit/paywall.test.js):
   .pw-price, the billed amount, is the most prominent price — 32px bold ink. The per-week line under it (.pw-week) is
   17px semibold in the accent, no fill behind it (v3 §3.3): clearly second, smaller and lighter than the
   billed amount. The saving (.pw-tag) is a 13px outlined badge beside the plan name, never filled;
   nothing priced is as large or as bold as the billed amount. */

/* ---------- the paywall ---------- */
.paywall .pw-page { padding-top: calc(var(--safe-top) + 10px); gap: 18px; }
/* The close button stays in reach while the page scrolls; the brand row sits beside it. */
.pw-close { position: sticky; top: calc(var(--safe-top) + 8px); z-index: 4; align-self: flex-end; margin: 0 -10px -62px 0; color: var(--ink); background: var(--paper); box-shadow: 0 0 0 1px var(--line); }
.pw-close:active { background: var(--paper-3); }
/* while a purchase or restore is pending the ✕ waits (aria-disabled), and looks it: a dimmed cross on the same
   opaque backing (the page scrolls under it) */
.pw-close[aria-disabled='true'] { color: var(--ink-3); }
.pw-close[aria-disabled='true']:active { background: var(--paper); }
.pw-brand { display: flex; align-items: center; gap: 10px; min-height: 44px; padding-right: 52px; }
.pw-brand .k-seal { flex: none; }
.pw-brand-name { font-size: 24px; line-height: 1; }
.pw-intro { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.pw-title { font-size: 34px; line-height: 1.05; text-wrap: balance; }
.pw-sub { color: var(--ink-2); }

.pw-features { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 9px; }
.pw-features li { position: relative; padding-left: 20px; font-size: 15px; line-height: 1.45; color: var(--ink); }
.pw-features li::before { content: ''; position: absolute; left: 3px; top: 0.6em; width: 6px; height: 6px; border-radius: 50%; background: var(--ink); }

/* the wall of 18 comes last, under the links (the plans, Continue and the small print come first) */
.pw-wall { display: flex; flex-direction: column; gap: 10px; margin-top: 4px; padding-top: 16px; border-top: 1px solid var(--line); }
.pw-wall-cap { margin: 0; font-size: 13px; line-height: 1.4; color: var(--ink-2); }
.pw-tiles { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 7px; }
.pw-tile { aspect-ratio: 1; min-width: 0; display: flex; }
/* the preview is its own dark stage tile; here it fills the grid cell */
.pw-tile > .ex-preview { width: 100% !important; height: 100% !important; }
.pw-more { align-self: flex-start; min-height: 44px; margin: -6px 0 -10px -2px; padding: 0 2px; border: none; background: transparent; font-size: 13px; color: var(--ink-2); text-decoration: underline; text-decoration-color: var(--ink-3); text-underline-offset: 3px; }

/* the free-trial slot (paywall.js TRIAL_LINE): empty, so not drawn, until the owner decides on a trial */
.pw-slot { margin: -4px 0 0; padding: 10px 14px; border-radius: 14px; border: 1px solid var(--line); font-size: 14px; line-height: 1.5; color: var(--ink); }

.pw-plans { display: flex; flex-direction: column; gap: 10px; }
.pw-plan { width: 100%; display: flex; flex-direction: column; align-items: stretch; gap: 3px; padding: 14px 16px 15px; border-radius: 16px; border: 1px solid var(--line); background: var(--paper-2); text-align: left; color: var(--ink); }
.pw-plan.on { border-color: var(--ink); box-shadow: inset 0 0 0 0.5px var(--ink); }
.pw-plan:active { transform: scale(0.99); }
.pw-plan-head { display: flex; align-items: center; gap: 10px; min-height: 22px; }
.pw-plan-label { font-size: 15px; font-weight: 500; }
.pw-radio { width: 18px; height: 18px; border-radius: 50%; border: 1.2px solid var(--slot); flex: none; position: relative; }
.pw-plan.on .pw-radio { border-color: var(--ink); }
.pw-plan.on .pw-radio::after { content: ''; position: absolute; inset: 3.5px; border-radius: 50%; background: var(--ink); }
/* the saving: a small outlined badge in the seal's red, like a stamp; never a filled pill */
.pw-tag { margin-left: 2px; padding: 2px 9px 3px; border: 1px solid currentColor; border-radius: 999px; font-size: 13px; font-weight: 600; line-height: 1.3; letter-spacing: 0.2px; color: var(--accent); white-space: nowrap; }
.pw-price { display: block; margin: 6px 0 0 28px; font-size: 32px; font-weight: 700; line-height: 1.1; letter-spacing: -0.4px; color: var(--ink); }
/* what the billed amount comes to a week: on a soft accent pill so it reads at a glance, and still clearly second */
.pw-week { align-self: flex-start; margin: 4px 0 2px 28px; padding: 0; font-size: 17px; font-weight: 600; line-height: 1.3; color: var(--accent); background: none; }
/* no price yet: a neutral bar where the amount goes, the card's height kept (no number, nothing to misread) */
.pw-price-wait { height: 35px; display: flex; align-items: center; }
.pw-price-wait i { display: block; width: 132px; height: 20px; border-radius: 10px; background: var(--paper-3); }
.pw-week-wait { display: block; width: 96px; height: 22px; margin: 4px 0 2px 28px; border-radius: 11px; background: var(--paper-3); opacity: 0.6; }
.pw-price-wait.is-loading i { animation: pw-wait 1.4s ease-in-out infinite; }
@keyframes pw-wait { 50% { opacity: 0.45; } }
@media (prefers-reduced-motion: reduce) { .pw-price-wait.is-loading i { animation: none; } }

/* a short phone (iPhone SE, 667px tall): the top tightens a little so the first plan card shows above the bar */
@media (max-height: 700px) {
  .paywall .pw-page { gap: 14px; }
  .pw-title { font-size: 30px; }
  .pw-features { gap: 6px; }
  .pw-features li { font-size: 14.5px; line-height: 1.4; }
}

/* The bar (A1): what Continue bills, Continue, test mode. Fixed to the bottom of the screen, above the home indicator
   (safe-area inset), in the app's 480px column, so Continue and its billed line are on the first screen of every phone
   (iPhone SE 375 × 667 included); the page scrolls under it and keeps room for it below its last line (--pw-bar: the
   bar's measured height, set by paywall.js; a fallback until then). Its words stay smaller than the cards' billed
   amount, which remains the most prominent price. */
.paywall .pw-page { padding-bottom: calc(var(--pw-bar, 176px) + 20px); }
.pw-act { position: fixed; left: 50%; bottom: 0; z-index: 5; transform: translateX(-50%); width: 100%; max-width: 480px; display: flex; flex-direction: column; gap: 8px; margin: 0; padding: 12px max(24px, env(safe-area-inset-left, 0px)) calc(var(--safe-bottom) + 12px) max(24px, env(safe-area-inset-right, 0px)); background-color: var(--paper); background-image: var(--grain); box-shadow: 0 -1px 0 var(--line), 0 -14px 24px -18px rgba(28, 27, 26, 0.35); }
/* what Continue charges, for the plan picked: plain words right above the button */
.pw-billed { margin: 0; text-align: center; font-size: 13.5px; line-height: 1.45; color: var(--ink); }
.pw-cta[disabled] { opacity: 0.55; }
.pw-test { margin: -2px 0 0; text-align: center; font-size: 12px; line-height: 1.4; color: var(--ink-2); }
.pw-msg { margin: 0; text-align: center; font-size: 13px; line-height: 1.45; color: var(--ink); }
/* no prices yet on a store build (A2): what is happening in place of the billed line, a Retry when it failed */
.pw-wait-line { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 0 6px; min-height: 39px; color: var(--ink-2); }
.pw-wait-line.is-unavailable { color: var(--ink); }
.pw-retry { min-height: 39px; padding: 0 6px; border: none; background: transparent; font-size: 13.5px; font-weight: 600; color: var(--ink); text-decoration: underline; text-decoration-color: var(--ink-3); text-underline-offset: 3px; }
.pw-retry:active { color: var(--ink-2); }

/* the small print: ≥ 11px, ≥ 4.5:1 on the paper, under the plans and the bar */
.pw-terms { display: flex; flex-direction: column; gap: 6px; margin-top: -4px; }
.pw-terms p { margin: 0; font-size: 12px; line-height: 1.5; color: var(--ink-2); }
.pw-inline-link { display: inline; border: none; background: transparent; padding: 0; font-size: inherit; line-height: inherit; color: var(--ink); text-decoration: underline; text-decoration-color: var(--ink-3); text-underline-offset: 2px; }
.pw-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 0 2px; margin: -4px -8px 0; }
.pw-link { min-height: 44px; padding: 0 8px; border: none; background: transparent; font-size: 13px; color: var(--ink-2); text-decoration: underline; text-decoration-color: var(--ink-3); text-underline-offset: 3px; }
.pw-link:active, .pw-more:active { color: var(--ink); }

/* ---------- "What held you back?" (after ✕, once): a drawer over the page, four answers and Skip ---------- */
.pw-held { gap: 0; padding-top: 10px; animation: pw-held-in 0.28s cubic-bezier(.2,.8,.2,1); }
.pw-held:focus { outline: none; }
.pw-held-scrim { animation: pw-held-fade 0.2s ease-out; }
.pw-held-t { margin: 14px 0 0; font-weight: 400; font-size: 28px; line-height: 1.1; }
.pw-held-sub { margin: 6px 0 0; font-size: 14px; line-height: 1.45; color: var(--ink-2); }
.pw-held-opts { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; }
.pw-held-opt { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; min-height: 52px; padding: 0 14px 0 16px; border-radius: 14px; border: 1px solid var(--line); background: var(--paper); text-align: left; font-size: 16px; line-height: 1.3; color: var(--ink); }
.pw-held-opt:active { transform: scale(0.99); background: var(--paper-3); }
.pw-held-opt:focus-visible, .pw-held-skip:focus-visible { outline: 1.5px solid var(--ink); outline-offset: 2px; }
.pw-held-dot { width: 20px; height: 20px; border-radius: 50%; border: 1.2px solid var(--slot); flex: none; }
.pw-held-skip { align-self: center; min-height: 44px; margin-top: 8px; padding: 0 14px; border: none; background: transparent; font-size: 15px; color: var(--ink-2); text-decoration: underline; text-decoration-color: var(--ink-3); text-underline-offset: 3px; }
@keyframes pw-held-in { from { transform: translate(-50%, 24px); opacity: 0; } to { transform: translate(-50%, 0); opacity: 1; } }
@keyframes pw-held-fade { from { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .pw-held, .pw-held-scrim { animation: none; } }

/* ---------- the locked Home: what Restore purchases found ---------- */
.home-restore-msg { margin: 12px auto 0; max-width: 290px; font-size: 13.5px; line-height: 1.45; color: var(--ink); text-align: center; }
.home-restore-msg:empty { display: none; }

/* ---------- You're in. ---------- */
.cf-page { padding-top: calc(var(--safe-top) + 72px); padding-bottom: 0; gap: 14px; }
.cf-mark { display: flex; margin-bottom: 6px; }
.cf-title { font-size: 44px; line-height: 1.05; }
.cf-head { margin: 4px 0 0; font-size: 17px; font-weight: 600; }
.cf-lines { display: flex; flex-direction: column; gap: 6px; }
.cf-lines p { margin: 0; font-size: 15px; line-height: 1.5; }
.cf-cancel { margin: 4px 0 0; font-size: 14px; line-height: 1.55; color: var(--ink-2); }
.confirm .pw-test { text-align: left; }
.cf-next { margin: 0 0 -6px; font-size: 14px; line-height: 1.45; color: var(--ink-2); }
.cf-act { position: sticky; bottom: 0; z-index: 2; margin: 0 -24px; padding: 14px 24px calc(var(--safe-bottom) + 24px); background: linear-gradient(to bottom, transparent, var(--paper) 14px); }

/* ---------- Settings › Bead Plus ---------- */
.sp-status .set-label > span:first-child { font-weight: 500; }
.sp-status .set-sub { line-height: 1.45; }
.settings .set-action[disabled] { opacity: 0.55; }

/* ---------- Settings › Your answers ---------- */
.sa-head .set-sub { color: var(--ink); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.sa-head .set-label { min-width: 0; }
.sa-edit { display: flex; flex-direction: column; gap: 4px; padding: 4px 0 14px; border-bottom: 1px solid var(--line); }
.sa-q { margin-top: 14px; }
.sa-list { display: flex; flex-direction: column; }
.sa-opt { display: flex; justify-content: space-between; align-items: center; gap: 14px; min-height: 48px; padding: 9px 2px; border: none; border-bottom: 1px solid var(--line); background: transparent; text-align: left; font-size: 15px; line-height: 1.4; color: var(--ink); }
.sa-opt:last-child { border-bottom: none; }
.sa-opt:active { background: var(--paper-3); }
.sa-opt.sa-none { margin-top: 8px; border-top: 1px solid var(--line); }
.sa-box { width: 22px; height: 22px; border-radius: 6px; border: 1.2px solid var(--slot); flex: none; display: inline-flex; align-items: center; justify-content: center; color: var(--paper); }
.sa-opt.on .sa-box { background: var(--ink); border-color: var(--ink); }
.sa-box svg { display: block; }
.sa-dot { width: 20px; height: 20px; border-radius: 50%; border: 1.2px solid var(--slot); flex: none; position: relative; }
.sa-opt.on .sa-dot { border-color: var(--ink); }
.sa-opt.on .sa-dot::after { content: ''; position: absolute; inset: 4px; border-radius: 50%; background: var(--ink); }
.sa-freqs { display: flex; flex-direction: column; }
.sa-freq { display: flex; flex-direction: column; gap: 8px; padding: 10px 0 12px; border-bottom: 1px solid var(--line); }
.sa-freq:last-child { border-bottom: none; }
.sa-freq-label { font-size: 15px; line-height: 1.4; }
.sa-seg { display: flex; }
.sa-seg button { flex: 1; height: 34px; padding: 0 6px; position: relative; }
.sa-seg button::after { content: ''; position: absolute; left: 0; right: 0; top: -5px; bottom: -5px; }
.sa-ages { padding-top: 2px; }
.sa-ages .chip { min-width: 0; padding: 0 14px; }
.sa-ages .chip[aria-checked='true'] { border-color: var(--ink); background: var(--paper-2); }
.sa-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 14px; }
.sa-clear { margin-left: -10px; }
.sa-clear[disabled] { opacity: 0.4; }
.sa-done { height: 44px; font-size: 15px; padding: 0 22px; }

/* ---------- the Terms of Use drawer ---------- */
.tm-drawer { max-height: 88dvh; gap: 0; padding-top: 0; }
.tm-head { position: sticky; top: 0; z-index: 1; display: flex; flex-direction: column; gap: 10px; padding: 12px 0 10px; background: var(--paper-2); border-bottom: 1px solid var(--line); }
.tm-head .grip { align-self: center; }
.tm-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.tm-title { margin: 0; font-family: var(--serif); font-weight: 400; font-size: 26px; line-height: 1.1; }
.tm-done { min-height: 44px; padding: 0 4px 0 12px; border: none; background: transparent; font-size: 15px; color: var(--ink); }
.tm-body { padding: 8px 0 4px; font-size: 14px; line-height: 1.55; color: var(--ink); }
.tm-body:focus { outline: none; }
.tm-body .date { color: var(--ink-2); font-size: 13px; margin: 6px 0 12px; }
.tm-body section { border-top: 1px solid var(--line); padding-top: 14px; margin-top: 14px; }
.tm-body h2 { font-size: 15px; font-weight: 600; margin: 0 0 6px; }
.tm-body p, .tm-body li { margin: 0 0 8px; }
.tm-body ul { margin: 0 0 8px; padding-left: 20px; }
.tm-body a { color: inherit; text-underline-offset: 3px; }
.tm-body .ph { background: var(--halo-tint); border-radius: 3px; padding: 0 3px; }
.tm-body .note { color: var(--ink-2); font-size: 13px; }
