/*!
 * HABEMUS PAPAM — style.css
 * Manuscrito iluminado + RPG de 16 bits. Um único tema, noturno e cerimonial.
 * Layout: telas empilhadas; um painel de pergaminho com moldura dourada
 * centraliza cada momento do jogo; arte em pixel desenhada por código.
 */

/* ------------------------------------------------------------------ */
/* Tokens                                                              */
/* ------------------------------------------------------------------ */
:root {
  color-scheme: dark;
  --gold: #C9A24D;
  --gold-hi: #F0D58A;
  --gold-dk: #8A6A26;
  --red: #8B2027;
  --red-hi: #B0303A;
  --wine: #651D32;
  --purple: #4B244A;
  --blue: #233F74;
  --ivory: #F5E9CF;
  --parch: #EBDDB9;
  --parch-dk: #D6BF8E;
  --ink: #241C19;
  --ink-soft: #4a3a30;
  --night: #0b1029;
  --bg: #120b10;
  --text: #F5E9CF;
  --muted: #cdbb98;

  --f-title: 'Cinzel Decorative', 'Cinzel', 'Trajan Pro', Georgia, serif;
  --f-head: 'Cinzel', 'Trajan Pro', Georgia, serif;
  --f-body: 'Alegreya', 'Iowan Old Style', 'Palatino Linotype', Georgia, serif;
  --f-pixel: 'Silkscreen', 'Courier New', monospace;
  --f-initial: 'UnifrakturCook', 'Cinzel Decorative', Georgia, serif;

  --gutter: max(16px, env(safe-area-inset-left, 0px));
  --gutter-r: max(16px, env(safe-area-inset-right, 0px));
  --px: 3px;
  --ease: cubic-bezier(.2, .8, .2, 1);

  --c-tl: none; --c-tr: none; --c-bl: none; --c-br: none;
  --noise: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 .32  0 0 0 0 .22  0 0 0 0 .12  0 0 0 .55 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--f-body);
  font-size: 1.125rem;
  line-height: 1.55;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
