/* ==========================================================================
   Paid "Buy" → Paddle.js overlay: the page's own thank-you / error state (ls-cutover-plugins-and-website task 12.5).
   Built by /src/js/paddle-buy.js. Same look as the download dialog (/src/css/download-form.css, mockup variant B, CEO
   2026-11-26): white card, centered on desktop, bottom sheet at <= 640 px. Standalone file (no Tailwind build step); tokens from
   /src/css/lese-theme.css when the page loads it, with fallbacks for the Tailwind pages.
   z-index 1000: under the Paddle overlay (2147483647), so Paddle's own success screen stays on top until the buyer closes it.
   ========================================================================== */
.spb-root {
  --spb-ink: var(--ink, #1b242a);
  --spb-ink-2: var(--ink-2, #58616c);
  --spb-line: var(--line, #dde0ee);
  --spb-dark: var(--dark, #182125);
  font-family: var(--body, "Comfortaa", "Noto Sans TC", system-ui, sans-serif);
  color: var(--spb-ink);
  text-align: left;
  line-height: 1.5;
  letter-spacing: normal;
  -webkit-font-smoothing: antialiased;
}
.spb-root *, .spb-root *::before, .spb-root *::after { box-sizing: border-box; }
html[lang^="zh"] .spb-root { font-family: "Noto Sans TC", "PingFang TC", var(--body, system-ui), sans-serif; }

.spb-overlay {
  position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; padding: 24px;
  background: rgba(24, 33, 37, .46); opacity: 0; visibility: hidden; transition: opacity .2s ease, visibility 0s linear .2s;
}
.spb-overlay[data-open="true"] { opacity: 1; visibility: visible; transition: opacity .2s ease; }
.spb-dialog {
  width: 100%; max-width: 460px; max-height: calc(100vh - 48px); overflow: auto; padding: 24px;
  background: #fff; border: 1px solid var(--spb-line); border-radius: 22px; box-shadow: 0 24px 48px -34px rgba(27, 36, 42, .42);
  transform: translateY(12px); transition: transform .22s ease;
}
.spb-overlay[data-open="true"] .spb-dialog { transform: none; }
.spb-grab { display: none; }

.spb-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.spb-icon {
  flex: 0 0 auto; width: 44px; height: 44px; border-radius: 999px; display: inline-flex; align-items: center; justify-content: center;
  background: #e6f3ec; color: #1a613f;
}
.spb-dialog[data-state="error"] .spb-icon { background: #fdf1ee; color: #8a2f20; }
.spb-root .spb-title {
  margin: 0; font-family: var(--display, "MuseoModerno", "Noto Sans TC", system-ui, sans-serif) !important; font-weight: 700;
  font-size: 20px; line-height: 1.25; color: var(--spb-ink); text-wrap: balance;
}
html[lang^="zh"] .spb-root .spb-title { font-family: "Noto Sans TC", "PingFang TC", system-ui, sans-serif !important; }
.spb-root .spb-body { margin: 0; font-size: 14.5px; line-height: 1.6; color: var(--spb-ink-2); overflow-wrap: anywhere; text-wrap: pretty; }
.spb-body a { color: var(--spb-ink); font-weight: 700; text-decoration: underline; text-underline-offset: 2px; }
.spb-actions { display: flex; justify-content: flex-end; margin-top: 20px; }
.spb-ok {
  height: 44px; padding: 0 24px; border: 0; border-radius: 999px; cursor: pointer; margin: 0;
  background: var(--spb-dark); color: #fff; font-family: var(--display, "MuseoModerno", "Noto Sans TC", system-ui, sans-serif);
  font-weight: 600; font-size: 15px; transition: transform .15s ease;
}
html[lang^="zh"] .spb-ok { font-family: "Noto Sans TC", "PingFang TC", system-ui, sans-serif; font-weight: 700; }
.spb-ok:hover { transform: translateY(-1px); }
.spb-ok:focus-visible, .spb-body a:focus-visible { outline: 2px solid var(--spb-ink); outline-offset: 3px; }

/* ---------- phones: bottom sheet ---------- */
@media (max-width: 640px) {
  .spb-overlay { align-items: flex-end; padding: 0; }
  .spb-dialog {
    max-width: none; border-radius: 22px 22px 0 0; border-bottom: 0; max-height: 88vh;
    padding: 8px 16px calc(24px + env(safe-area-inset-bottom)); transform: translateY(24px);
  }
  .spb-grab { display: block; width: 40px; height: 4px; border-radius: 999px; background: #d5d9e6; margin: 0 auto 12px; }
  .spb-actions { justify-content: stretch; }
  .spb-ok { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .spb-overlay, .spb-dialog { transition: none !important; }
}
