/* Visual de jogo de cartas impresso: papel creme, contorno de tinta, sombra dura, cores chapadas.
   Sem degradês, sem desfoque, sem brilho. */
:root {
  --bg: #f3ecd9;
  --bg2: #fffaf0;
  --card: #fffaf0;
  --card2: #ffffff;
  --ink: #17120b;
  --line: #17120b;
  --text: #17120b;
  --muted: #6b6254;
  --gold: #ffd23f;
  --red: #ff5a36;
  --pink: #ff5a36;
  --blue: #2b59ff;
  --green: #19a974;
  --teal: #19a974;
  --danger: #d63a14;
  --radius: 10px;
  --gut: 16px;
  --shadow: 0 4px 0 var(--ink);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html { color-scheme: light; }
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--ink);
  font: 17px/1.4 system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  overflow-x: hidden;
}
#app { max-width: 560px; margin: 0 auto; padding: calc(var(--gut) + env(safe-area-inset-top)) var(--gut) calc(var(--gut) + 56px + env(safe-area-inset-bottom)); min-height: 100dvh; display: flex; flex-direction: column; gap: 14px; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 2.1rem; line-height: 1.05; font-weight: 900; letter-spacing: -0.02em; }
h2 { font-size: 1.35rem; font-weight: 900; letter-spacing: -0.01em; }
h3 { color: var(--ink); text-transform: uppercase; letter-spacing: 0.08em; font-size: 0.78rem; font-weight: 900; }
.muted { color: var(--muted); }
.center { text-align: center; }
.small { font-size: 0.85rem; }
a { color: var(--ink); font-weight: 800; }
:focus-visible { outline: 4px solid var(--blue); outline-offset: 2px; }

