:root {
  --serif: "Poppins", system-ui, -apple-system, sans-serif; /* display family */
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --gold: #ffd24a;
  --gold-soft: #ffe79a;
  --gold-deep: #c8922a;
  --ash: #b98a8f;
  --crimson: #9c3340;
  --ink: #05030a;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; } /* single screen, no scroll */

body {
  background: radial-gradient(circle at 50% 40%, #3a2a06 0%, #140d02 50%, #050300 100%);
  color: #f7e9c4;
  font-family: var(--serif);
  -webkit-font-smoothing: antialiased;
  /* text is not selectable anywhere */
  -webkit-user-select: none; -moz-user-select: none; user-select: none;
}

#bg { position: fixed; inset: 0; width: 100vw; height: 100vh; z-index: -1; display: block; }

/* uniform veil across the whole page so bright nebula stays readable */
.veil { position: fixed; inset: 0; z-index: 0; pointer-events: none; background: rgba(0,0,0,0.34); }

main {
  position: relative;
  z-index: 1;
  height: 100dvh;
  max-width: 880px;
  margin: 0 auto;
  padding: clamp(0.8rem, 2.5vh, 2rem) 1.25rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: clamp(0.8rem, 2.6vh, 2.2rem);
  transition: filter 0.15s linear;
}

/* ---------- Hero (divine) ---------- */
.hero { display: flex; flex-direction: column; align-items: center; gap: clamp(0.3rem, 1vh, 0.7rem); }

.deity-wrap {
  position: relative;
  height: clamp(130px, 30vh, 300px);
  aspect-ratio: 3 / 4;
  display: flex; align-items: center; justify-content: center;
  will-change: transform;
}
.halo { position: absolute; inset: -8% -8% 12% -8%; background: radial-gradient(circle at 50% 42%, rgba(255,210,74,0) 38%, rgba(255,200,90,0) 60%); pointer-events: none; transition: background 0.25s ease; }
.deity-wrap.bless .halo { background: radial-gradient(circle at 50% 42%, rgba(255,235,150,0.55) 18%, rgba(255,200,90,0) 55%); }
#deity {
  position: relative; width: 100%; height: 100%; object-fit: contain;
  mix-blend-mode: screen;
  filter: drop-shadow(0 0 32px rgba(255,210,74,0.45)) drop-shadow(0 0 80px rgba(120,255,170,0.22));
  animation: float 7s ease-in-out infinite;
  user-select: none;
}
.deity-wrap.bless #deity { animation: float 7s ease-in-out infinite, blessflash 0.6s ease; }
@keyframes float { 0%,100% { transform: translateY(0) rotate(-0.4deg); } 50% { transform: translateY(-14px) rotate(0.4deg); } }
@keyframes blessflash { 0%{ filter: drop-shadow(0 0 32px rgba(255,210,74,0.45)) brightness(1); } 40%{ filter: drop-shadow(0 0 80px rgba(255,235,150,0.9)) brightness(1.5); } 100%{ filter: drop-shadow(0 0 32px rgba(255,210,74,0.45)) brightness(1); } }

.title {
  font-family: var(--serif);
  font-weight: 800;
  font-size: clamp(1.4rem, 7.2vw, 4.6rem);
  letter-spacing: clamp(0.5px, 0.4vw, 5px);
  line-height: 1;
  max-width: 100%;
  white-space: nowrap;
  color: #fff4d2;
  text-shadow: 0 2px 4px rgba(0,0,0,0.85), 0 0 26px rgba(255,200,70,0.55), 0 0 60px rgba(255,160,30,0.3);
}

.tagline {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 500;
  font-size: clamp(1rem, 3.1vw, 1.5rem);
  color: #fff3d0;
  letter-spacing: 0.3px;
  min-height: 1.5em;
  text-shadow: 0 1px 4px #000, 0 0 16px rgba(0,0,0,0.9);
  transition: opacity 0.4s ease;
}
.tagline.fading { opacity: 0; }

/* ---------- Divine altar ---------- */
.altar {
  position: relative; width: 100%; max-width: 720px;
  display: flex; flex-direction: column; align-items: center;
  gap: clamp(1rem, 2.6vh, 2rem);
}
.tallies { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: clamp(0.6rem, 3vw, 1.8rem); width: 100%; }
.tally { display: flex; flex-direction: column; align-items: center; gap: clamp(0.1rem, 0.6vh, 0.45rem); }
.tally-label { font-family: var(--serif); font-weight: 600; font-size: clamp(0.7rem, 2.3vw, 0.95rem); letter-spacing: 3px; text-transform: uppercase; }
.tally-num { font-family: var(--serif); font-weight: 800; font-size: clamp(2.4rem, 10vw, 4.6rem); line-height: 1; font-variant-numeric: tabular-nums; }
.tally-sub { font-family: var(--serif); font-style: italic; font-size: clamp(0.78rem, 2.5vw, 1.05rem); }

.faithful .tally-label { color: #ffe49a; text-shadow: 0 1px 3px #000, 0 0 16px rgba(255,210,74,0.6); }
.faithful .tally-num { color: #fff7e0; text-shadow: 0 2px 4px #000, 0 0 22px rgba(255,210,74,0.7), 0 0 60px rgba(255,170,40,0.35); }
.faithful .tally-sub { color: #f1dca2; text-shadow: 0 1px 4px #000; }
.heretics .tally-label { color: #e9b9bf; text-shadow: 0 1px 3px #000, 0 0 14px rgba(156,51,64,0.6); }
.heretics .tally-num { color: #f0cdd1; text-shadow: 0 2px 4px #000, 0 0 18px rgba(156,51,64,0.6); }
.heretics .tally-sub { color: #d6aab0; text-shadow: 0 1px 4px #000; }
.tally-num.bump { animation: bump 0.36s cubic-bezier(0.2,0.9,0.3,1.3); }
@keyframes bump { 0%{transform:scale(1);} 45%{transform:scale(1.22);} 100%{transform:scale(1);} }

.altar-divider { display: flex; flex-direction: column; align-items: center; gap: 0.4rem; align-self: stretch; justify-content: center; }
.div-line { width: 1px; flex: 1; min-height: 22px; background: linear-gradient(rgba(255,210,74,0), rgba(255,210,74,0.5)); }
.div-line:last-child { background: linear-gradient(rgba(255,210,74,0.5), rgba(255,210,74,0)); }
.div-glyph { color: var(--gold); font-size: 1.1rem; text-shadow: 0 0 12px rgba(255,210,74,0.7); }

.balance { width: 100%; max-width: 540px; height: 6px; border-radius: 999px; background: rgba(156,51,64,0.5); overflow: hidden; box-shadow: inset 0 0 0 1px rgba(255,255,255,0.08); }
.balance-fill { height: 100%; width: 50%; background: linear-gradient(90deg, var(--gold-deep), var(--gold-soft)); box-shadow: 0 0 16px rgba(255,210,74,0.7); transition: width 0.6s cubic-bezier(0.2,0.8,0.2,1); }
.balance-label { font-family: var(--serif); font-style: italic; color: #f3e1b0; font-size: clamp(0.88rem, 2.5vw, 1.12rem); min-height: 1.3em; text-shadow: 0 1px 3px #000, 0 0 10px rgba(0,0,0,0.9); }

.actions { display: flex; flex-wrap: wrap; gap: 1.1rem; justify-content: center; align-items: center; margin-top: clamp(0.2rem, 1vh, 0.8rem); }
.btn { font-family: var(--serif); cursor: pointer; border: none; border-radius: 999px; transition: transform 0.08s ease, box-shadow 0.2s ease, filter 0.2s ease, opacity 0.2s ease; touch-action: manipulation; }
.btn:active { transform: scale(0.95); }
.btn-pollo {
  font-weight: 600; font-size: clamp(1rem, 3.2vw, 1.35rem); letter-spacing: 0.5px;
  color: var(--ink);
  background: linear-gradient(135deg, var(--gold-soft) 0%, var(--gold) 48%, var(--gold-deep) 100%);
  padding: 0.72em 1.9em;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.3) inset, 0 10px 38px rgba(255,190,50,0.45);
}
.btn-pollo:hover { filter: brightness(1.08); box-shadow: 0 0 0 1px rgba(255,255,255,0.4) inset, 0 12px 48px rgba(255,190,50,0.62); }
.btn-pollo.pulse { animation: pulse 0.34s ease; }
@keyframes pulse { 0%{transform:scale(0.95);} 55%{transform:scale(1.07);} 100%{transform:scale(1);} }
.btn-contra {
  font-weight: 600; font-size: clamp(0.82rem, 2.4vw, 1rem); letter-spacing: 0.5px;
  color: #ffc4ca;
  background: rgba(80,12,20,0.55);
  border: 1px solid rgba(255,90,106,0.6); padding: 0.62em 1.35em;
  text-shadow: 0 1px 3px #000;
}
.btn-contra:hover { color: #fff; background: rgba(120,18,30,0.7); border-color: rgba(255,90,106,0.95); box-shadow: 0 0 26px rgba(255,40,60,0.5); }

/* ---------- Heresy: full-page corruption ---------- */
/* the page itself is corrupted (not hidden): it tears and glitches in chaos */
body.cursed main {
  pointer-events: none;
  filter: saturate(1.7) contrast(1.35) hue-rotate(-10deg)
          drop-shadow(3px 0 rgba(255,0,90,0.6)) drop-shadow(-3px 0 rgba(0,255,230,0.5));
  animation: pageGlitch 1.1s steps(2) infinite;
}
@keyframes pageGlitch {
  0%,100% { transform: translate(0,0); }
  15% { transform: translate(-4px,2px) skewX(-1.2deg); }
  30% { transform: translate(4px,-3px); clip-path: inset(8% 0 72% 0); }
  32% { clip-path: inset(0 0 0 0); }
  50% { transform: translate(-3px,3px) skewX(0.8deg); }
  68% { transform: translate(3px,-2px); clip-path: inset(58% 0 22% 0); }
  70% { clip-path: inset(0 0 0 0); }
  85% { transform: translate(-2px,1px); }
}
body.cursed.shake .curse-content { animation: slamIn 0.4s cubic-bezier(0.2,1.4,0.3,1), shake 0.32s 0.4s infinite; }
@keyframes shake { 0%,100%{ transform: translate(0,0); } 20%{ transform: translate(-7px,4px) skewX(-0.5deg); } 40%{ transform: translate(7px,-4px) skewX(0.5deg); } 60%{ transform: translate(-5px,-2px); } 80%{ transform: translate(5px,3px); } }

.curse-overlay {
  position: fixed; inset: 0; z-index: 50;
  display: flex; align-items: center; justify-content: center;
  padding: clamp(1rem, 4vw, 2rem);
  background: rgba(8,0,0,0); opacity: 0; pointer-events: none;
  transition: opacity 0.12s linear;
  font-family: var(--mono);
  overflow: hidden;
}
body.cursed .curse-overlay { opacity: 1; pointer-events: auto; background: rgba(10,0,2,0.9); animation: bgflick 0.25s steps(2) infinite; }
@keyframes bgflick { 0%,100%{ background: rgba(10,0,2,0.9); } 50%{ background: rgba(22,0,4,0.86); } }

/* full-screen noise covers the whole viewport = whole page in chaos */
.curse-noise {
  position: absolute; inset: -10%; pointer-events: none;
  background:
    repeating-linear-gradient(0deg, rgba(255,0,0,0.08) 0px, rgba(0,0,0,0) 2px, rgba(0,255,200,0.06) 3px, rgba(0,0,0,0) 4px),
    repeating-linear-gradient(90deg, rgba(255,255,255,0.04) 0px, rgba(0,0,0,0) 3px);
  animation: noiseShift 0.18s steps(3) infinite;
  mix-blend-mode: screen;
}
@keyframes noiseShift { 0%{transform:translate(0,0);} 100%{transform:translate(-3px,-5px);} }
/* thin chromatic glitch tears that snap to random heights and flicker */
.curse-overlay::before, .curse-overlay::after {
  content: ""; position: absolute; left: 0; right: 0; height: 2px;
  mix-blend-mode: screen; pointer-events: none; opacity: 0;
}
.curse-overlay::before {
  /* red line with a cyan ghost just below = chromatic tear */
  background: #ff2236;
  box-shadow: 0 4px 0 rgba(0,255,225,0.55), 0 -2px 6px rgba(255,34,54,0.5);
  animation: tear1 2.9s steps(1) infinite;
}
.curse-overlay::after {
  background: rgba(0,255,225,0.7);
  box-shadow: 0 3px 0 rgba(255,34,54,0.5);
  animation: tear2 3.7s steps(1) infinite;
}
@keyframes tear1 {
  0%,100%{ top: 20%; opacity: 0; } 6%{ top: 31%; opacity: 1; } 8%{ opacity: 0; }
  34%{ top: 58%; opacity: 1; } 37%{ opacity: 0; } 62%{ top: 14%; opacity: 1; } 64%{ opacity: 0; }
  80%{ top: 44%; opacity: 1; } 82%{ opacity: 0; }
}
@keyframes tear2 {
  0%,100%{ top: 66%; opacity: 0; } 12%{ top: 24%; opacity: 1; } 14%{ opacity: 0; }
  45%{ top: 78%; opacity: 1; } 47%{ opacity: 0; } 72%{ top: 50%; opacity: 1; } 74%{ opacity: 0; }
}

.curse-content {
  position: relative; z-index: 1;
  width: min(680px, 92vw); max-width: 100%;
  text-align: left; color: #ff4d5e;
  background: linear-gradient(180deg, rgba(14,0,3,0.92), rgba(6,0,2,0.88));
  border: 1px solid rgba(255,60,80,0.45);
  border-radius: 10px;
  padding: clamp(1.2rem, 4vw, 2rem);
  box-shadow: 0 0 0 1px rgba(255,60,80,0.12), 0 30px 80px rgba(0,0,0,0.6), 0 0 50px rgba(255,30,50,0.18);
  overflow: hidden;
}
/* panel header strip */
.curse-bar { display: flex; align-items: center; gap: 0.6rem; padding-bottom: 0.85rem; margin-bottom: 1rem; border-bottom: 1px solid rgba(255,60,80,0.25); font-size: clamp(0.6rem, 2vw, 0.78rem); letter-spacing: 2px; color: #ff8a93; }
.rec { width: 9px; height: 9px; border-radius: 50%; background: #ff2236; box-shadow: 0 0 10px #ff2236; animation: flick 1s steps(2) infinite; }
.curse-bar-label { flex: 1; }
.curse-ts { color: #ff9aa2; opacity: 0.8; }
.curse-alert {
  font-family: var(--mono); font-weight: 600;
  font-size: clamp(1.15rem, 5.2vw, 2.4rem);
  letter-spacing: 0px; line-height: 1.05;
  color: #ff3344; word-break: break-word;
  text-shadow: 2px 0 #00fff2, -2px 0 #ff00aa;
  animation: rgbshift 0.18s steps(2) infinite;
}
@keyframes rgbshift {
  0%{ text-shadow: 2px 0 #00fff2, -2px 0 #ff00aa; transform: translate(0,0); }
  50%{ text-shadow: -2px 0 #00fff2, 2px 0 #ff00aa; transform: translate(1px,-1px); }
  100%{ text-shadow: 2px 0 #00fff2, -2px 0 #ff00aa; transform: translate(-1px,1px); }
}
.curse-sub { margin-top: 0.45rem; font-size: clamp(0.72rem, 2.6vw, 1rem); color: #ff9aa2; letter-spacing: 2px; animation: flick 0.4s steps(2) infinite; }
@keyframes flick { 0%,80%,100%{opacity:1;} 85%{opacity:0.35;} 90%{opacity:0.9;} }

.curse-message {
  margin-top: 1.3rem;
  font-size: clamp(0.92rem, 2.9vw, 1.25rem);
  line-height: 1.7;
  color: #fff;                 /* high contrast, readable (no rgb blur) */
  text-shadow: 0 1px 2px #000;
  white-space: pre-wrap;
  border-left: 3px solid #ff3344;
  padding-left: 0.9rem;
}
.curse-message .punch { color: #fff; font-weight: 600; background: #c20018; padding: 0 0.25em; box-decoration-break: clone; -webkit-box-decoration-break: clone; }
.curse-codes { margin-top: 1.3rem; font-size: clamp(0.62rem, 2vw, 0.82rem); line-height: 1.75; color: #57ffcf; opacity: 0.78; white-space: pre-wrap; word-break: break-word; min-height: 3.3em; }
.curse-hint { margin-top: 1.4rem; font-size: clamp(0.75rem, 2.5vw, 0.95rem); color: #ffb3b9; letter-spacing: 1px; animation: flick 0.9s steps(2) infinite; }

/* ---- impact flash on heresy ---- */
.flash {
  position: fixed; inset: 0; z-index: 60; pointer-events: none;
  background: #fff; opacity: 0;
}
.flash.fire { animation: flashfire 0.45s ease-out; }
@keyframes flashfire {
  0%   { opacity: 0.95; background: #fff; }
  18%  { opacity: 0.7;  background: #ff2233; }
  100% { opacity: 0;    background: #ff2233; }
}

/* ---- content slams in + violent entrance ---- */
body.cursed .curse-content { animation: slamIn 0.4s cubic-bezier(0.2,1.4,0.3,1); }
@keyframes slamIn {
  0%   { transform: scale(1.18); opacity: 0; filter: blur(6px); }
  60%  { transform: scale(0.985); opacity: 1; filter: blur(0); }
  100% { transform: scale(1); }
}

/* ---- moving scan line over the whole screen ---- */
.curse-scan {
  position: absolute; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, transparent, rgba(0,255,210,0.55), transparent);
  box-shadow: 0 0 18px rgba(0,255,210,0.6);
  mix-blend-mode: screen; pointer-events: none; top: 0;
  animation: scanmove 2.4s linear infinite;
}
@keyframes scanmove { 0%{ top: -2%; } 100%{ top: 102%; } }

/* ---- purge progress bar ---- */
.curse-purge { display: flex; align-items: center; gap: 0.7rem; margin-top: 1.4rem; color: #ff8a93; font-size: clamp(0.62rem, 2.1vw, 0.82rem); letter-spacing: 1px; }
.purge-text { white-space: nowrap; }
.purge-track { flex: 1; height: 10px; background: rgba(255,255,255,0.08); border: 1px solid rgba(255,60,80,0.4); overflow: hidden; }
.purge-fill { height: 100%; width: 0%; background: repeating-linear-gradient(90deg, #ff2233 0 8px, #7a0010 8px 12px); box-shadow: 0 0 12px rgba(255,40,60,0.8); transition: width 0.2s linear; }
.purge-pct { white-space: nowrap; min-width: 3.2em; text-align: right; color: #ffd0d4; }
.curse-content.restored .purge-fill { background: repeating-linear-gradient(90deg, #46ff9c 0 8px, #1f8f59 8px 12px); box-shadow: 0 0 12px rgba(70,255,156,0.8); }
.curse-content.restored .purge-text, .curse-content.restored .purge-pct { color: #9dffc6; }

@media (prefers-reduced-motion: reduce) {
  #deity, .title { animation: none; }
  body.cursed.shake .curse-content { animation: none; }
  .curse-noise, .curse-overlay::before, .curse-overlay::after, .curse-alert, .curse-sub, .curse-hint, body.cursed .curse-overlay { animation: none; }
}
