:root {
  --bg: #0d0a08;
  --paper: #efe6d8;
  --ink: #2b2118;
  --ember: #f97316;
  --ember-soft: #fbbf24;
  --muted: #b8a68f;
  --accent-rgb: 249, 115, 22;
  --accent-soft-rgb: 251, 191, 36;
  --accent-soft: #fbbf24;
}

body[data-ritual="shred"] {
  --accent-rgb: 186, 148, 104;
  --accent-soft-rgb: 226, 214, 192;
  --accent-soft: #e2d6c0;
}

body[data-ritual="sink"] {
  --accent-rgb: 40, 132, 186;
  --accent-soft-rgb: 158, 216, 244;
  --accent-soft: #9ed8f4;
}

body[data-ritual="fly"] {
  --accent-rgb: 126, 122, 240;
  --accent-soft-rgb: 206, 198, 255;
  --accent-soft: #cec6ff;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: #f5efe6;
  font-family: "Georgia", "Times New Roman", serif;
}

body {
  background: linear-gradient(180deg, #0a0806, #120d09 55%, #0a0806);
  background-attachment: fixed;
}

body.ash-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 88px 1.25rem 80px;
  overflow-x: hidden;
}

#ambient {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

#burn {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 5;
  pointer-events: none;
  display: none;
}

.stage {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: min(560px, 100%);
  text-align: center;
}

.stage[hidden] { display: none; }

.brand {
  margin: 0;
  font-size: clamp(1.8rem, 5vw, 2.6rem);
  font-weight: 600;
  letter-spacing: 0.02em;
}

.tagline {
  margin: 0.5rem 0 1.75rem;
  color: var(--muted);
  font-style: italic;
  font-size: 1.05rem;
}

.paper-wrap {
  position: relative;
  width: 100%;
}

#note {
  width: 100%;
  min-height: 46vh;
  resize: vertical;
  padding: 1.5rem 1.6rem 3rem;
  background: var(--paper);
  color: var(--ink);
  border: none;
  border-radius: 4px;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.55), inset 0 0 0 1px rgba(0, 0, 0, 0.06);
  font-family: "Georgia", "Times New Roman", serif;
  font-size: 1.15rem;
  line-height: 1.9;
  outline: none;
}

#note::placeholder { color: #a8977f; font-style: italic; }

.paper-grain {
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: 4px;
  background:
    radial-gradient(120% 80% at 50% 0%, rgba(255, 250, 240, 0.5), transparent 60%),
    repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.015) 0 1px, transparent 1px 3px);
  mix-blend-mode: multiply;
}

.burn-btn, .again-btn {
  margin-top: 1.6rem;
  padding: 0.85rem 2.6rem;
  border: 1px solid rgba(var(--accent-rgb), 0.55);
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(var(--accent-rgb), 0.28), rgba(var(--accent-rgb), 0.08));
  color: #fff;
  font-family: inherit;
  font-size: 1.1rem;
  letter-spacing: 0.04em;
  cursor: pointer;
  box-shadow: 0 0 22px rgba(var(--accent-rgb), 0.35);
  transition: box-shadow 0.3s, border-color 0.3s, transform 0.15s;
}

.burn-btn:hover, .again-btn:hover {
  border-color: rgba(var(--accent-soft-rgb), 0.9);
  box-shadow: 0 0 34px rgba(var(--accent-rgb), 0.65);
  transform: translateY(-1px);
}

.burn-btn:disabled { opacity: 0.4; cursor: default; transform: none; box-shadow: 0 0 10px rgba(var(--accent-rgb), 0.15); }

.privacy-note {
  margin: 1rem 0 0;
  color: var(--muted);
  font-size: 0.82rem;
  letter-spacing: 0.02em;
}

.done-line {
  margin: 0;
  font-size: clamp(2rem, 6vw, 3rem);
  font-weight: 600;
}

.done-sub {
  margin: 0.75rem 0 2rem;
  color: var(--muted);
  font-style: italic;
  font-size: 1.1rem;
}

