/* Caderno de recados: folha pautada, caneta azul, marca-texto, adesivos e bordas desenhadas à mão.
   Sem degradês, sem brilho, sem desfoque. As linhas do caderno são um SVG repetido (traço duro). */
:root {
  --paper: #fbf8ee;
  --rule: #cfe3f5;
  --margin: #ef8a8a;
  --ink: #1c3faa;      /* caneta esferográfica */
  --ink-soft: #4a5fa8;
  --navy: #0f1f55;     /* texto sobre cores de marcador */
  --white: #ffffff;
  --hl: #ffe14d;       /* marca-texto */
  --pink: #ff3d81;
  --teal: #00b3a4;
  --orange: #ff8a00;
  --lime: #8bd13f;
  --danger: #d6264f;
  --wob-s: 22px 8px 20px 8px / 8px 20px 8px 22px;
  --wob-m: 34px 10px 30px 12px / 12px 30px 10px 34px;
  --hand: 'Marker Felt', 'Chalkboard SE', 'Segoe Print', 'Bradley Hand', ui-rounded, system-ui, sans-serif;
  --flat: 2px 3px 0 rgba(28, 63, 170, 0.22);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html { color-scheme: light; }
body {
  margin: 0;
  min-height: 100dvh;
  background-color: var(--paper);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='34'%3E%3Crect y='32' width='8' height='2' fill='%23cfe3f5'/%3E%3C/svg%3E");
  background-position: 0 8px;
  color: var(--ink);
  font: 17px/1.45 system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  overflow-x: hidden;
}
/* margem vermelha do caderno */
body::before { content: ''; position: fixed; left: 14px; top: 0; bottom: 0; width: 2px; background: var(--margin); z-index: 0; pointer-events: none; }
#app { position: relative; z-index: 1; max-width: 560px; margin: 0 auto; padding: calc(16px + env(safe-area-inset-top)) 16px calc(72px + env(safe-area-inset-bottom)) 32px; min-height: 100dvh; display: flex; flex-direction: column; gap: 16px; }
h1, h2, h3, p { margin: 0; }
h1 { font-family: var(--hand); font-size: 2.2rem; line-height: 1.05; font-weight: 800; }
h2 { font-family: var(--hand); font-size: 1.45rem; font-weight: 800; line-height: 1.15; }
h3 { font-size: 0.78rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.1em; color: var(--ink-soft); }
.hl { box-shadow: inset 0 -0.45em 0 var(--hl); padding: 0 0.15em; }
.muted { color: var(--ink-soft); }
.center { text-align: center; }
.small { font-size: 0.85rem; }
a { color: var(--ink); font-weight: 800; }
:focus-visible { outline: 3px dashed var(--pink); outline-offset: 3px; }

.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; gap: 10px; align-items: center; }
.grow { flex: 1; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* ---- ficha (cartão com fita adesiva) ---- */
.card { position: relative; background: var(--white); border: 2.5px solid var(--ink); border-radius: var(--wob-m); padding: 22px 16px 16px; display: flex; flex-direction: column; gap: 12px; box-shadow: var(--flat); }
.card::before { content: ''; position: absolute; top: -11px; left: 50%; width: 76px; height: 22px; margin-left: -38px; background: rgba(255, 225, 77, 0.8); transform: rotate(-3deg); border-left: 2px dotted rgba(0, 0, 0, 0.12); border-right: 2px dotted rgba(0, 0, 0, 0.12); }
.card.plain::before { display: none; }
.card.plain { padding-top: 16px; }
.stack > .card:nth-child(even) { transform: rotate(0.5deg); }
.stack > .card:nth-child(odd) { transform: rotate(-0.4deg); }
.postit { background: var(--hl); padding: 12px 14px; border-radius: 4px 4px 22px 4px; font-weight: 700; color: var(--navy); transform: rotate(-1deg); box-shadow: var(--flat); }
.postit.pink { background: #ffc2d8; }
.postit.teal { background: #a8ece6; }

/* ---- botões de marcador ---- */
button {
  font: inherit; font-weight: 800; color: var(--navy); background: var(--hl); border: 2.5px solid var(--ink); border-radius: var(--wob-s);
  padding: 12px 18px; min-height: 52px; cursor: pointer; text-align: center; touch-action: manipulation;
  box-shadow: var(--flat); transition: transform 0.08s, opacity 0.2s; transform: rotate(-0.5deg);
}
button:active { transform: translate(2px, 3px) rotate(-0.5deg); box-shadow: none; }
button:disabled { opacity: 0.45; cursor: not-allowed; box-shadow: none; }
button.pink { background: var(--pink); }
button.teal { background: var(--teal); }
button.orange { background: var(--orange); }
button.lime { background: var(--lime); }
button.ghost { background: var(--white); color: var(--ink); }
button.small { min-height: 38px; padding: 4px 12px; font-size: 0.85rem; border-width: 2px; }
button.danger { background: var(--danger); color: #fff; }
button.big { min-height: 62px; font-size: 1.2rem; font-family: var(--hand); }

input, textarea, select {
  font: inherit; color: var(--ink); background: rgba(255, 255, 255, 0.85); border: 0; border-bottom: 3px solid var(--ink); border-radius: 10px 10px 0 0;
  padding: 12px 12px; width: 100%; min-height: 52px;
}
::placeholder { color: #8a99cc; }
textarea { resize: none; min-height: 90px; font-size: 1.1rem; }
input:focus, textarea:focus, select:focus { outline: none; border-bottom-color: var(--pink); background: #fff; }
input.code { text-transform: uppercase; letter-spacing: 0.45em; text-align: center; font-weight: 800; font-size: 1.6rem; font-family: var(--hand); }
label.field { display: flex; flex-direction: column; gap: 4px; }
label.field > span { font-size: 0.78rem; font-weight: 800; color: var(--ink-soft); text-transform: uppercase; letter-spacing: 0.08em; }

.seg { display: flex; gap: 6px; }
.seg button { flex: 1; min-height: 46px; padding: 6px 6px; font-size: 0.9rem; background: var(--white); color: var(--ink); box-shadow: none; transform: none; }
.seg button.on { background: var(--ink); color: var(--white); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; gap: 6px; align-items: center; padding: 3px 12px; background: var(--white); border: 2px dashed var(--ink); border-radius: 999px; font-weight: 700; font-size: 0.9rem; }
.chip.done { border-style: solid; background: #d9f5a8; color: var(--navy); }
.chip.prot { background: var(--hl); border-style: solid; color: var(--navy); }
.chip.off { opacity: 0.45; }
button.chip { min-height: 38px; box-shadow: none; transform: none; border-style: solid; border-width: 2px; padding: 4px 12px; background: var(--white); color: var(--ink); }
button.chip.on { background: var(--teal); color: var(--navy); }

/* ---- adesivos ---- */
.sticker { display: inline-grid; place-items: center; min-width: 38px; height: 38px; border-radius: 50%; background: var(--c, var(--hl)); color: var(--navy); font-weight: 900; font-family: var(--hand); font-size: 1.1rem; border: 3px solid #fff; box-shadow: 0 0 0 1.5px var(--ink), 2px 3px 0 rgba(0, 0, 0, 0.18); flex: none; }
.sticker.sq { border-radius: 10px; padding: 0 8px; }

/* ---- topo ---- */
.top { display: flex; align-items: center; gap: 10px; justify-content: space-between; min-height: 42px; }
.top .tag { background: var(--white); border: 2px solid var(--ink); border-radius: 8px 14px 8px 14px; padding: 2px 10px; font-weight: 800; font-size: 0.88rem; white-space: nowrap; transform: rotate(-1deg); }
.top .tag.code { background: var(--hl); letter-spacing: 0.2em; font-family: var(--hand); color: var(--navy); }
.timer { font-variant-numeric: tabular-nums; font-weight: 800; white-space: nowrap; flex: none; background: var(--white); border: 2px solid var(--ink); border-radius: 999px; padding: 2px 12px; }
.timer:empty { display: none; }
.timer.low { background: var(--danger); color: #fff; border-color: var(--danger); animation: pulse 0.6s infinite alternate; }
.icon-btn { background: var(--white); min-height: 40px; width: 40px; padding: 0; border-radius: 12px; font-size: 1.1rem; }

/* ---- home ---- */
.hero { padding-top: 4vh; display: flex; flex-direction: column; gap: 14px; }
.logo { font-family: var(--hand); font-size: 3.3rem; font-weight: 800; line-height: 0.95; transform: rotate(-2deg); transform-origin: left bottom; }
.logo span { box-shadow: inset 0 -0.38em 0 var(--hl); padding: 0 4px; }
.logo i { font-style: normal; color: var(--pink); }

/* ---- pergunta e opções ---- */
.qcard { text-align: center; }
.qtext { font-family: var(--hand); font-size: 1.55rem; line-height: 1.2; font-weight: 800; }
.qby { font-size: 0.82rem; color: var(--ink-soft); font-weight: 700; }
.opts { display: flex; flex-direction: column; gap: 10px; }
.opt { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; background: var(--white); color: var(--ink); min-height: 60px; padding: 8px 14px 8px 10px; font-size: 1.1rem; box-shadow: var(--flat); transform: none; }
.opt .txt { flex: 1; word-break: break-word; }
.opt.on { background: var(--c); color: var(--navy); }
.opt.on .sticker { background: #fff; }
.opt.static { cursor: default; box-shadow: none; }
.opt:active { transform: translate(2px, 3px); }
.opt.mine { outline: 3px dashed var(--ink); outline-offset: 3px; }
.mini { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.mini .sticker { min-width: 28px; height: 28px; font-size: 0.8rem; }
.mini .m { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; font-size: 0.88rem; }

/* ---- aposta ---- */
.bet { display: flex; align-items: center; justify-content: center; gap: 14px; }
.bet .n { font-family: var(--hand); font-size: 3.4rem; font-weight: 800; min-width: 2ch; text-align: center; line-height: 1; }
.bet button { width: 56px; padding: 0; font-size: 1.6rem; }

/* ---- revelação ---- */
.write { font-family: var(--hand); font-size: 2rem; font-weight: 800; text-align: center; line-height: 1.15; animation: write 1s steps(16, end) both; }
.write b { box-shadow: inset 0 -0.4em 0 var(--hl); padding: 0 6px; }
.bars { display: flex; flex-direction: column; gap: 12px; }
.bar .head { display: flex; align-items: center; gap: 10px; font-weight: 800; }
.bar .track { height: 26px; background: rgba(28, 63, 170, 0.08); border-radius: 6px 12px 6px 12px; overflow: hidden; margin-top: 4px; border: 2px solid var(--ink); }
.bar .fill { height: 100%; background: var(--c); transform-origin: left; animation: paint 0.9s steps(12, end) both; animation-delay: 0.5s; }
.bar .who { font-size: 0.85rem; color: var(--ink-soft); font-weight: 700; margin-top: 3px; min-height: 1em; }
.bar.right .head { font-size: 1.1rem; }
.bar .ok { margin-left: auto; }
.verdict { text-align: center; font-family: var(--hand); font-size: 1.4rem; font-weight: 800; line-height: 1.2; }
.deltas { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.delta { display: inline-flex; align-items: center; gap: 6px; background: var(--white); border: 2px solid var(--ink); border-radius: 999px; padding: 2px 6px 2px 12px; font-weight: 700; font-size: 0.9rem; }
.delta .sticker { min-width: 34px; height: 28px; font-size: 0.85rem; border-radius: 14px; }

/* ---- placar ---- */
.board { display: flex; flex-direction: column; }
.row-s { display: flex; align-items: baseline; gap: 8px; padding: 6px 2px; font-weight: 700; border-bottom: 2px dotted var(--ink-soft); }
.row-s .n { width: 2.2ch; color: var(--ink-soft); }
.row-s .nm { word-break: break-word; }
.row-s .dots { flex: 1; }
.row-s .tot { font-family: var(--hand); font-size: 1.3rem; font-weight: 800; }
.row-s .d { color: var(--teal); font-size: 0.85rem; font-weight: 800; }
.row-s.me { background: rgba(255, 225, 77, 0.55); }

/* ---- fim ---- */
.podium { display: flex; align-items: flex-end; justify-content: center; gap: 8px; min-height: 230px; padding-top: 18px; }
.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: 2.5px solid var(--ink); border-bottom: 0; border-radius: 14px 14px 0 0; display: grid; place-items: start center; padding-top: 8px; font-family: var(--hand); font-size: 2rem; font-weight: 800; color: var(--navy); transform-origin: bottom; animation: rise 0.9s steps(10, end) both; }
.podium .c1 .step { height: 150px; background: var(--hl); animation-delay: 1.1s; }
.podium .c2 .step { height: 105px; background: #a8ece6; animation-delay: 0.6s; }
.podium .c3 .step { height: 75px; background: #ffc2d8; animation-delay: 0.1s; }
.podium .crown { animation: pop 0.6s 1.8s ease-out both; }
.star { display: inline-block; width: 30px; height: 30px; background: var(--c, var(--hl)); clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%); }
.award { display: flex; gap: 12px; align-items: center; }
.award .sticker { min-width: 48px; height: 48px; font-size: 1.4rem; }
.award b { font-family: var(--hand); font-size: 1.1rem; }
.fall { position: fixed; inset: 0; pointer-events: none; z-index: 50; overflow: hidden; }
.fall i { position: absolute; top: -40px; width: 26px; height: 26px; background: var(--c); clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%); 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-family: var(--hand); font-size: 2.8rem; font-weight: 800; word-break: break-word; }
.gate .who span { box-shadow: inset 0 -0.4em 0 var(--hl); padding: 0 8px; }

/* ---- sala de espera ---- */
.codebox { text-align: center; align-items: center; }
.codebox .code { font-family: var(--hand); font-size: 3.6rem; font-weight: 800; letter-spacing: 0.16em; line-height: 1; text-indent: 0.16em; }
.qr { width: 180px; max-width: 60vw; margin: 0 auto; border: 2.5px solid var(--ink); border-radius: 8px; overflow: hidden; background: #fff; padding: 4px; }
.qr svg { display: block; width: 100%; height: auto; }
.pl { display: flex; align-items: center; gap: 8px; background: rgba(255, 255, 255, 0.8); border-bottom: 2px dotted var(--ink-soft); padding: 8px 4px; font-weight: 700; }
.pl .dot { width: 12px; height: 12px; border-radius: 50%; background: var(--lime); 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.72rem; font-weight: 800; background: var(--hl); border-radius: 999px; padding: 1px 8px; color: var(--navy); }

#toast { position: fixed; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom)); transform: translate(-50%, 30px) rotate(-1deg); opacity: 0; background: var(--hl); color: var(--navy); border: 2.5px solid var(--ink); padding: 10px 16px; border-radius: 4px 4px 20px 4px; max-width: 90vw; text-align: center; font-weight: 800; pointer-events: none; transition: 0.25s; z-index: 60; box-shadow: var(--flat); }
#toast.show { opacity: 1; transform: translate(-50%, 0) rotate(-1deg); }

/* ---- modo telão ---- */
body.tv #app { max-width: 1280px; padding: 28px 40px 28px 56px; font-size: 1.35rem; }
body.tv::before { left: 30px; }
body.tv h1 { font-size: 3.4rem; }
body.tv .qtext { font-size: 3rem; }
body.tv .opt { font-size: 1.8rem; min-height: 84px; }
body.tv .write { font-size: 3.4rem; }
body.tv .codebox .code { font-size: 8rem; }
body.tv .qr { width: 260px; }
body.tv .chip { font-size: 1.2rem; padding: 6px 18px; }
body.tv .row-s { font-size: 1.6rem; }
body.tv .bar .head { font-size: 1.5rem; }
body.tv .bar .who { font-size: 1.15rem; }
body.tv .verdict { font-size: 2rem; }
body.tv .tvgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

@keyframes pop { 0% { transform: scale(0.6); opacity: 0; } 70% { transform: scale(1.1); } 100% { transform: scale(1); opacity: 1; } }
@keyframes write { from { clip-path: inset(-10% 100% -10% 0); } to { clip-path: inset(-10% 0 -10% 0); } }
@keyframes paint { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes rise { from { transform: scaleY(0); } to { transform: scaleY(1); } }
@keyframes fall { to { transform: translateY(112vh) rotate(540deg); } }
@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; } .fall { display: none; } }
@media (min-width: 640px) { body::before { left: 40px; } #app { padding-left: 64px; } }
@media (max-width: 380px) { .qtext { font-size: 1.3rem; } .codebox .code { font-size: 3rem; } .logo { font-size: 2.8rem; } }