/* ---- cartões e botões ---- */
.card { background: var(--card); border: 3px solid var(--ink); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 12px; box-shadow: var(--shadow); }
.card.flat { background: transparent; border-style: dashed; box-shadow: none; }
.row { display: flex; gap: 10px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

button, .btn {
  font: inherit; font-weight: 900; color: var(--ink); background: var(--gold); border: 3px solid var(--ink); border-radius: var(--radius);
  padding: 12px 18px; min-height: 52px; cursor: pointer; text-align: center; touch-action: manipulation;
  box-shadow: var(--shadow); transition: transform 0.06s, box-shadow 0.06s, opacity 0.2s;
}
button:active { transform: translateY(4px); box-shadow: 0 0 0 var(--ink); }
button:disabled { opacity: 0.4; cursor: not-allowed; box-shadow: none; transform: none; }
button.pink { background: var(--red); color: #fff; }
button.teal { background: var(--green); color: #fff; }
button.ghost { background: var(--bg2); color: var(--ink); }
button.small { min-height: 38px; padding: 4px 12px; font-size: 0.85rem; border-width: 2px; box-shadow: 0 2px 0 var(--ink); }
button.small:active { transform: translateY(2px); box-shadow: none; }
button.danger { background: var(--red); color: #fff; }
button.big { min-height: 64px; font-size: 1.2rem; }

input, textarea, select {
  font: inherit; color: var(--ink); background: #fff; border: 3px solid var(--ink); border-radius: var(--radius);
  padding: 12px 14px; width: 100%; min-height: 52px;
}
::placeholder { color: #9a917f; }
textarea { resize: none; min-height: 110px; font-size: 1.15rem; }
input:focus, textarea:focus, select:focus { outline: 4px solid var(--blue); outline-offset: 0; }
input.code { text-transform: uppercase; letter-spacing: 0.4em; text-align: center; font-weight: 900; font-size: 1.5rem; }
label.field { display: flex; flex-direction: column; gap: 6px; }
label.field > span { font-size: 0.8rem; color: var(--ink); font-weight: 900; text-transform: uppercase; letter-spacing: 0.06em; }

.seg { display: flex; background: #fff; border: 3px solid var(--ink); border-radius: var(--radius); overflow: hidden; }
.seg button { flex: 1; background: transparent; color: var(--ink); border: 0; border-radius: 0; box-shadow: none; min-height: 46px; padding: 8px 6px; font-size: 0.92rem; }
.seg button + button { border-left: 3px solid var(--ink); }
.seg button.on { background: var(--ink); color: var(--bg); }
.seg button:active { transform: none; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; gap: 6px; align-items: center; padding: 5px 12px; border-radius: 999px; background: #fff; border: 2px solid var(--ink); font-weight: 800; font-size: 0.9rem; }
.chip.done { background: var(--green); color: #fff; }
.chip.off { opacity: 0.45; border-style: dashed; }
button.chip { min-height: 38px; box-shadow: none; color: var(--ink); background: #fff; padding: 5px 12px; border-width: 2px; }
button.chip.on { background: var(--ink); color: var(--bg); }
.badge { background: var(--red); color: #fff; border-radius: 999px; padding: 2px 10px; font-weight: 900; font-size: 0.8rem; }

/* ---- topo ---- */
.top { display: flex; align-items: center; gap: 10px; justify-content: space-between; min-height: 40px; }
.top .pill { white-space: nowrap; background: #fff; border: 2px solid var(--ink); padding: 3px 12px; border-radius: 999px; font-weight: 900; font-size: 0.88rem; }
.top .pill.code { letter-spacing: 0.2em; background: var(--gold); }
.timer { font-variant-numeric: tabular-nums; font-weight: 900; color: var(--ink); white-space: nowrap; flex: none; background: #fff; border: 2px solid var(--ink); border-radius: 999px; padding: 3px 12px; }
.timer:empty { display: none; }
.timer.low { background: var(--red); color: #fff; animation: pulse 0.6s infinite alternate; }
.icon-btn { background: var(--bg2); border: 2px solid var(--ink); color: var(--ink); min-height: 40px; width: 40px; padding: 0; border-radius: var(--radius); box-shadow: 0 2px 0 var(--ink); font-size: 1.1rem; }

/* ---- home ---- */
.logo { font-size: 3.1rem; font-weight: 900; line-height: 0.95; letter-spacing: -0.04em; text-shadow: 3px 3px 0 var(--gold); transform: rotate(-2deg); transform-origin: left bottom; }
.hero { padding-top: 5vh; display: flex; flex-direction: column; gap: 12px; }

/* ---- pergunta e resposta ---- */
.question { background: var(--blue); color: #fff; border: 3px solid var(--ink); border-radius: var(--radius); padding: 22px 18px; font-size: 1.5rem; line-height: 1.2; font-weight: 900; text-align: center; box-shadow: 6px 6px 0 var(--ink); }
.question small { display: block; font-size: 0.8rem; font-weight: 700; opacity: 0.92; margin-top: 8px; }
.answer-card { background: #fff; color: var(--ink); border: 3px solid var(--ink); border-radius: var(--radius); padding: 26px 18px; font-size: 1.7rem; line-height: 1.2; font-weight: 900; text-align: center; word-break: break-word; box-shadow: 6px 6px 0 var(--ink); transform: rotate(-1deg); animation: pop 0.35s ease-out; }
.counter { font-size: 0.8rem; color: var(--muted); text-align: right; }

/* ---- votação ---- */
.cands { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.cands button { background: #fff; color: var(--ink); font-size: 1.05rem; min-height: 60px; word-break: break-word; }
.cands button.on { background: var(--green); color: #fff; }
.reveal-author { text-align: center; font-size: 2rem; font-weight: 900; animation: popflat 0.5s ease-out; line-height: 1.15; }
.reveal-author b { background: var(--gold); padding: 0 8px; border: 3px solid var(--ink); border-radius: 6px; display: inline-block; transform: rotate(-1.5deg); }
.vote-line { display: flex; justify-content: space-between; gap: 8px; padding: 8px 12px; border-radius: 8px; background: #fff; border: 2px solid var(--ink); font-weight: 800; }
.vote-line.ok { border-left: 10px solid var(--green); }
.vote-line.no { border-left: 10px solid var(--red); opacity: 0.85; }
.pts { color: var(--danger); font-weight: 900; }

/* ---- tier list ---- */
.tier { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; touch-action: pan-y; }
.tier li { display: flex; align-items: stretch; background: #fff; border: 3px solid var(--ink); border-radius: var(--radius); overflow: hidden; min-height: 58px; position: relative; transition: transform 0.12s; }
.tier li .rank { width: 46px; flex: none; display: grid; place-items: center; font-weight: 900; font-size: 1.2rem; color: var(--ink); background: var(--c, var(--gold)); border-right: 3px solid var(--ink); }
.tier li .txt { flex: 1; padding: 10px 12px; display: flex; align-items: center; word-break: break-word; font-weight: 800; }
.tier li .ctl { display: flex; flex-direction: column; justify-content: center; }
.tier li .ctl button { min-height: 28px; padding: 0 10px; font-size: 0.8rem; background: transparent; color: var(--ink); box-shadow: none; border: 0; border-radius: 0; }
.tier li .ctl button:disabled { opacity: 0.2; }
.tier li .grip { width: 44px; flex: none; display: grid; place-items: center; color: var(--ink); font-size: 1.4rem; touch-action: none; cursor: grab; user-select: none; border-left: 2px dashed var(--ink); }
.tier li.drag { transform: scale(1.03) rotate(-1deg); box-shadow: 6px 6px 0 var(--ink); z-index: 5; transition: none; }
.tier.locked li { opacity: 0.75; }
.mine { padding: 10px 12px; border: 2px dashed var(--ink); border-radius: var(--radius); color: var(--muted); font-size: 0.9rem; }

.result-row { display: flex; align-items: stretch; border: 3px solid var(--ink); border-radius: var(--radius); overflow: hidden; background: #fff; animation: slidein 0.5s ease-out both; }
.result-row .pos { width: 52px; display: grid; place-items: center; font-weight: 900; font-size: 1.4rem; color: var(--ink); background: var(--c, var(--gold)); border-right: 3px solid var(--ink); }
.result-row .body { flex: 1; padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; font-weight: 800; }
.result-row .who { font-size: 0.82rem; color: var(--muted); font-weight: 700; }
.result-row .p { padding: 0 14px; display: grid; place-items: center; font-weight: 900; color: var(--danger); font-size: 1.2rem; }
.result-row.first { background: var(--gold); box-shadow: 6px 6px 0 var(--ink); }
.result-row.first .who { color: var(--ink); }
.result-row.first .body { font-size: 1.15rem; }

/* ---- placar e pódio ---- */
.score { display: flex; align-items: center; gap: 10px; background: #fff; border: 2px solid var(--ink); border-radius: var(--radius); padding: 10px 14px; font-weight: 800; }
.score .n { width: 28px; color: var(--muted); }
.score .nm { flex: 1; word-break: break-word; }
.score .delta { color: var(--green); font-size: 0.9rem; font-weight: 900; }
.score .tot { font-size: 1.25rem; font-variant-numeric: tabular-nums; font-weight: 900; }
.score.me { background: var(--gold); border-width: 3px; }
.podium { display: flex; align-items: flex-end; justify-content: center; gap: 8px; min-height: 240px; padding-top: 20px; }
.podium .col { flex: 1; max-width: 150px; display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; font-weight: 800; }
.podium .step { width: 100%; border: 3px solid var(--ink); border-bottom: 0; border-radius: var(--radius) var(--radius) 0 0; display: grid; place-items: start center; padding-top: 8px; font-size: 2rem; font-weight: 900; color: var(--ink); animation: rise 0.9s ease-out both; transform-origin: bottom; }
.podium .c1 .step { height: 150px; background: var(--gold); animation-delay: 1.2s; }
.podium .c2 .step { height: 105px; background: #e4ded0; animation-delay: 0.6s; }
.podium .c3 .step { height: 75px; background: #ffa05a; animation-delay: 0s; }
.podium .crown { font-size: 2.2rem; animation: popflat 0.6s 1.9s ease-out both; }
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 50; overflow: hidden; }
.confetti i { position: absolute; top: -20px; width: 10px; height: 16px; border: 1px solid var(--ink); animation: fall linear forwards; }

/* ---- passe o celular (modo local) ---- */
.gate { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 18px; text-align: center; }
.gate .who { font-size: 2.6rem; font-weight: 900; word-break: break-word; text-shadow: 3px 3px 0 var(--gold); }

/* ---- QR e sala de espera ---- */
.codebox { text-align: center; }
.codebox .code { font-size: 3.6rem; font-weight: 900; letter-spacing: 0.18em; line-height: 1; text-indent: 0.18em; }
.qr { width: 180px; max-width: 60vw; margin: 0 auto; border: 3px solid var(--ink); border-radius: var(--radius); overflow: hidden; background: #fff; }
.qr svg { display: block; width: 100%; height: auto; }
.pl { display: flex; align-items: center; gap: 8px; background: #fff; border: 2px solid var(--ink); border-radius: var(--radius); padding: 8px 12px; font-weight: 800; }
.pl .dot { width: 12px; height: 12px; border-radius: 50%; background: var(--green); border: 2px solid var(--ink); flex: none; }
.pl.off .dot { background: #fff; }
.pl .nm { flex: 1; word-break: break-word; }
.pl .tag { font-size: 0.75rem; font-weight: 900; background: var(--gold); border: 2px solid var(--ink); border-radius: 999px; padding: 0 8px; }

#toast { position: fixed; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom)); transform: translate(-50%, 30px); opacity: 0; background: var(--ink); color: var(--bg); padding: 12px 18px; border-radius: var(--radius); max-width: 90vw; text-align: center; font-weight: 800; pointer-events: none; transition: 0.25s; z-index: 60; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---- modo telão ---- */
body.tv #app { max-width: 1280px; padding: 28px 40px; font-size: 1.35rem; }
body.tv h1 { font-size: 3.4rem; }
body.tv .question { font-size: 3rem; padding: 40px 30px; }
body.tv .answer-card { font-size: 3.2rem; padding: 50px 30px; }
body.tv .codebox .code { font-size: 8rem; }
body.tv .qr { width: 260px; }
body.tv .chip { font-size: 1.2rem; padding: 8px 18px; }
body.tv .score { font-size: 1.6rem; padding: 14px 20px; }
body.tv .result-row .body { font-size: 1.6rem; }
body.tv .result-row .pos { width: 80px; font-size: 2.2rem; }
body.tv .reveal-author { font-size: 3.4rem; }
body.tv .vote-line { font-size: 1.3rem; }
body.tv .tvgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
body.tv .top .pill { font-size: 1.2rem; }

@keyframes pop { 0% { transform: scale(0.6) rotate(-1deg); opacity: 0; } 70% { transform: scale(1.05) rotate(-1deg); } 100% { transform: scale(1) rotate(-1deg); opacity: 1; } }
@keyframes popflat { 0% { transform: scale(0.6); opacity: 0; } 70% { transform: scale(1.05); } 100% { transform: scale(1); opacity: 1; } }
@keyframes slidein { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes rise { from { transform: scaleY(0); } to { transform: scaleY(1); } }
@keyframes fall { to { transform: translateY(110vh) rotate(720deg); } }
@keyframes pulse { to { opacity: 0.6; } }
@media (prefers-reduced-motion: reduce) { * { animation-duration: 0.01ms !important; animation-delay: 0s !important; transition-duration: 0.01ms !important; } .confetti { display: none; } }
@media (max-width: 380px) { .question { font-size: 1.3rem; } .codebox .code { font-size: 3rem; } }