/* ---- keepsake card button ---- */
.keepsake-btn {
  margin-top: 0.5rem;
  padding: 0.6rem 1.4rem;
  border: 1px solid rgba(184, 166, 143, 0.4);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  color: #e8d9bd;
  font-family: inherit;
  font-size: 0.95rem;
  letter-spacing: 0.03em;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, box-shadow 0.15s;
}

.keepsake-btn:hover {
  border-color: rgba(var(--accent-soft-rgb), 0.8);
  color: #fff;
  box-shadow: 0 0 16px rgba(var(--accent-rgb), 0.4);
}

.keepsake-btn[hidden] { display: none; }

/* ---- partner ad bar ---- */
.partner-ad {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 14px;
  max-width: min(100%, 640px);
  padding: 14px 14px 12px 8px;
  background: linear-gradient(to bottom, rgba(5, 7, 15, 0.55), rgba(5, 7, 15, 0));
  pointer-events: none;
}

.partner-ad a {
  pointer-events: auto;
  color: #ffe4c4;
  font-size: 13px;
  font-weight: 600;
  font-family: system-ui, -apple-system, sans-serif;
  text-decoration: none;
  letter-spacing: 0.3px;
  padding: 5px 14px;
  border: 1px solid rgba(249, 115, 22, 0.4);
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(249, 115, 22, 0.22), rgba(249, 115, 22, 0.06));
  box-shadow: 0 0 18px rgba(249, 115, 22, 0.4);
  transition: color 0.15s, border-color 0.15s, box-shadow 0.15s;
  white-space: nowrap;
}

.partner-ad a:hover {
  color: #fff;
  border-color: rgba(251, 191, 36, 0.9);
  box-shadow: 0 0 28px rgba(249, 115, 22, 0.7);
}

@media (max-width: 640px) {
  .partner-ad { gap: 6px 10px; padding: 10px 10px 8px 6px; }
  .partner-ad a { font-size: 12px; padding: 4px 10px; }
  body.ash-page { padding-top: 124px; }
}

.foot {
  position: fixed;
  left: 0;
  bottom: 0;
  z-index: 20;
  padding: 0 0 0.9rem clamp(1.2rem, 4vw, 3rem);
  font-size: 0.76rem;
  color: var(--muted);
  pointer-events: none;
}

.foot p { margin: 0 0 0.25rem; }

.foot a {
  position: relative;
  z-index: 1;
  pointer-events: auto;
  display: inline-block;
  padding: 2px 1px;
  color: var(--accent-soft);
  text-decoration: underline;
  text-decoration-color: rgba(var(--accent-soft-rgb), 0.45);
  text-underline-offset: 3px;
  transition: color 0.2s, text-decoration-color 0.2s, text-shadow 0.2s;
}

.foot a:hover,
.foot a:focus-visible {
  color: #fff;
  text-decoration-color: rgba(var(--accent-soft-rgb), 0.95);
  text-shadow: 0 0 10px rgba(var(--accent-soft-rgb), 0.55);
  outline: none;
}

/* ---- ritual selector ---- */
.rituals {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 1.25rem;
}

.ritual {
  padding: 0.5rem 1rem;
  border: 1px solid rgba(var(--accent-rgb), 0.35);
  border-radius: 999px;
  background: rgba(var(--accent-rgb), 0.08);
  color: #f5efe6;
  font-family: inherit;
  font-size: 0.9rem;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: border-color 0.3s, background 0.3s, box-shadow 0.3s, color 0.3s;
}

.ritual:hover {
  border-color: rgba(var(--accent-soft-rgb), 0.8);
  box-shadow: 0 0 14px rgba(var(--accent-rgb), 0.4);
}

.ritual.is-active {
  border-color: rgba(var(--accent-soft-rgb), 0.9);
  background: linear-gradient(135deg, rgba(var(--accent-rgb), 0.35), rgba(var(--accent-rgb), 0.12));
  box-shadow: 0 0 18px rgba(var(--accent-rgb), 0.55);
}

.ritual.locked { opacity: 0.55; }

.pro-badge { margin-right: 0.3em; font-size: 0.8em; }

