:root {
  --ink-0: #0b0805;
  --ink-1: #14100a;
  --ink-2: #1d1710;
  --gold: #d4af37;
  --gold-bright: #f3d47a;
  --gold-dim: #8a6d23;
  --parchment: #ece0c6;
  --parchment-deep: #ddcda8;
  --scripture-ink: #2b2115;
  --crimson: #8c2230;
  --muted: #a89468;
  --serif-body: "EB Garamond", Georgia, serif;
  --serif-caps: "Cinzel", serif;
  --blackletter: "UnifrakturMaguntia", serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

[hidden] { display: none !important; }

html { scroll-behavior: smooth; }

body {
  min-height: 100vh;
  font-family: var(--serif-body);
  color: #e8dcc0;
  background:
    radial-gradient(120% 90% at 50% -10%, #241b0e 0%, transparent 55%),
    radial-gradient(80% 60% at 50% 110%, #191207 0%, transparent 60%),
    linear-gradient(180deg, var(--ink-0) 0%, var(--ink-1) 50%, var(--ink-0) 100%);
  overflow-x: hidden;
}

.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* ---------- atmosphere ---------- */

.rose-window {
  position: fixed;
  top: max(-340px, calc(50vh - 900px));
  left: 50%;
  translate: -50% 0;
  width: 920px;
  height: 920px;
  border-radius: 50%;
  pointer-events: none;
  opacity: .5;
  background:
    repeating-conic-gradient(from 0deg,
      rgba(212,175,55,.16) 0deg 4deg,
      rgba(140,34,48,.14) 4deg 10deg,
      rgba(63,81,138,.13) 10deg 18deg,
      rgba(212,175,55,.05) 18deg 30deg);
  -webkit-mask-image: radial-gradient(circle at center, black 0%, rgba(0,0,0,.55) 42%, transparent 66%);
          mask-image: radial-gradient(circle at center, black 0%, rgba(0,0,0,.55) 42%, transparent 66%);
  filter: saturate(.85) blur(1px);
  animation: rosary 160s linear infinite;
}

@keyframes rosary { to { rotate: 360deg; } }

.vignette {
  position: fixed; inset: 0; pointer-events: none; z-index: 2;
  box-shadow: inset 0 0 22vmax rgba(0,0,0,.78);
}

.site {
  position: relative; z-index: 3;
  max-width: 720px;
  margin: 0 auto;
  padding: clamp(28px, 6vh, 64px) 20px 60px;
}

/* ---------- masthead ---------- */

.masthead { text-align: center; }

.cross-mark {
  font-size: 30px;
  color: var(--gold);
  text-shadow: 0 0 18px rgba(212,175,55,.65), 0 0 46px rgba(212,175,55,.28);
  animation: kindle 4.5s ease-in-out infinite;
}

@keyframes kindle {
  0%, 100% { text-shadow: 0 0 18px rgba(212,175,55,.65), 0 0 46px rgba(212,175,55,.28); }
  50%      { text-shadow: 0 0 26px rgba(243,212,122,.85), 0 0 70px rgba(212,175,55,.4); }
}

.brand {
  font-family: var(--blackletter);
  font-weight: 400;
  font-size: clamp(52px, 9vw, 84px);
  line-height: 1.05;
  letter-spacing: .01em;
  margin-top: 6px;
  background: linear-gradient(100deg,
    #7c6320 0%, var(--gold) 22%, #fff3cf 38%, var(--gold-bright) 50%,
    #fff3cf 62%, var(--gold) 78%, #7c6320 100%);
  background-size: 220% auto;
  -webkit-background-clip: text;
          background-clip: text;
  color: transparent;
  filter: drop-shadow(0 3px 12px rgba(0,0,0,.6));
  animation: gilding 7s ease-in-out infinite;
}

@keyframes gilding { 0%,100% { background-position: 0% center; } 50% { background-position: 100% center; } }

.flourish {
  display: block;
  width: min(300px, 70%);
  margin: 10px auto 12px;
  color: var(--gold-dim);
}
.flourish.dark { color: #9a7c33; }

.tagline {
  font-style: italic;
  color: var(--muted);
  font-size: 17.5px;
  letter-spacing: .02em;
}

/* ---------- confessional / form ---------- */

.confessional {
  margin-top: 44px;
  padding: 26px 26px 24px;
  border-radius: 14px;
  border: 1px solid rgba(212,175,55,.35);
  background:
    linear-gradient(180deg, rgba(29,23,16,.92), rgba(17,13,8,.94));
  box-shadow:
    0 24px 60px -24px rgba(0,0,0,.85),
    inset 0 1px 0 rgba(212,175,55,.14);
}

textarea {
  width: 100%;
  resize: vertical;
  min-height: 108px;
  padding: 16px 18px;
  border-radius: 10px;
  border: 1px solid rgba(212,175,55,.28);
  background:
    linear-gradient(180deg, rgba(236,224,198,.06), rgba(236,224,198,.02)),
    #0e0b07;
  color: #efe6cd;
  font-family: var(--serif-body);
  font-size: 19px;
  line-height: 1.5;
  transition: border-color .25s ease, box-shadow .25s ease;
}

textarea::placeholder { color: #77683f; font-style: italic; }

textarea:focus {
  outline: none;
  border-color: rgba(212,175,55,.75);
  box-shadow: 0 0 0 3px rgba(212,175,55,.13), 0 0 34px -6px rgba(212,175,55,.35);
}

.chips {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin-top: 14px;
}

.chip {
  cursor: pointer;
  font-family: var(--serif-body);
  font-size: 14px;
  color: #cdbd93;
  background: rgba(212,175,55,.07);
  border: 1px solid rgba(212,175,55,.25);
  border-radius: 999px;
  padding: 6px 13px;
  transition: all .2s ease;
}

.chip:hover {
  color: #f3e8c8;
  border-color: rgba(212,175,55,.6);
  background: rgba(212,175,55,.14);
  transform: translateY(-1px);
}

.actions {
  display: flex; align-items: center; gap: 18px;
  margin-top: 18px; flex-wrap: wrap;
}

.thump-btn {
  position: relative;
  cursor: pointer;
  border: none;
  border-radius: 10px;
  padding: 15px 40px;
  font-family: var(--serif-caps);
  font-weight: 700;
  font-size: 18px;
  letter-spacing: .14em;
  color: #241a05;
  background: linear-gradient(180deg, #f0d67c 0%, var(--gold) 45%, #a37f22 100%);
  box-shadow:
    0 10px 28px -8px rgba(212,175,55,.55),
    inset 0 1px 0 rgba(255,255,255,.55),
    inset 0 -2px 0 rgba(90,64,10,.55);
  overflow: hidden;
  transition: transform .15s ease, box-shadow .25s ease, filter .25s ease;
}

.thump-btn:hover {
  transform: translateY(-2px);
  filter: brightness(1.07);
  box-shadow:
    0 16px 36px -10px rgba(212,175,55,.7),
    inset 0 1px 0 rgba(255,255,255,.6),
    inset 0 -2px 0 rgba(90,64,10,.55);
}

.thump-btn:active { transform: translateY(0); }

.thump-btn:disabled { cursor: wait; filter: grayscale(.35) brightness(.8); transform: none; }

.btn-cross { font-size: 15px; vertical-align: 1px; margin-left: 2px; }

.btn-shine {
  position: absolute; inset: 0;
  background: linear-gradient(115deg, transparent 32%, rgba(255,255,255,.55) 50%, transparent 68%);
  translate: -120% 0;
  transition: none;
}

.thump-btn:hover .btn-shine {
  transition: translate .8s ease;
  translate: 120% 0;
}

.hint {
  font-size: 13.5px;
  color: #6f6140;
  font-style: italic;
}

/* ---------- loading ---------- */

.status {
  margin-top: 46px;
  text-align: center;
}

.halo {
  position: relative;
  width: 74px; height: 74px;
  margin: 0 auto 16px;
  display: grid; place-items: center;
}

.halo::before {
  content: "";
  position: absolute; inset: 0;
  border-radius: 50%;
  border: 1.5px dashed rgba(212,175,55,.65);
  animation: spin 3.2s linear infinite;
}

.halo::after {
  content: "";
  position: absolute; inset: -12px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(212,175,55,.22) 0%, transparent 70%);
  animation: breathe 2.4s ease-in-out infinite;
}

.status-cross {
  font-size: 30px;
  color: var(--gold-bright);
  text-shadow: 0 0 22px rgba(212,175,55,.8);
  animation: throb 1.6s ease-in-out infinite;
}

@keyframes spin { to { rotate: 360deg; } }
@keyframes throb { 0%,100% { scale: 1; } 50% { scale: 1.18; } }
@keyframes breathe { 0%,100% { opacity: .5; } 50% { opacity: 1; } }

.status-line {
  font-style: italic;
  color: var(--muted);
  font-size: 16.5px;
  letter-spacing: .03em;
}

/* ---------- error ---------- */

.error-banner {
  margin-top: 40px;
  padding: 16px 20px;
  border: 1px solid rgba(140,34,48,.65);
  border-left: 4px solid var(--crimson);
  border-radius: 10px;
  background: rgba(140,34,48,.1);
  color: #e8b9ae;
  font-size: 16px;
}

/* ---------- result parchment ---------- */

.result { margin-top: 46px; }

.parchment {
  position: relative;
  border-radius: 6px;
  padding: 40px 44px 34px;
  color: var(--scripture-ink);
  background:
    radial-gradient(130% 100% at 50% 0%, rgba(120,90,40,.16) 0%, transparent 42%),
    radial-gradient(120% 110% at 50% 100%, rgba(96,70,30,.2) 0%, transparent 40%),
    linear-gradient(178deg, #f1e6cb 0%, var(--parchment) 30%, #e6d7b4 78%, var(--parchment-deep) 100%);
  box-shadow:
    0 30px 70px -28px rgba(0,0,0,.95),
    inset 0 0 60px rgba(112,82,38,.22),
    inset 0 0 4px rgba(112,82,38,.35);
  animation: unfurl .8s cubic-bezier(.2,.9,.3,1) both;
}

@keyframes unfurl {
  from { opacity: 0; transform: translateY(22px) scale(.985); }
  to   { opacity: 1; transform: none; }
}

.parchment-top { text-align: center; margin-bottom: 6px; }

.verdict-label {
  text-align: center;
  font-family: var(--serif-caps);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .34em;
  text-transform: uppercase;
  color: #7c6533;
}

.verdict {
  text-align: center;
  font-family: var(--serif-caps);
  font-weight: 900;
  font-size: clamp(24px, 4vw, 31px);
  line-height: 1.2;
  color: #4a3413;
  margin-top: 8px;
  text-wrap: balance;
}

.verses {
  list-style: none;
  margin-top: 26px;
  display: grid;
  gap: 16px;
}

.verse {
  border-left: 3px solid #b08d2e;
  padding: 10px 18px;
  background: linear-gradient(90deg, rgba(176,141,46,.09), transparent 75%);
}

.verse-ref {
  font-family: var(--serif-caps);
  font-weight: 700;
  font-size: 13.5px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: #8c6a1c;
  margin-bottom: 4px;
}

.verse-text {
  font-family: var(--serif-body);
  font-style: italic;
  font-size: 18.5px;
  line-height: 1.55;
  color: #3a2c18;
}

.rule {
  border: none;
  height: 14px;
  margin: 28px 0;
  background:
    radial-gradient(circle at 50% 50%, #b08d2e 0 2.5px, transparent 3px) center / 14px 14px repeat-x,
    linear-gradient(#00000022, #00000000) center bottom / 100% 1px no-repeat,
    linear-gradient(#ffffff55, #00000000) center top / 100% 1px no-repeat;
}

.sermon {
  font-size: 19.5px;
  line-height: 1.72;
  color: #33271a;
}

.sermon.is-typing::after {
  content: "▌";
  color: #8c6a1c;
  animation: caret 1s steps(1) infinite;
}

@keyframes caret { 50% { opacity: 0; } }

.sermon::first-letter {
  font-family: var(--blackletter);
  font-size: 3.1em;
  float: left;
  line-height: .82;
  padding: 6px 10px 0 0;
  color: #7c5a14;
  text-shadow: 1px 1px 0 #ffffff88;
}

.burn-wrap {
  margin-top: 26px;
  padding: 14px 20px;
  border-radius: 4px;
  background: linear-gradient(180deg, rgba(140,34,48,.12), rgba(140,34,48,.05));
  border: 1px solid rgba(140,34,48,.3);
  border-left: 4px solid var(--crimson);
}

.burn {
  font-style: italic;
  font-weight: 500;
  font-size: 18px;
  color: #6d1f28;
}

.amen {
  text-align: center;
  font-family: var(--blackletter);
  font-size: 30px;
  color: #7c5a14;
  margin-top: 26px;
  animation: amenIn .7s cubic-bezier(.2,.9,.3,1) both;
}

@keyframes amenIn {
  from { opacity: 0; transform: scale(.8); }
  to   { opacity: 1; transform: none; }
}

.again-btn {
  display: block;
  margin: 28px auto 0;
  cursor: pointer;
  font-family: var(--serif-caps);
  font-weight: 600;
  font-size: 13.5px;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: #5d4a1e;
  background: transparent;
  border: 1px solid rgba(124,90,20,.55);
  border-radius: 999px;
  padding: 10px 26px;
  transition: all .2s ease;
}

.again-btn:hover {
  color: #3d2f0d;
  border-color: #7c5a14;
  background: rgba(124,90,20,.1);
}

/* ---------- voice ---------- */

.voice-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 18px auto 0;
  cursor: pointer;
  font-family: var(--serif-caps);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: #241a05;
  border: none;
  border-radius: 999px;
  padding: 12px 26px;
  background: linear-gradient(180deg, #f0d67c 0%, var(--gold) 45%, #a37f22 100%);
  box-shadow:
    0 8px 22px -8px rgba(212,175,55,.55),
    inset 0 1px 0 rgba(255,255,255,.55),
    inset 0 -2px 0 rgba(90,64,10,.5);
  transition: transform .15s ease, filter .25s ease;
}

.voice-btn:hover { transform: translateY(-1px); filter: brightness(1.06); }
.voice-btn:disabled { cursor: wait; filter: grayscale(.25) brightness(.85); transform: none; }

.voice-icon { width: 17px; height: 17px; flex: none; }

.voice-btn[data-state="playing"] .voice-icon { display: none; }

.eq {
  display: none;
  align-items: flex-end;
  gap: 3px;
  height: 16px;
}

.eq i {
  width: 3px;
  background: #241a05;
  border-radius: 2px;
  animation: eqbar .9s ease-in-out infinite;
}

.eq i:nth-child(1) { height: 40%; animation-delay: 0s; }
.eq i:nth-child(2) { height: 90%; animation-delay: .18s; }
.eq i:nth-child(3) { height: 60%; animation-delay: .36s; }
.eq i:nth-child(4) { height: 100%; animation-delay: .09s; }

@keyframes eqbar {
  0%, 100% { transform: scaleY(.4); }
  50%      { transform: scaleY(1); }
}

.voice-btn[data-state="playing"] .eq { display: flex; }

/* ---------- footer ---------- */

.footer {
  margin-top: 70px;
  text-align: center;
  font-size: 13.5px;
  line-height: 1.7;
  color: #6f6140;
}

.footer a { color: #a98f4d; text-decoration-color: rgba(169,143,77,.5); }
.footer a:hover { color: var(--gold-bright); }

/* ---------- responsive ---------- */

@media (max-width: 560px) {
  .confessional { padding: 18px 16px; }
  .parchment { padding: 28px 22px 26px; }
  .actions { flex-direction: column; align-items: stretch; text-align: center; }
  .thump-btn { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
