:root {
  --bg: #0b0614;
  --bg2: #1a0b2e;
  --purple: #6b2fb3;
  --orange: #ff7518;
  --orange-2: #ffb347;
  --green: #7cff6b;
  --blood: #b3001b;
  --text: #f3e9ff;
  --muted: #b9a6d6;
  --paper: #e9dcb8;
  --paper-dark: #b89f6a;
  --ink: #2a1a0a;
  --radius: 16px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: 'Nunito', system-ui, sans-serif;
  overflow-x: hidden;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  background:
    radial-gradient(ellipse at 50% 120%, #3a1460 0%, transparent 60%),
    radial-gradient(ellipse at 80% -10%, #2b0f45 0%, transparent 55%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg2) 100%);
}

/* ====================== CENÁRIO ====================== */
.scene { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 0; }

.moon {
  position: absolute; top: 4vh; right: 6vw;
  width: 90px; height: 90px; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fff8d6, #f5d77a 55%, #d9a94a);
  box-shadow: 0 0 60px 20px rgba(255, 220, 120, .35), 0 0 140px 60px rgba(255, 140, 40, .12);
  animation: moonGlow 6s ease-in-out infinite;
}
.moon::after {
  content: ''; position: absolute; inset: 0; border-radius: 50%;
  background: radial-gradient(circle at 65% 60%, rgba(160, 120, 40, .35) 0 8px, transparent 9px),
              radial-gradient(circle at 40% 70%, rgba(160, 120, 40, .3) 0 5px, transparent 6px),
              radial-gradient(circle at 55% 30%, rgba(160, 120, 40, .25) 0 6px, transparent 7px);
}
@keyframes moonGlow { 50% { box-shadow: 0 0 80px 30px rgba(255, 220, 120, .45), 0 0 160px 80px rgba(255, 140, 40, .15); } }

.stars {
  position: absolute; inset: 0;
  background-image:
    radial-gradient(1px 1px at 10% 20%, #fff, transparent),
    radial-gradient(1px 1px at 30% 8%, #fff, transparent),
    radial-gradient(1.5px 1.5px at 55% 15%, #fff, transparent),
    radial-gradient(1px 1px at 70% 35%, #fff, transparent),
    radial-gradient(1px 1px at 20% 45%, #fff, transparent),
    radial-gradient(1.5px 1.5px at 85% 55%, #fff, transparent),
    radial-gradient(1px 1px at 45% 60%, #fff, transparent);
  opacity: .6;
  animation: twinkle 4s ease-in-out infinite alternate;
}
@keyframes twinkle { to { opacity: .25; } }

.bats span {
  position: absolute; font-size: 28px; left: -60px;
  animation: batFly 14s linear infinite;
  filter: drop-shadow(0 0 4px #000);
}
.bats span:nth-child(1) { top: 12%; animation-delay: 0s; }
.bats span:nth-child(2) { top: 22%; animation-delay: 4s; font-size: 20px; animation-duration: 11s; }
.bats span:nth-child(3) { top: 8%; animation-delay: 7s; font-size: 34px; animation-duration: 16s; }
.bats span:nth-child(4) { top: 30%; animation-delay: 10s; font-size: 18px; animation-duration: 9s; }
@keyframes batFly {
  0%   { transform: translate(0, 0) scaleX(-1); }
  25%  { transform: translate(30vw, -30px) scaleX(-1) rotate(-10deg); }
  50%  { transform: translate(60vw, 20px) scaleX(-1); }
  75%  { transform: translate(90vw, -20px) scaleX(-1) rotate(10deg); }
  100% { transform: translate(120vw, 0) scaleX(-1); }
}

.ghost-float { position: absolute; font-size: 40px; opacity: .18; animation: ghostDrift 12s ease-in-out infinite; }
.ghost-float.g1 { left: 6%; top: 55%; }
.ghost-float.g2 { right: 8%; top: 70%; font-size: 30px; animation-delay: -6s; }
@keyframes ghostDrift {
  0%, 100% { transform: translate(0, 0); opacity: .12; }
  50% { transform: translate(20px, -40px); opacity: .3; }
}

.spider { position: absolute; top: 0; left: 14%; animation: spiderDrop 9s ease-in-out infinite; }
.spider::before { content: ''; position: absolute; left: 50%; bottom: 100%; width: 1px; height: 100vh; background: rgba(255,255,255,.35); }
.spider span { display: block; font-size: 24px; }
@keyframes spiderDrop {
  0%, 100% { transform: translateY(-40px); }
  40%, 60% { transform: translateY(18vh); }
}

.fog {
  position: absolute; left: -50%; width: 200%; height: 40vh; bottom: -5vh;
  background: radial-gradient(ellipse at center, rgba(200, 180, 255, .14) 0%, transparent 65%);
  filter: blur(10px);
  animation: fogMove 30s linear infinite;
}
.fog.f2 { bottom: -12vh; animation-duration: 45s; animation-direction: reverse; opacity: .7; }
@keyframes fogMove { from { transform: translateX(-10%); } to { transform: translateX(10%); } }

.graves {
  position: absolute; bottom: 4px; left: 0; right: 0; text-align: center;
  font-size: 30px; letter-spacing: 6vw; opacity: .25; filter: saturate(.6);
}

.lightning { position: fixed; inset: 0; background: #e8e0ff; opacity: 0; pointer-events: none; z-index: 50; }
.lightning.flash { animation: flash .9s ease-out; }
@keyframes flash { 0% { opacity: .9; } 10% { opacity: 0; } 20% { opacity: .6; } 30%, 100% { opacity: 0; } }

.mute-btn {
  position: fixed; top: max(12px, env(safe-area-inset-top)); left: 12px; z-index: 60;
  width: 44px; height: 44px; border-radius: 50%; border: 1px solid rgba(255,255,255,.15);
  background: rgba(20, 8, 35, .7); color: #fff; font-size: 20px; cursor: pointer;
  backdrop-filter: blur(6px);
}

/* ====================== LAYOUT ====================== */
.app {
  position: relative; z-index: 1;
  max-width: 520px; margin: 0 auto;
  padding: calc(64px + env(safe-area-inset-top)) 18px calc(70px + env(safe-area-inset-bottom));
  min-height: 100vh; min-height: 100dvh;
}

.screen { display: none; flex-direction: column; align-items: center; text-align: center; gap: 14px; }
.screen.active { display: flex; animation: screenIn .6s cubic-bezier(.2, .9, .3, 1.2); }
@keyframes screenIn { from { opacity: 0; transform: translateY(30px) scale(.96); } to { opacity: 1; transform: none; } }

.creepy {
  font-family: 'Creepster', cursive; font-weight: 400;
  font-size: clamp(34px, 10vw, 52px); line-height: 1.05; margin: 4px 0;
  color: var(--orange);
  text-shadow: 0 0 12px rgba(255, 117, 24, .6), 0 4px 0 #5a1e00;
  letter-spacing: 1px;
}
.muted { color: var(--muted); margin: 0; font-size: 16px; line-height: 1.4; }
.tiny { color: var(--muted); font-size: 13px; margin: 4px 0 0; opacity: .85; line-height: 1.4; }
.big-emoji { font-size: 84px; filter: drop-shadow(0 0 20px rgba(255, 117, 24, .5)); animation: bob 3s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-10px) rotate(4deg); } }
.hidden { display: none !important; }

.flicker { animation: flickerAnim 3s infinite; }
@keyframes flickerAnim { 0%, 19%, 21%, 23%, 54%, 56%, 100% { opacity: 1; } 20%, 22%, 55% { opacity: .2; } }

.pumpkin-loader { font-size: 72px; margin-top: 30vh; animation: spin 1.6s cubic-bezier(.6, 0, .4, 1) infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ====================== CARTAZ ====================== */
.poster {
  position: relative; width: 100%;
  padding: 22px 18px 18px;
  color: var(--ink);
  background:
    radial-gradient(circle at 15% 10%, rgba(120, 80, 20, .25), transparent 30%),
    radial-gradient(circle at 90% 85%, rgba(120, 80, 20, .3), transparent 35%),
    radial-gradient(circle at 70% 20%, rgba(255, 255, 255, .3), transparent 40%),
    linear-gradient(180deg, var(--paper), #d9c896);
  border-radius: 4px;
  box-shadow: 0 20px 40px rgba(0,0,0,.6), inset 0 0 50px rgba(90, 60, 10, .45);
  transform: rotate(-1.5deg);
  animation: posterSwing 5s ease-in-out infinite;
  transform-origin: top center;
  font-family: 'Special Elite', monospace;
}
.poster::after { /* borda rasgada */
  content: ''; position: absolute; left: 0; right: 0; bottom: -10px; height: 12px;
  background: linear-gradient(135deg, #d9c896 33%, transparent 33%) 0 0 / 14px 12px,
              linear-gradient(225deg, #d9c896 33%, transparent 33%) 0 0 / 14px 12px;
}
@keyframes posterSwing { 0%, 100% { transform: rotate(-1.5deg); } 50% { transform: rotate(1deg); } }

.pin { position: absolute; top: 8px; width: 14px; height: 14px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #ff6b6b, #8b0000); box-shadow: 0 2px 3px rgba(0,0,0,.5); }
.pin-l { left: 12px; } .pin-r { right: 12px; }

.poster-title {
  font-family: 'Creepster', cursive; font-weight: 400;
  font-size: clamp(38px, 12vw, 58px); margin: 0 0 10px; letter-spacing: 2px;
  color: var(--blood);
  text-shadow: 2px 2px 0 rgba(0,0,0,.25);
}

.photo-frame {
  position: relative; width: min(70vw, 260px); aspect-ratio: 1; margin: 0 auto;
  border: 6px solid #2a1a0a; background: #222; overflow: hidden;
  box-shadow: 0 6px 12px rgba(0,0,0,.4);
}
.photo-frame img {
  width: 100%; height: 100%; object-fit: cover;
  filter: grayscale(.85) sepia(.4) contrast(1.15) brightness(.95);
  animation: photoFlicker 6s infinite;
}
@keyframes photoFlicker {
  0%, 92%, 100% { filter: grayscale(.85) sepia(.4) contrast(1.15) brightness(.95); transform: none; }
  93% { filter: grayscale(1) contrast(2) brightness(.4) hue-rotate(90deg); transform: translateX(-3px) skewX(4deg); }
  95% { filter: grayscale(.2) sepia(0) contrast(1.4) brightness(1.2) saturate(2) hue-rotate(-40deg); transform: translateX(3px); }
}
.photo-scratch {
  position: absolute; inset: 0; pointer-events: none;
  background:
    repeating-linear-gradient(0deg, rgba(0,0,0,.08) 0 2px, transparent 2px 4px),
    radial-gradient(ellipse at center, transparent 50%, rgba(0,0,0,.6) 100%);
}

.poster-name { font-family: 'Creepster', cursive; font-weight: 400; font-size: clamp(30px, 9vw, 44px); margin: 12px 0 4px; letter-spacing: 1px; }
.poster-text { margin: 4px 0; font-size: 15px; line-height: 1.4; }
.poster-reward { margin: 8px 0 0; font-size: 14px; font-weight: bold; color: var(--blood); }
.poster-reward:empty { display: none; }

/* ====================== FORM / BOTÕES ====================== */
.start-form { width: 100%; display: flex; flex-direction: column; gap: 12px; margin-top: 14px; }
.start-form label { font-size: 17px; font-weight: 800; color: var(--orange-2); }
.start-form input {
  width: 100%; padding: 16px 18px; font-size: 18px; font-family: inherit; font-weight: 700;
  color: var(--text); background: rgba(20, 8, 35, .8);
  border: 2px solid rgba(255, 117, 24, .4); border-radius: var(--radius); outline: none;
  transition: border-color .2s, box-shadow .2s; text-align: center;
}
.start-form input:focus { border-color: var(--orange); box-shadow: 0 0 0 4px rgba(255, 117, 24, .2), 0 0 20px rgba(255, 117, 24, .3); }
.start-form input.shake { animation: shake .4s; border-color: var(--blood); }

.btn {
  position: relative; width: 100%; padding: 17px 20px; font-size: 20px; font-weight: 800; font-family: inherit;
  border: none; border-radius: var(--radius); cursor: pointer; overflow: hidden;
  transition: transform .15s;
}
.btn:active { transform: scale(.96); }
.btn:disabled { opacity: .6; }
.btn-primary {
  color: #1a0700;
  background: linear-gradient(180deg, var(--orange-2), var(--orange) 60%, #d45500);
  box-shadow: 0 6px 0 #7a2e00, 0 10px 30px rgba(255, 117, 24, .45);
  animation: pulseGlow 2s ease-in-out infinite;
}
.btn-primary::after {
  content: ''; position: absolute; top: 0; left: -60%; width: 40%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.5), transparent);
  transform: skewX(-20deg); animation: shine 3s infinite;
}
@keyframes shine { 0%, 60% { left: -60%; } 100% { left: 130%; } }
@keyframes pulseGlow { 50% { box-shadow: 0 6px 0 #7a2e00, 0 10px 45px rgba(255, 117, 24, .75); } }

/* ====================== QUIZ ====================== */
.quiz-head { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.progress { display: flex; gap: 6px; flex-wrap: wrap; }
.progress .dot {
  width: 30px; height: 30px; display: grid; place-items: center; font-size: 18px;
  border-radius: 50%; background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.12);
  transition: transform .3s;
}
.progress .dot.current { transform: scale(1.2); border-color: var(--orange); box-shadow: 0 0 12px rgba(255,117,24,.6); }

.timer { position: relative; width: 52px; height: 52px; flex-shrink: 0; }
.timer svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.timer circle { fill: none; stroke-width: 4; }
.timer .t-bg { stroke: rgba(255,255,255,.1); }
.timer .t-fg { stroke: var(--green); stroke-linecap: round; stroke-dasharray: 119.4; transition: stroke-dashoffset 1s linear, stroke .3s; }
.timer.warn .t-fg { stroke: var(--orange); }
.timer.danger .t-fg { stroke: var(--blood); }
.timer.danger { animation: heartbeat .6s infinite; }
.timer span { position: absolute; inset: 0; display: grid; place-items: center; font-weight: 800; font-size: 18px; }
@keyframes heartbeat { 0%, 100% { transform: scale(1); } 15% { transform: scale(1.18); } 30% { transform: scale(1); } 45% { transform: scale(1.12); } }

.question-card {
  width: 100%; padding: 22px 18px; border-radius: 20px;
  background: linear-gradient(160deg, rgba(107, 47, 179, .35), rgba(20, 8, 35, .85));
  border: 1px solid rgba(180, 120, 255, .3);
  box-shadow: 0 10px 30px rgba(0,0,0,.5), inset 0 0 30px rgba(107, 47, 179, .25);
}
.question-card.enter { animation: cardIn .5s cubic-bezier(.2, .9, .3, 1.3); }
@keyframes cardIn { from { opacity: 0; transform: rotateX(70deg) translateY(-20px); } to { opacity: 1; transform: none; } }
.q-count { margin: 0 0 6px; color: var(--orange-2); font-size: 14px; font-weight: 800; letter-spacing: 2px; text-transform: uppercase; }
.q-text { margin: 0; font-size: clamp(20px, 6vw, 26px); line-height: 1.3; }

.options { width: 100%; display: flex; flex-direction: column; gap: 12px; }
.option {
  position: relative; width: 100%; padding: 16px 18px 16px 58px; text-align: left;
  font-family: inherit; font-size: 18px; font-weight: 700; color: var(--text);
  background: rgba(30, 14, 50, .85); border: 2px solid rgba(255,255,255,.1); border-radius: var(--radius);
  cursor: pointer; transition: transform .15s, border-color .2s, background .2s;
  opacity: 0; animation: optIn .45s forwards;
}
.option .letter {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
  background: rgba(255, 117, 24, .18); color: var(--orange-2); font-weight: 800;
}
@keyframes optIn { from { opacity: 0; transform: translateX(-30px); } to { opacity: 1; transform: none; } }
.option:active:not(:disabled) { transform: scale(.97); }
@media (hover: hover) { .option:hover:not(:disabled) { border-color: var(--orange); background: rgba(60, 25, 90, .9); } }
.option:disabled { cursor: default; }
.option.correct { border-color: var(--green); background: rgba(40, 120, 40, .45); box-shadow: 0 0 20px rgba(124, 255, 107, .4); animation: pop .4s; opacity: 1; }
.option.correct .letter { background: var(--green); color: #052; }
.option.wrong { border-color: var(--blood); background: rgba(150, 0, 20, .45); animation: shake .45s; opacity: 1; }
.option.wrong .letter { background: var(--blood); color: #fff; }
.option.dim { opacity: .4 !important; }
@keyframes pop { 50% { transform: scale(1.04); } }
@keyframes shake { 0%, 100% { transform: translateX(0); } 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }

.screen-shake { animation: shake .45s; }

/* ====================== RESULTADO ====================== */
.result-title.win { color: var(--green); text-shadow: 0 0 14px rgba(124, 255, 107, .6), 0 4px 0 #0c4a00; }
.result-title.lose { color: #ff3040; text-shadow: 0 0 14px rgba(255, 0, 30, .6), 0 4px 0 #400; animation: flickerAnim 2.5s infinite; }
.result-score { margin: 0; font-size: 22px; font-weight: 800; }

.roulette { width: 100%; }
.roulette-label { margin: 0 0 10px; color: var(--orange-2); font-weight: 800; }
.roulette-window {
  width: 100%; min-height: 84px; display: grid; place-items: center; padding: 12px;
  border-radius: var(--radius); border: 2px dashed var(--orange);
  background: rgba(20, 8, 35, .85); box-shadow: inset 0 0 25px rgba(255, 117, 24, .25);
}
.roulette-item { font-size: 18px; font-weight: 800; }
.roulette-item.blur { filter: blur(1px); }

.prenda-card {
  width: 100%; padding: 22px 18px; border-radius: 20px;
  background: linear-gradient(160deg, #5a0010, #1a0006);
  border: 2px solid #ff3040;
  box-shadow: 0 0 30px rgba(255, 0, 40, .45);
  animation: prendaIn .8s cubic-bezier(.2, .9, .3, 1.4);
  position: relative; overflow: hidden;
}
.prenda-card::before { /* sangue escorrendo */
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 26px;
  background:
    radial-gradient(circle at 10% 0, #b3001b 0 14px, transparent 15px),
    radial-gradient(circle at 30% 0, #b3001b 0 9px, transparent 10px),
    radial-gradient(circle at 55% 0, #b3001b 0 16px, transparent 17px),
    radial-gradient(circle at 80% 0, #b3001b 0 11px, transparent 12px);
  animation: drip 2.5s ease-in forwards;
}
@keyframes drip { from { height: 0; } to { height: 26px; } }
@keyframes prendaIn { from { opacity: 0; transform: scale(.4) rotate(-8deg); } to { opacity: 1; transform: none; } }
.prenda-label { margin: 14px 0 6px; font-family: 'Creepster', cursive; font-size: 24px; letter-spacing: 3px; color: #ff8090; }
.prenda-text { margin: 0; font-size: 22px; font-weight: 800; line-height: 1.35; }

.review { width: 100%; display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }
.review-item {
  text-align: left; padding: 12px 14px; border-radius: 12px; font-size: 15px; line-height: 1.4;
  background: rgba(255,255,255,.05); border-left: 4px solid var(--green);
  opacity: 0; animation: optIn .4s forwards;
}
.review-item.bad { border-left-color: var(--blood); }
.review-item b { display: block; margin-bottom: 2px; }
.review-item small { color: var(--muted); }

.locked-result { width: 100%; }
.locked-result:empty { display: none; }
.locked-result .box { padding: 14px; border-radius: 14px; background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.12); line-height: 1.5; }

/* ====================== EFEITOS ====================== */
.fx-layer { position: fixed; inset: 0; pointer-events: none; z-index: 40; overflow: hidden; }
.fx-particle { position: absolute; top: -40px; font-size: 26px; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(110vh) rotate(720deg); } }

.fx-jump {
  position: fixed; inset: 0; display: grid; place-items: center; z-index: 45; pointer-events: none;
  font-size: 60vw; animation: jump 0.9s ease-out forwards;
}
@keyframes jump {
  0% { transform: scale(.2); opacity: 0; }
  20% { transform: scale(1.1); opacity: 1; }
  60% { transform: scale(1); opacity: 1; }
  100% { transform: scale(1.6); opacity: 0; }
}

.blood-vignette { position: fixed; inset: 0; pointer-events: none; z-index: 44; box-shadow: inset 0 0 120px 40px rgba(180, 0, 20, .8); animation: vignette 0.8s ease-out forwards; }
@keyframes vignette { from { opacity: 1; } to { opacity: 0; } }

@media (min-width: 700px) {
  .moon { width: 130px; height: 130px; }
  .app { padding-top: 80px; }
}

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

/* ====================== SORTEIO (página do jogador) ====================== */
.btn-ghost {
  display: block; text-align: center; text-decoration: none;
  color: var(--text); background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.18); font-size: 17px; margin-top: 10px;
}
.live-hint:empty { display: none; }
#screen-info .live-hint::before { content: '⏳ '; }

.drawn-label { margin: 0; font-size: 15px; font-weight: 800; letter-spacing: 2px; text-transform: uppercase; color: var(--orange-2); }
.drawn-player {
  display: flex; align-items: center; justify-content: center; gap: 14px;
  padding: 12px 16px; border-radius: var(--radius);
  background: rgba(20, 8, 35, .85); border: 2px solid rgba(255, 117, 24, .45);
  box-shadow: 0 0 24px rgba(255, 117, 24, .25);
  animation: pop .6s;
}
.drawn-player img { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; border: 2px solid var(--orange); }
.drawn-player span { font-family: 'Creepster', cursive; font-size: clamp(28px, 9vw, 38px); color: var(--orange); letter-spacing: 1px; }