body::before {
  /* tapeçaria de fundo: losangos dourados quase invisíveis sobre vinho escuro */
  content: ''; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(101, 29, 50, .55), transparent 60%),
    radial-gradient(ellipse at 50% 120%, rgba(35, 63, 116, .35), transparent 55%),
    repeating-linear-gradient(45deg, rgba(201, 162, 77, .045) 0 2px, transparent 2px 22px),
    repeating-linear-gradient(-45deg, rgba(201, 162, 77, .045) 0 2px, transparent 2px 22px),
    var(--bg);
}
img, canvas { max-width: 100%; }
canvas.pixel, .pixel { image-rendering: pixelated; image-rendering: crisp-edges; }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; }
a { color: var(--gold-hi); }
:focus-visible { outline: 3px solid var(--gold-hi); outline-offset: 3px; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

.skip-link {
  position: absolute; left: 12px; top: -60px; z-index: 100;
  background: var(--gold); color: var(--ink); padding: 10px 14px;
  font-family: var(--f-pixel); font-size: 0.88rem; text-decoration: none;
}
.skip-link:focus { top: calc(12px + env(safe-area-inset-top, 0px)); }

/* ------------------------------------------------------------------ */
/* Barra superior                                                      */
/* ------------------------------------------------------------------ */
.topbar {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 30;
  display: flex; align-items: center; gap: 10px;
  padding-block: 8px;
  padding-left: var(--gutter); padding-right: var(--gutter-r);
  background: linear-gradient(#1a0d14ee, #1a0d14cc);
  border-bottom: var(--px) solid var(--gold-dk);
  box-shadow: 0 var(--px) 0 var(--ink);
  backdrop-filter: blur(4px);
}
.brand {
  display: flex; align-items: center; gap: 10px;
  background: none; border: 0; padding: 4px; cursor: pointer;
  font-family: var(--f-head); font-weight: 700; letter-spacing: .12em; font-size: .95rem;
  color: var(--gold-hi); text-transform: uppercase;
}
.brand canvas { width: 26px; height: 26px; }
.topbar .spacer { flex: 1; }
.topnav { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.chip-btn {
  font-family: var(--f-pixel); font-size: 0.73rem; line-height: 1.4; letter-spacing: .04em;
  background: #2a1520; color: var(--ivory);
  border: 2px solid var(--gold-dk); padding: 8px 10px; cursor: pointer;
  box-shadow: 2px 2px 0 var(--ink);
  transition: transform .12s var(--ease), background .12s;
}
.chip-btn:hover { background: var(--wine); transform: translateY(-1px); }
.chip-btn[aria-pressed="true"] { background: var(--gold); color: var(--ink); border-color: var(--gold-hi); }
.chip-btn .ico { display: inline-block; margin-right: 6px; }

/* ------------------------------------------------------------------ */
/* Telas                                                               */
/* ------------------------------------------------------------------ */
main { position: relative; }
.screen { display: none; position: relative; }
.screen.is-active { display: block; animation: screenIn .45s var(--ease); }
@keyframes screenIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.wrap {
  width: 100%; max-width: 1080px; margin-inline: auto;
  padding-left: var(--gutter); padding-right: var(--gutter-r);
}

/* ------------------------------------------------------------------ */
/* Moldura dourada + pergaminho                                        */
/* ------------------------------------------------------------------ */
.frame {
  position: relative;
  border: var(--px) solid var(--gold);
  box-shadow:
    0 0 0 var(--px) var(--ink),
    0 0 0 calc(var(--px) * 2) var(--gold-dk),
    0 0 0 calc(var(--px) * 3) var(--ink),
    inset 0 0 0 var(--px) var(--gold-dk),
    0 18px 40px rgba(0, 0, 0, .55);
}
.frame::before, .frame::after {
  content: ''; position: absolute; pointer-events: none; width: 42px; height: 42px; z-index: 2;
  background-size: 42px 42px; background-repeat: no-repeat; image-rendering: pixelated;
}
.frame::before { top: -6px; left: -6px; background-image: var(--c-tl); }
.frame::after { bottom: -6px; right: -6px; background-image: var(--c-br); }
.frame > .corner-tr, .frame > .corner-bl {
  position: absolute; width: 42px; height: 42px; pointer-events: none; z-index: 2;
  background-size: 42px 42px; image-rendering: pixelated;
}
.frame > .corner-tr { top: -6px; right: -6px; background-image: var(--c-tr); }
.frame > .corner-bl { bottom: -6px; left: -6px; background-image: var(--c-bl); }

.parchment {
  color: var(--ink);
  background:
    radial-gradient(ellipse at 50% 40%, rgba(255, 250, 235, .55), transparent 65%),
    radial-gradient(ellipse at 0% 0%, rgba(120, 80, 30, .28), transparent 40%),
    radial-gradient(ellipse at 100% 100%, rgba(120, 80, 30, .3), transparent 42%),
    radial-gradient(ellipse at 100% 0%, rgba(120, 80, 30, .2), transparent 35%),
    var(--noise),
    var(--parch);
}
.velvet {
  background:
    repeating-linear-gradient(90deg, rgba(0, 0, 0, .18) 0 3px, transparent 3px 14px),
    linear-gradient(180deg, #5a1528, #3a0d1a);
}

/* ------------------------------------------------------------------ */
/* Botões                                                              */
/* ------------------------------------------------------------------ */
.btn {
  --b-bg: #2b1420; --b-fg: var(--ivory); --b-bd: var(--gold);
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 52px; padding: 14px 22px;
  font-family: var(--f-pixel); font-size: 0.91rem; line-height: 1.5; letter-spacing: .06em; text-transform: uppercase;
  color: var(--b-fg); background: var(--b-bg);
  border: var(--px) solid var(--b-bd);
  box-shadow: 0 0 0 var(--px) var(--ink), 4px 4px 0 var(--px) var(--ink);
  cursor: pointer; text-decoration: none;
  transition: transform .12s var(--ease), box-shadow .12s var(--ease), background .15s;
}
.btn:hover { transform: translate(-1px, -2px); box-shadow: 0 0 0 var(--px) var(--ink), 6px 7px 0 var(--px) var(--ink); }
.btn:active { transform: translate(3px, 3px); box-shadow: 0 0 0 var(--px) var(--ink), 1px 1px 0 var(--px) var(--ink); }
.btn-primary {
  --b-bg: linear-gradient(180deg, #a52a33, #7a1a22);
  --b-fg: #fff6dc; --b-bd: var(--gold-hi);
  font-size: 1.07rem; padding: 18px 28px 18px 40px;
  text-shadow: 2px 2px 0 var(--ink);
  animation: primaryGlow 2.4s ease-in-out infinite;
}
.btn-primary::before {
  content: ''; position: absolute; left: 14px; top: 50%; margin-top: -6px;
  border-left: 10px solid var(--gold-hi); border-top: 6px solid transparent; border-bottom: 6px solid transparent;
  animation: cursorBlink 1s steps(2, start) infinite;
}
.btn-primary::after {
  /* brilho que atravessa o botão */
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(105deg, transparent 35%, rgba(255, 240, 200, .45) 48%, transparent 60%);
  background-size: 250% 100%; background-position: 130% 0;
  animation: sheen 3.2s ease-in-out infinite;
}
@keyframes primaryGlow {
  0%, 100% { box-shadow: 0 0 0 var(--px) var(--ink), 4px 4px 0 var(--px) var(--ink), 0 0 0 rgba(240, 213, 138, 0); }
  50% { box-shadow: 0 0 0 var(--px) var(--ink), 4px 4px 0 var(--px) var(--ink), 0 0 26px rgba(240, 213, 138, .45); }
}
@keyframes cursorBlink { to { visibility: hidden; } }
@keyframes sheen { 0%, 55% { background-position: 130% 0; } 100% { background-position: -40% 0; } }
.btn-gold { --b-bg: linear-gradient(180deg, #e6c56e, #b38a35); --b-fg: var(--ink); --b-bd: var(--gold-hi); }
.btn-blue { --b-bg: linear-gradient(180deg, #2f5394, #1d3462); }
.btn-ghost { --b-bg: rgba(20, 10, 16, .6); --b-bd: var(--gold-dk); font-size: 0.78rem; min-height: 46px; padding: 12px 16px; }
.btn-sm { min-height: 40px; padding: 10px 12px; font-size: 0.73rem; }
.link-btn {
  background: none; border: 0; padding: 6px 2px; cursor: pointer;
  font-family: var(--f-pixel); font-size: 0.76rem; color: var(--gold-hi); text-decoration: underline; text-underline-offset: 4px;
}

/* ------------------------------------------------------------------ */
/* TELA INICIAL                                                        */
/* ------------------------------------------------------------------ */
#screen-home { min-height: calc(100vh - 60px); min-height: calc(100dvh - 60px); overflow: hidden; }
.home-sky { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 0; }
.curtain {
  position: absolute; top: 0; bottom: 0; width: clamp(34px, 11vw, 150px); z-index: 2; pointer-events: none;
  background:
    linear-gradient(90deg, rgba(0, 0, 0, .55), transparent 30%, rgba(255, 200, 200, .08) 45%, transparent 60%, rgba(0, 0, 0, .4)) 0 0 / 28px 100%,
    linear-gradient(180deg, #6a1a2e, #3a0b18 85%);
  box-shadow: inset -6px 0 0 rgba(0, 0, 0, .35);
}
.curtain-l { left: 0; border-right: var(--px) solid var(--gold-dk); clip-path: polygon(0 0, 100% 0, 100% 62%, 55% 100%, 0 100%); }
.curtain-r { right: 0; border-left: var(--px) solid var(--gold-dk); clip-path: polygon(0 0, 100% 0, 100% 100%, 45% 100%, 0 62%); }
.valance {
  position: absolute; left: 0; right: 0; top: 0; height: 34px; z-index: 3; pointer-events: none;
  background:
    radial-gradient(circle at 20px 0, #6a1a2e 0 20px, transparent 21px) 0 0 / 40px 34px repeat-x,
    linear-gradient(#4a0f1f, #4a0f1f) 0 0 / 100% 12px no-repeat;
  filter: drop-shadow(0 3px 0 var(--gold-dk)) drop-shadow(0 3px 0 var(--ink));
}
.home-inner {
  position: relative; z-index: 4;
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 18px;
  padding-block: clamp(48px, 9vh, 96px) 40px;
  padding-left: calc(var(--gutter) + clamp(20px, 9vw, 120px));
  padding-right: calc(var(--gutter-r) + clamp(20px, 9vw, 120px));
  max-width: 1000px; margin-inline: auto;
}
.home-inner::before {
  content: ''; position: absolute; inset: 4% 2% 10%; z-index: -1; pointer-events: none;
  background: radial-gradient(ellipse at 50% 45%, rgba(5, 8, 26, .82), rgba(5, 8, 26, .5) 45%, transparent 72%);
}
.crest { width: 96px; height: auto; filter: drop-shadow(0 0 12px rgba(240, 213, 138, .45)); animation: float 4s ease-in-out infinite; }
@keyframes float { 50% { transform: translateY(-6px); } }
.eyebrow {
  margin: 0; font-family: var(--f-pixel); font-size: 0.76rem; letter-spacing: .18em; color: var(--gold);
  text-transform: uppercase;
}
.title {
  margin: 0; line-height: .95; font-family: var(--f-title); font-weight: 900;
  font-size: clamp(3rem, 13vw, 6.6rem); letter-spacing: .02em; text-wrap: balance;
  display: flex; flex-direction: column; align-items: center;
}
.title span {
  background: linear-gradient(100deg, #9c7424 0%, #f0d58a 22%, #fff3c4 30%, #c9a24d 42%, #8a6a26 58%, #f0d58a 76%, #c9a24d 100%);
  background-size: 220% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(3px 3px 0 #241C19) drop-shadow(0 0 18px rgba(201, 162, 77, .35));
  animation: goldShine 6s linear infinite;
}
@keyframes goldShine { to { background-position: -220% 0; } }
.subtitle {
  margin: 0; max-width: 34ch; font-size: clamp(1.1rem, 2.6vw, 1.45rem); font-style: italic; color: var(--ivory);
  text-shadow: 0 2px 0 var(--ink); text-wrap: balance;
}
.home-cta { display: flex; flex-direction: column; align-items: center; gap: 16px; margin-top: 8px; }
.home-secondary { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }
.challenge {
  max-width: 520px; padding: 12px 16px; font-size: 1rem;
  background: rgba(35, 63, 116, .55); border: 2px solid var(--gold-dk);
}
.challenge strong { color: var(--gold-hi); }
.candles { display: flex; gap: clamp(22px, 7vw, 70px); align-items: flex-end; margin-top: 18px; }
.candle { position: relative; width: 12px; background: linear-gradient(90deg, #fff3d6, #e9d5a8); box-shadow: inset -3px 0 0 #c9b383; }
.candle::before { /* chama */
  content: ''; position: absolute; left: 50%; top: -18px; width: 8px; height: 14px; margin-left: -4px;
  background: radial-gradient(circle at 50% 70%, #fff7c2 0 25%, #ffb63b 45%, #e0662a 70%, transparent 72%);
  animation: flicker .9s steps(3) infinite;
}
.candle::after { /* halo */
  content: ''; position: absolute; left: 50%; top: -42px; width: 70px; height: 70px; margin-left: -35px;
  background: radial-gradient(circle, rgba(255, 190, 90, .35), transparent 65%); border-radius: 50%;
  animation: halo 2.6s ease-in-out infinite;
}
.candle i { position: absolute; left: -6px; right: -6px; bottom: -6px; height: 6px; background: var(--gold); box-shadow: 0 3px 0 var(--gold-dk); }
.candle:nth-child(1) { height: 34px; } .candle:nth-child(2) { height: 52px; } .candle:nth-child(3) { height: 44px; }
.candle:nth-child(4) { height: 52px; } .candle:nth-child(5) { height: 34px; }
.candle:nth-child(2n)::before { animation-delay: -.4s; }
@keyframes flicker { 0% { transform: scale(1, 1); } 33% { transform: scale(.85, 1.12) translateX(1px); } 66% { transform: scale(1.08, .92) translateX(-1px); } }
@keyframes halo { 50% { opacity: .55; transform: scale(.9); } }
.home-note { margin: 10px 0 0; font-size: .85rem; color: var(--muted); max-width: 52ch; }

/* ------------------------------------------------------------------ */
/* INTRODUÇÃO                                                          */
/* ------------------------------------------------------------------ */
#screen-intro .wrap { padding-block: clamp(28px, 6vh, 64px); }
.intro-panel { max-width: 720px; margin: 0 auto; padding: clamp(28px, 5vw, 52px); }
.intro-text p { margin: 0 0 1em; font-size: clamp(1.12rem, 2.4vw, 1.3rem); line-height: 1.6; min-height: 1.6em; }
.intro-text p:first-child::first-letter, .initial {
  float: left; font-family: var(--f-initial); font-size: 3.6em; line-height: .8; margin: .06em .12em 0 0; padding: .08em .12em .02em;
  color: var(--red); background: linear-gradient(135deg, #f5d98a, #c9a24d); border: 2px solid var(--ink);
  box-shadow: 3px 3px 0 var(--gold-dk);
}
.intro-text .caret { display: inline-block; width: .55em; height: 1em; vertical-align: -0.1em; background: var(--red); animation: cursorBlink .8s steps(2, start) infinite; }
.intro-actions { display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; align-items: center; margin-top: 18px; }
.intro-hint { font-family: var(--f-pixel); font-size: 0.69rem; color: var(--ink-soft); }

/* ------------------------------------------------------------------ */
/* QUIZ                                                                */
/* ------------------------------------------------------------------ */
#screen-quiz .wrap { padding-block: clamp(18px, 4vh, 40px) 40px; }
.quiz-layout { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: clamp(18px, 3vw, 36px); align-items: start; }
.quiz-side {
  position: sticky; top: 84px;
  display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center;
  padding: 18px 12px;
}
.rose { width: 168px; height: 168px; }
.progress-label { font-family: var(--f-pixel); font-size: 0.73rem; line-height: 1.7; color: var(--gold-hi); letter-spacing: .05em; }
.progress-label b { display: block; font-family: var(--f-head); font-size: 1.7rem; letter-spacing: .05em; color: var(--ivory); margin-bottom: 4px; }
.progress-bar { width: 100%; height: 12px; background: #1b1020; border: 2px solid var(--gold-dk); box-shadow: 0 0 0 2px var(--ink); }
.progress-bar > i { display: block; height: 100%; width: 0; background: repeating-linear-gradient(90deg, var(--gold) 0 6px, var(--gold-hi) 6px 8px); transition: width .4s var(--ease); }
.mini-pope { width: 80px; height: 104px; animation: bob 1.6s steps(2) infinite; }
@keyframes bob { 50% { transform: translateY(-3px); } }
.pope-says {
  position: relative; font-size: .9rem; font-style: italic; line-height: 1.35; color: var(--ivory);
  background: #2b1420; border: 2px solid var(--gold-dk); padding: 8px 10px; min-height: 3.2em;
}
.pope-says::after { content: ''; position: absolute; left: 50%; bottom: -10px; margin-left: -6px; border: 6px solid transparent; border-top-color: var(--gold-dk); }

.quiz-panel { padding: clamp(22px, 4vw, 44px); min-width: 0; }
.q-head { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; flex-wrap: wrap; }
.q-num {
  font-family: var(--f-head); font-weight: 700; font-size: 1.05rem; letter-spacing: .08em;
  color: var(--ivory); background: var(--red); padding: 6px 12px 4px; border: 2px solid var(--ink); box-shadow: 3px 3px 0 var(--gold-dk);
}
.q-theme { font-family: var(--f-pixel); font-size: 0.70rem; letter-spacing: .1em; text-transform: uppercase; color: var(--wine); }
.q-text {
  margin: 0 0 22px; font-family: var(--f-body); font-weight: 700; font-size: clamp(1.25rem, 2.8vw, 1.7rem); line-height: 1.32;
  text-wrap: pretty; outline: none;
}
.q-text .initial { font-size: 2.7em; }
.answers { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.answer {
  position: relative; width: 100%; display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 14px;
  text-align: left; cursor: pointer;
  min-height: 60px; padding: 12px 16px 12px 12px;
  font-family: var(--f-body); font-size: clamp(1.02rem, 2.1vw, 1.12rem); line-height: 1.35; color: var(--ivory);
  background: linear-gradient(180deg, #3a1a2a, #2a1220);
  border: var(--px) solid var(--gold-dk);
  box-shadow: 0 0 0 2px var(--ink), 3px 3px 0 2px var(--ink);
  transition: transform .14s var(--ease), border-color .14s, background .14s;
}
.answer .key {
  display: grid; place-items: center; width: 36px; height: 36px;
  font-family: var(--f-pixel); font-size: 0.91rem; color: var(--ink);
  background: linear-gradient(135deg, #f5d98a, #c9a24d); border: 2px solid var(--ink); box-shadow: 2px 2px 0 var(--gold-dk);
}
.answer::after {
  content: ''; position: absolute; right: 14px; top: 50%; margin-top: -6px; opacity: 0;
  border-left: 9px solid var(--gold-hi); border-top: 6px solid transparent; border-bottom: 6px solid transparent;
}
.answer:hover, .answer:focus-visible { transform: translateX(5px); border-color: var(--gold-hi); background: linear-gradient(180deg, #4a1f33, #33152a); }
.answer:hover::after, .answer:focus-visible::after { opacity: 1; animation: cursorBlink .7s steps(2, start) infinite; }
.answer.is-picked { border-color: var(--gold-hi); background: linear-gradient(180deg, #8b2027, #651d32); animation: pick .5s steps(4) both; }
.answer.is-picked .key { background: var(--ivory); }
.answer.is-dim { opacity: .45; }
.answer.was-chosen { border-color: var(--gold); }
.answer.was-chosen .key { background: var(--ivory); }
@keyframes pick { 0%, 50% { box-shadow: 0 0 0 2px var(--gold-hi), 0 0 18px 2px rgba(240, 213, 138, .7); } 25%, 75% { box-shadow: 0 0 0 2px var(--ink), 3px 3px 0 2px var(--ink); } 100% { box-shadow: 0 0 0 2px var(--gold-hi), 0 0 12px rgba(240, 213, 138, .5); } }
.q-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 22px; flex-wrap: wrap; }
.q-hint { font-family: var(--f-pixel); font-size: 0.66rem; color: var(--ink-soft); }
.quiz-panel.turning { animation: turn .38s var(--ease); }
@keyframes turn { from { opacity: 0; transform: translateX(14px) rotate(.4deg); } to { opacity: 1; transform: none; } }

/* ------------------------------------------------------------------ */
/* REVELAÇÃO — fumaça                                                  */
/* ------------------------------------------------------------------ */
.reveal { position: fixed; inset: 0; z-index: 80; background: #04050c; display: grid; place-items: center; overflow: hidden; }
.reveal canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.reveal-caption {
  position: absolute; left: 0; right: 0; top: calc(14% + env(safe-area-inset-top, 0px)); z-index: 2; text-align: center;
  font-family: var(--f-pixel); font-size: clamp(.85rem, 2.4vw, 1.15rem); letter-spacing: .12em; color: var(--ivory);
  text-shadow: 2px 2px 0 #000; padding-inline: 16px;
}
.reveal-title {
  position: absolute; left: 0; right: 0; top: 28%; z-index: 2; margin: 0; text-align: center;
  font-family: var(--f-title); font-weight: 900; font-size: clamp(2.4rem, 10vw, 6.4rem); line-height: 1;
  color: var(--gold-hi); text-shadow: 4px 4px 0 var(--ink), 0 0 30px rgba(240, 213, 138, .8);
  opacity: 0; transform: scale(.6);
}
.reveal-title.on { animation: habemus 1s var(--ease) forwards; }
@keyframes habemus { 60% { opacity: 1; transform: scale(1.08); } 100% { opacity: 1; transform: scale(1); } }
.reveal-skip {
  position: absolute; z-index: 3;
  right: calc(16px + env(safe-area-inset-right, 0px)); bottom: calc(16px + env(safe-area-inset-bottom, 0px));
}

/* ------------------------------------------------------------------ */
/* RESULTADO — carta colecionável                                      */
/* ------------------------------------------------------------------ */
#screen-result .wrap { padding-block: clamp(22px, 4vh, 44px) 48px; }
.result-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 26px; max-width: 900px; margin: 0 auto; }
.card { padding: clamp(18px, 3.5vw, 36px); background: linear-gradient(180deg, #4a1424, #2a0c18 70%); }
.card::selection { background: var(--gold); }
.card-top { text-align: center; margin-bottom: 18px; }
.card-kicker {
  margin: 0; font-family: var(--f-title); font-weight: 900; font-size: clamp(1.6rem, 5vw, 2.6rem); letter-spacing: .03em; color: var(--gold-hi);
  text-shadow: 3px 3px 0 var(--ink), 0 0 18px rgba(240, 213, 138, .4);
}
.card-you { margin: 6px 0 2px; font-family: var(--f-pixel); font-size: 0.78rem; letter-spacing: .2em; color: var(--ivory); }
.card-name { margin: 0; font-family: var(--f-title); font-weight: 900; font-size: clamp(1.9rem, 6vw, 3.3rem); line-height: 1.05; color: var(--ivory); text-shadow: 3px 3px 0 var(--ink); text-wrap: balance; }
.card-arch { margin: 8px 0 0; font-style: italic; font-size: clamp(1.15rem, 2.8vw, 1.5rem); color: var(--gold-hi); }
.card-body { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 24px; align-items: start; }
.portrait-box { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.portrait-frame { padding: 6px; background: var(--ink); border: var(--px) solid var(--gold); box-shadow: 0 0 0 var(--px) var(--ink), 0 0 0 calc(var(--px) * 2) var(--gold-dk); }
.portrait-frame canvas { display: block; width: 224px; height: 280px; }
.portrait-meta { text-align: center; font-size: .95rem; color: var(--muted); line-height: 1.35; }
.portrait-meta b { color: var(--ivory); font-family: var(--f-head); letter-spacing: .05em; }
.affinity {
  display: inline-flex; align-items: center; gap: 8px; font-family: var(--f-pixel); font-size: 0.78rem; color: var(--ink);
  background: linear-gradient(135deg, #f5d98a, #c9a24d); border: 2px solid var(--ink); padding: 8px 10px; box-shadow: 3px 3px 0 var(--gold-dk);
}
.card-text { min-width: 0; }
.card-fun {
  margin: 0 0 18px; padding: 18px 20px; position: relative;
  font-size: clamp(1.08rem, 2.3vw, 1.22rem); line-height: 1.5; font-style: italic;
}
.card-fun::before { content: '“'; position: absolute; left: 6px; top: -14px; font-family: var(--f-title); font-size: 3rem; color: var(--red); }
.card h3, .section-title {
  margin: 0 0 8px; font-family: var(--f-pixel); font-size: 0.76rem; letter-spacing: .14em; text-transform: uppercase; color: var(--gold);
}
.card-legacy { margin: 0 0 6px; font-size: 1.05rem; color: var(--ivory); }
.card-legacy-quote { margin: 0 0 14px; font-weight: 700; color: var(--gold-hi); font-size: 1.05rem; }
.traits { list-style: none; margin: 14px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.traits li {
  font-family: var(--f-pixel); font-size: 0.69rem; letter-spacing: .06em; text-transform: uppercase;
  padding: 7px 9px; color: var(--ivory); background: var(--purple); border: 2px solid var(--gold-dk); box-shadow: 2px 2px 0 var(--ink);
}
.stats-block { margin-top: 22px; }
.stats-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.legend { font-size: .85rem; color: var(--muted); display: flex; gap: 14px; flex-wrap: wrap; }
.legend .sw { display: inline-block; width: 12px; height: 12px; vertical-align: -1px; margin-right: 5px; border: 2px solid var(--ink); }
.legend .sw-you { background: var(--gold); }
.legend .sw-pope { background: var(--ivory); transform: rotate(45deg); width: 10px; height: 10px; }
.bars { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 26px; margin-top: 10px; }
.bar { min-width: 0; }
.bar-labels { display: flex; justify-content: space-between; gap: 8px; font-size: .9rem; line-height: 1.2; color: var(--muted); margin-bottom: 4px; }
.bar-labels .on { color: var(--gold-hi); font-weight: 700; }
.bar-labels .num { font-family: var(--f-pixel); font-size: 0.69rem; margin-left: 4px; }
.bar-track { position: relative; height: 16px; background: #170a10; border: 2px solid var(--gold-dk); box-shadow: 0 0 0 2px var(--ink); }
.bar-track::before { content: ''; position: absolute; left: 50%; top: -4px; bottom: -4px; width: 2px; margin-left: -1px; background: var(--gold-dk); }
.bar-fill { position: absolute; top: 2px; bottom: 2px; background: repeating-linear-gradient(90deg, var(--gold) 0 5px, var(--gold-hi) 5px 7px); transition: left .6s var(--ease), width .6s var(--ease); }
.bar-pope { position: absolute; top: 50%; width: 10px; height: 10px; margin: -5px 0 0 -5px; background: var(--ivory); border: 2px solid var(--ink); transform: rotate(45deg); }
.marks { margin: 12px 0 0; font-size: .95rem; color: var(--muted); }
.marks b { color: var(--ivory); }

.result-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; }
.runnerups { padding: 20px; }
.runnerups ol { list-style: none; margin: 10px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.mini-card {
  width: 100%; display: grid; grid-template-columns: 48px minmax(0, 1fr); gap: 12px; align-items: center; text-align: left; cursor: pointer;
  padding: 8px; background: rgba(255, 255, 255, .35); border: 2px solid var(--gold-dk); color: var(--ink);
  transition: transform .12s var(--ease), background .12s;
}
.mini-card:hover { transform: translateY(-2px); background: rgba(255, 255, 255, .6); }
.mini-card canvas { width: 48px; height: 60px; background: var(--ink); }
.mini-card strong { display: block; font-family: var(--f-head); font-size: .95rem; line-height: 1.15; }
.mini-card span { font-size: .85rem; color: var(--ink-soft); }
.parchment .section-title { color: var(--wine); }
.result-note { font-size: .9rem; color: var(--muted); text-align: center; margin: 0; }

/* ------------------------------------------------------------------ */
/* GALERIA                                                             */
/* ------------------------------------------------------------------ */
#screen-gallery .wrap, #screen-history .wrap { padding-block: clamp(22px, 4vh, 44px) 48px; }
.page-title { margin: 0; font-family: var(--f-title); font-weight: 900; font-size: clamp(2rem, 6vw, 3.2rem); color: var(--gold-hi); text-shadow: 3px 3px 0 var(--ink); line-height: 1.05; }
.page-lede { margin: 10px 0 0; max-width: 66ch; color: var(--ivory); }
.gal-tools { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; margin: 22px 0 10px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; flex: 1 1 220px; }
.field label { font-family: var(--f-pixel); font-size: 0.66rem; letter-spacing: .1em; color: var(--gold); text-transform: uppercase; }
.field input, .field select {
  width: 100%; min-height: 46px; padding: 10px 12px; font: inherit; font-size: 1rem; color: var(--ivory);
  background: #1f0f17; border: var(--px) solid var(--gold-dk); box-shadow: 0 0 0 2px var(--ink); border-radius: 0;
}
.field input:focus, .field select:focus { border-color: var(--gold-hi); outline: none; }
.era-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 8px; }
.era-tab { font-family: var(--f-pixel); font-size: 0.69rem; padding: 9px 10px; background: #2a1520; color: var(--ivory); border: 2px solid var(--gold-dk); cursor: pointer; box-shadow: 2px 2px 0 var(--ink); }
.era-tab[aria-selected="true"] { background: var(--gold); color: var(--ink); border-color: var(--gold-hi); }
.era-block { margin-top: 30px; }
.era-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; padding-bottom: 8px; margin-bottom: 14px; border-bottom: var(--px) double var(--gold-dk); }
.era-head h2 { margin: 0; font-family: var(--f-head); font-size: clamp(1.25rem, 3vw, 1.6rem); color: var(--ivory); letter-spacing: .04em; }
.era-head p { margin: 0; color: var(--muted); font-style: italic; }
.era-head small { font-family: var(--f-pixel); font-size: 0.63rem; color: var(--gold); }
.pope-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 16px; }
.pope-tile {
  width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; gap: 8px; cursor: pointer; text-align: center;
  padding: 12px 10px 14px; color: var(--ivory);
  background: linear-gradient(180deg, #33121f, #200b14);
  border: var(--px) solid var(--gold-dk); box-shadow: 0 0 0 2px var(--ink), 4px 4px 0 2px var(--ink);
  transition: transform .14s var(--ease), border-color .14s;
}
.pope-tile:hover, .pope-tile:focus-visible { transform: translateY(-4px); border-color: var(--gold-hi); }
.pope-tile canvas { width: 96px; height: 120px; background: var(--ink); border: 2px solid var(--gold-dk); }
.pope-tile strong { font-family: var(--f-head); font-size: 1rem; line-height: 1.15; }
.pope-tile .yrs { font-family: var(--f-pixel); font-size: 0.60rem; color: var(--gold); }
.pope-tile .arch { font-size: .88rem; font-style: italic; color: var(--muted); line-height: 1.25; }
.pope-tile.is-me { border-color: var(--gold-hi); box-shadow: 0 0 0 2px var(--ink), 0 0 0 5px var(--gold), 4px 4px 0 5px var(--ink); }
.gal-empty { padding: 30px; text-align: center; color: var(--muted); }

/* ------------------------------------------------------------------ */
/* HISTÓRICO                                                           */
/* ------------------------------------------------------------------ */
.hist-list { list-style: none; margin: 22px 0 0; padding: 0; display: grid; gap: 12px; }
.hist-item { display: grid; grid-template-columns: 56px minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 10px 14px; }
.hist-item canvas { width: 56px; height: 70px; background: var(--ink); border: 2px solid var(--gold-dk); }
.hist-item strong { font-family: var(--f-head); font-size: 1.05rem; display: block; }
.hist-item span { font-size: .9rem; color: var(--ink-soft); }
.hist-empty { padding: 28px; text-align: center; }
.hist-tools { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 20px; }

/* ------------------------------------------------------------------ */
/* Diálogos                                                            */
/* ------------------------------------------------------------------ */
dialog {
  width: min(760px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); padding: 0; overflow: visible;
  color: var(--ink); background: transparent; border: 0;
}
dialog::backdrop { background: rgba(6, 4, 10, .78); backdrop-filter: blur(2px); }
dialog[open] { animation: dlgIn .28s var(--ease); }
@keyframes dlgIn { from { opacity: 0; transform: translateY(12px) scale(.98); } }
.dlg-inner { max-height: calc(100dvh - 24px); overflow-y: auto; padding: clamp(20px, 4vw, 36px); overscroll-behavior: contain; }
.dlg-close {
  position: sticky; top: 0; float: right; margin: -8px -8px 0 12px; z-index: 3;
  width: 44px; height: 44px; display: grid; place-items: center; cursor: pointer;
  font-family: var(--f-pixel); font-size: 1.01rem; color: var(--ivory); background: var(--red); border: 2px solid var(--ink); box-shadow: 3px 3px 0 var(--gold-dk);
}
.dlg-title { margin: 0 0 6px; font-family: var(--f-title); font-weight: 900; font-size: clamp(1.6rem, 5vw, 2.4rem); line-height: 1.05; color: var(--wine); }
.dlg-sub { margin: 0 0 14px; font-style: italic; color: var(--ink-soft); }
.dlg-inner h3 { font-family: var(--f-pixel); font-size: 0.73rem; letter-spacing: .12em; text-transform: uppercase; color: var(--red); margin: 22px 0 8px; }
.dlg-inner p, .dlg-inner li { font-size: 1.05rem; }
.pope-detail-head { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 20px; align-items: start; }
.pope-detail-head canvas.portrait { width: 144px; height: 180px; background: var(--ink); border: var(--px) solid var(--gold); box-shadow: 0 0 0 2px var(--ink); }
.pope-detail-head .sym { width: 48px; height: 48px; float: right; margin-left: 10px; }
.era-pill { display: inline-block; font-family: var(--f-pixel); font-size: 0.63rem; padding: 6px 8px; color: var(--ivory); background: var(--blue); border: 2px solid var(--ink); margin-bottom: 8px; }
.legacy-quote { margin: 8px 0 0; padding-left: 12px; border-left: 4px solid var(--red); font-weight: 700; }
.dlg-inner .traits li { background: var(--wine); }
.dlg-bars .bar-labels { color: var(--ink-soft); }
.dlg-bars .bar-labels .on { color: var(--wine); }
.dlg-bars .bar-track { background: #e8d9b2; border-color: var(--gold-dk); }
.dlg-bars .bar-fill { background: repeating-linear-gradient(90deg, var(--red) 0 5px, var(--red-hi) 5px 7px); }
.dlg-bars .bar-you { position: absolute; top: -6px; width: 0; height: 0; margin-left: -6px; border: 6px solid transparent; border-top-color: var(--blue); }
.refs { margin: 0; padding-left: 1.2em; font-size: .95rem; }
.refs li { font-size: .95rem; margin-bottom: 4px; }
.dlg-nav { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-top: 24px; }
.fun-box { padding: 14px 16px; background: rgba(139, 32, 39, .08); border: 2px dashed var(--gold-dk); font-style: italic; }
.share-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-top: 12px; }
.share-grid a, .share-grid button { width: 100%; }
.share-text { width: 100%; min-height: 110px; padding: 10px; font: inherit; font-size: .95rem; color: var(--ink); background: #fff8e6; border: 2px solid var(--gold-dk); resize: vertical; }
.png-preview { display: block; width: 100%; max-width: 420px; margin: 12px auto 0; border: var(--px) solid var(--gold); box-shadow: 0 0 0 2px var(--ink); }
.dlg-note { font-size: .92rem; color: var(--ink-soft); }
.dims-list { margin: 8px 0 0; padding-left: 1.2em; }
.dims-list li { margin-bottom: 2px; }

/* ------------------------------------------------------------------ */
/* Rodapé, anúncios e avisos                                           */
/* ------------------------------------------------------------------ */
.site-footer {
  padding-block: 26px 34px; padding-left: var(--gutter); padding-right: var(--gutter-r);
  text-align: center; font-size: .9rem; color: var(--muted);
  border-top: var(--px) solid var(--gold-dk); background: #0d070b;
}
.site-footer p { margin: 6px auto; max-width: 70ch; }
.site-footer .link-btn { font-size: 0.69rem; }
.ad-slot {
  display: flex; align-items: center; justify-content: center; margin: 26px auto; max-width: 728px; min-height: 90px;
  font-family: var(--f-pixel); font-size: 0.63rem; letter-spacing: .1em; color: var(--muted);
  border: 2px dashed rgba(201, 162, 77, .35); background: rgba(0, 0, 0, .2);
}
.ad-slot--wide { max-width: 970px; }
.ad-slot--live { display: block; min-height: 0; border: 0; background: none; }
.toast {
  position: fixed; left: 50%; bottom: calc(22px + env(safe-area-inset-bottom, 0px)); z-index: 90; transform: translate(-50%, 140%);
  max-width: calc(100vw - 32px); padding: 12px 16px;
  font-family: var(--f-pixel); font-size: 0.76rem; line-height: 1.6; color: var(--ink);
  background: linear-gradient(135deg, #f5d98a, #c9a24d); border: var(--px) solid var(--ink); box-shadow: 4px 4px 0 var(--wine);
  transition: transform .3s var(--ease), visibility .3s;
  visibility: hidden;
}
.toast.show { transform: translate(-50%, 0); visibility: visible; }

/* ------------------------------------------------------------------ */
/* Responsivo                                                          */
/* ------------------------------------------------------------------ */
@media (max-width: 860px) {
  .quiz-layout { grid-template-columns: minmax(0, 1fr); }
  .quiz-side {
    position: static; flex-direction: row; justify-content: space-between; text-align: left; gap: 12px; padding: 10px 12px;
  }
  .rose { width: 84px; height: 84px; flex: none; }
  .quiz-side .progress-wrap { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
  .progress-label b { font-size: 1.25rem; }
  .mini-pope { width: 50px; height: 65px; flex: none; }
  .pope-says { display: none; }
  .card-body { grid-template-columns: minmax(0, 1fr); }
  .portrait-box { order: -1; }
}
@media (max-width: 620px) {
  body { font-size: 1.05rem; }
  .brand .brand-text { display: none; }
  .chip-btn { padding: 8px; font-size: 0.66rem; }
  .chip-btn .lbl { display: none; }
  .chip-btn .ico { margin-right: 0; }
  .bars { grid-template-columns: minmax(0, 1fr); }
  .pope-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .pope-tile canvas { width: 80px; height: 100px; }
  .pope-detail-head { grid-template-columns: 96px minmax(0, 1fr); gap: 14px; }
  .pope-detail-head canvas.portrait { width: 96px; height: 120px; }
  .hist-item { grid-template-columns: 48px minmax(0, 1fr); }
  .hist-item canvas { width: 48px; height: 60px; }
  .hist-item .hist-aff { grid-column: 2; }
  .answer { padding: 10px 12px 10px 10px; gap: 12px; }
  .answer .key { width: 32px; height: 32px; }
  .frame::before, .frame::after, .frame > .corner-tr, .frame > .corner-bl { width: 30px; height: 30px; background-size: 30px 30px; }
}

/* ------------------------------------------------------------------ */
/* Movimento reduzido                                                  */
/* ------------------------------------------------------------------ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
  .title span { animation: none; background-position: 30% 0; }
  .reveal-title { opacity: 1; transform: none; }
}