/* ---- upgrade button ---- */
.upgrade-btn {
  margin-top: 0.75rem;
  padding: 0.45rem 1.1rem;
  border: 1px dashed rgba(var(--accent-soft-rgb), 0.5);
  border-radius: 999px;
  background: transparent;
  color: var(--accent-soft);
  font-family: inherit;
  font-size: 0.82rem;
  cursor: pointer;
  transition: border-color 0.3s, color 0.3s, box-shadow 0.3s;
}

.upgrade-btn:hover {
  border-color: rgba(var(--accent-soft-rgb), 0.9);
  color: #fff;
  box-shadow: 0 0 14px rgba(var(--accent-soft-rgb), 0.35);
}

.upgrade-btn[hidden] { display: none; }

/* ---- pro toast ---- */
.pro-toast {
  position: fixed;
  left: 50%;
  bottom: 84px;
  transform: translateX(-50%);
  z-index: 30;
  max-width: min(90vw, 420px);
  padding: 0.7rem 1.1rem;
  border-radius: 10px;
  background: rgba(20, 16, 12, 0.92);
  border: 1px solid rgba(251, 191, 36, 0.45);
  color: #ffe4c4;
  font-family: system-ui, -apple-system, sans-serif;
  font-size: 0.85rem;
  text-align: center;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
}

.pro-toast[hidden] { display: none; }

/* ---- local checkout preview (pro.js, dev hosts only) ---- */
.demo-checkout {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(4, 3, 2, 0.78);
  backdrop-filter: blur(4px);
}

.demo-card {
  width: min(380px, 100%);
  padding: 22px 22px 18px;
  border: 1px solid rgba(249, 115, 22, 0.35);
  border-radius: 16px;
  background: linear-gradient(180deg, #1a1410, #100c09);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.65);
  font-family: system-ui, -apple-system, sans-serif;
  text-align: left;
}

.demo-badge {
  margin: 0 0 12px;
  color: #fbbf24;
  font-size: 10px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.demo-title {
  margin: 0;
  color: #f5efe6;
  font-family: "Georgia", "Times New Roman", serif;
  font-size: 1.5rem;
  font-weight: 600;
}

.demo-sub {
  margin: 6px 0 18px;
  color: var(--muted);
  font-size: 0.8rem;
}

.demo-line,
.demo-total {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #d8c9b6;
  font-size: 0.85rem;
}

.demo-line {
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(249, 115, 22, 0.18);
}

.demo-total {
  margin-top: 12px;
  color: #fff;
  font-size: 0.95rem;
  font-weight: 600;
}

.demo-line strong,
.demo-total strong { color: #ffe4c4; }

.demo-form { margin-top: 16px; }

.demo-input {
  width: 100%;
  margin-bottom: 10px;
  padding: 10px 12px;
  border: 1px solid rgba(249, 115, 22, 0.3);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.05);
  color: #f5efe6;
  font-family: inherit;
  font-size: 0.85rem;
}

.demo-input::placeholder { color: #8f8073; }

.demo-input:focus {
  outline: none;
  border-color: rgba(251, 191, 36, 0.85);
  box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.16);
}

.demo-row { display: flex; gap: 10px; }
.demo-row .demo-input { margin-bottom: 0; }

.demo-actions {
  display: flex;
  gap: 10px;
  margin-top: 18px;
}

.demo-pay,
.demo-cancel {
  flex: 1;
  padding: 10px 14px;
  border-radius: 9px;
  font-family: inherit;
  font-size: 0.85rem;
  cursor: pointer;
}

.demo-pay {
  border: 1px solid rgba(251, 191, 36, 0.75);
  background: linear-gradient(135deg, rgba(249, 115, 22, 0.9), rgba(249, 115, 22, 0.55));
  color: #fff;
  font-weight: 600;
}

.demo-pay:disabled { opacity: 0.65; cursor: default; }

.demo-cancel {
  border: 1px solid rgba(249, 115, 22, 0.28);
  background: transparent;
  color: #d8c9b6;
}

.demo-cancel:hover { color: #fff; border-color: rgba(251, 191, 36, 0.7); }

@media (prefers-reduced-motion: reduce) {
  .burn-btn, .again-btn, .keepsake-btn { transition: none; }
  .ritual, .upgrade-btn { transition: none; box-shadow: none; }
  .partner-ad a { transition: none; box-shadow: none; }
}