/* Telas do visitante: cadastro, roleta e resultado. Celular em pé primeiro; tablet deitado em duas colunas. */

.tela {
  position: relative; z-index: 1; width: 100%; min-height: 100vh; min-height: 100dvh; margin: 0 auto;
  display: flex; flex-direction: column; align-items: center;
  padding: calc(28px + env(safe-area-inset-top)) 22px calc(20px + env(safe-area-inset-bottom));
}

/* ---------- 1 · cadastro ---------- */
.t-cadastro { max-width: 460px; }
.t-cadastro .lado-marca, .t-cadastro .lado-form { display: flex; flex-direction: column; align-items: center; width: 100%; }
.t-cadastro .lado-form { flex: 1; }
.t-cadastro .palco { margin-top: 16px; width: clamp(80px, calc((100dvh - 700px) * .788), 190px); }
.t-cadastro .marcas { margin-top: 22px; }
.t-cadastro .titulo { margin-top: 22px; }
.cartao { margin-top: 12px; width: 100%; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.cartao .botao { margin-top: 4px; }

/* passos: 1 seguir no Instagram, 2 dados (travado até seguir) */
.passo-insta { margin-top: 20px; width: 100%; padding: 16px; display: flex; flex-direction: column; gap: 12px;
  transition: border-color .3s, padding .3s, box-shadow .3s; }
.passo-insta[data-estado="seguir"] { border-color: rgba(231, 220, 194, .75); box-shadow: 0 20px 44px rgba(0, 0, 0, .35), 0 0 0 6px rgba(231, 220, 194, .06); }
.passo-cab { display: flex; align-items: center; gap: 12px; text-align: left; }
.passo-n { flex: none; width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; background: var(--champ); color: var(--champfg); font-weight: 600; font-size: 15px; transition: background .3s, color .3s; }
.passo-cab strong { display: block; font-weight: 500; font-size: 16px; line-height: 1.25; }
.passo-cab span { display: block; margin-top: 1px; font-size: 12.5px; color: var(--muted); }
.passo-qr { display: none; align-items: center; gap: 16px; }
body.modo-qr .passo-qr { display: flex; }
body.modo-qr .passo-seguir { display: none; }
.passo-qr-txt { font-size: 14.5px; line-height: 1.45; color: rgba(var(--ink-rgb), .86); text-align: left; }
.passo-qr-txt b, .passo-feito b { color: var(--champ); font-weight: 600; }
.passo-seguir { height: 58px; white-space: nowrap; }
.passo-seguir b { font-weight: 700; }
.passo-seguir svg { width: 21px; height: 21px; }
.passo-feito { display: none; align-items: center; justify-content: center; gap: 9px; align-self: center; padding: 10px 18px; border-radius: 999px;
  background: rgba(47, 158, 91, .14); border: 1px solid rgba(47, 158, 91, .45); color: #8fdcb0; font-size: 14.5px; font-weight: 500; text-decoration: none; }
.passo-feito svg { width: 20px; height: 20px; flex: none; color: #5cc287; }
.passo-feito b { color: #c9f0d8; font-weight: 600; }
/* depois de abrir: o cartão some e fica só o selo verde */
.passo-insta[data-estado="feito"] { padding: 0; background: none; border-color: transparent; box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; }
.passo-insta[data-estado="feito"] > :not(.passo-feito) { display: none !important; }
.passo-insta[data-estado="feito"] .passo-feito { display: inline-flex; animation: selo .5s var(--mola) both; }
@keyframes selo { from { opacity: 0; transform: scale(.85); } to { opacity: 1; transform: none; } }
.cartao > .passo-cab { margin: 2px 2px 2px; }
form[data-travado] > .passo-cab .passo-n { background: var(--tag-2); color: var(--muted); }
fieldset.dados { border: 0; margin: 0; padding: 0; min-width: 0; display: flex; flex-direction: column; gap: 10px; transition: opacity .4s, filter .4s; }
fieldset.dados:disabled { opacity: .3; filter: saturate(.3); }
fieldset.dados:disabled .botao::after { display: none; }

/* ---------- 2 · roleta ---------- */
.t-roleta { max-width: 640px; gap: 0; }
.roleta-topo, .res-topo { width: 100%; display: flex; justify-content: center; }
.roda-palco {
  position: relative; margin-top: 18px; width: min(94vw, calc(100dvh - 330px), 600px); aspect-ratio: 440 / 452;
  min-width: 260px; cursor: pointer; touch-action: manipulation;
}
.roda { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.roda-halo { position: absolute; inset: -14%; border-radius: 50%; pointer-events: none;
  background: radial-gradient(closest-side, rgba(231, 220, 194, .16), transparent 72%); animation: respira 3.2s ease-in-out infinite; }
.roda-orbita { position: absolute; left: 50%; top: 51.3%; width: 112%; transform: translate(-50%, -50%); overflow: visible; pointer-events: none; }
.roda-orbita circle { fill: none; stroke: rgba(231, 220, 194, .28); stroke-width: .35; stroke-linecap: round; stroke-dasharray: 18 82;
  transform-box: view-box; transform-origin: 100px 100px; animation: gira 9s linear infinite; }
.roda-orbita .o2 { stroke-dasharray: 6 94; animation-duration: 14s; animation-direction: reverse; opacity: .7; }
.t-roleta.girando .roda-orbita circle { animation-duration: 1.6s; }
.t-roleta.girando .roda-orbita .o2 { animation-duration: 2.4s; }

/* peças do SVG da roleta (montado no roleta.js) */
.roda .aro { fill: url(#g-aro); stroke: rgba(255, 255, 255, .14); stroke-width: 1; }
.roda .aro-fio { fill: none; stroke: rgba(231, 220, 194, .55); stroke-width: .8; }
.roda .lampada { fill: #e7dcc2; opacity: .28; transition: opacity .12s; }
.roda .lampada.acesa { opacity: 1; filter: url(#f-brilho); }
.roda.ociosa .lampada { animation: pisca 2.4s ease-in-out infinite; animation-delay: calc(var(--i) * 120ms); }
@keyframes pisca { 0%, 100% { opacity: .22; } 50% { opacity: .85; } }
.roda.festa .lampada { animation: festa .32s steps(1) infinite; animation-delay: calc(var(--i) * -160ms); }
@keyframes festa { 0% { opacity: 1; } 50% { opacity: .15; } }
.roda .fatia { stroke: rgba(11, 11, 12, .55); stroke-width: 1; transition: opacity .5s; }
.roda .fatia.a { fill: url(#g-champ); }
.roda .fatia.b { fill: url(#g-grafite); }
.roda .fatia.c { fill: url(#g-areia); }
.roda .rotulo { font-family: var(--fonte); font-weight: 600; letter-spacing: .04em; text-transform: uppercase; dominant-baseline: middle; transition: opacity .5s; }
.roda .rotulo.a { fill: #1b1b1a; }
.roda .rotulo.b { fill: #f0eeea; }
.roda .rotulo.c { fill: #f6f1e6; }
.roda .rotulo.quase { font-weight: 400; letter-spacing: .08em; }
.roda .rotulo.b.quase { fill: #a29f97; }
.roda .ponto { fill: rgba(11, 11, 12, .35); }
.roda .ponto.b { fill: rgba(231, 220, 194, .35); }
.roda .brilho-cupula { fill: url(#g-cupula); pointer-events: none; }
.roda .miolo-fio { fill: none; stroke: rgba(231, 220, 194, .5); stroke-width: .8; stroke-dasharray: 2 4; }
.roda .miolo { fill: #0b0b0c; stroke: rgba(231, 220, 194, .7); stroke-width: 1.2; }
.roda .ponteiro { transform-box: view-box; transform-origin: 0px -214px; }
.roda .ponteiro.bate { animation: bate 150ms ease-out; }
@keyframes bate { 0% { transform: rotate(0); } 30% { transform: rotate(-14deg); } 100% { transform: rotate(0); } }
.roda .ponteiro path { fill: url(#g-ponteiro); stroke: rgba(11, 11, 12, .6); stroke-width: 1; }
.roda .ponteiro circle { fill: #0b0b0c; stroke: rgba(231, 220, 194, .8); stroke-width: 1; }
/* destaque da fatia sorteada */
.roda.parou .fatia:not(.vence), .roda.parou .rotulo:not(.vence), .roda.parou .ponto { opacity: .32; }
.roda .fatia.vence { stroke: #fff; stroke-width: 2; }
.roda .clarao { fill: #fff; opacity: 0; pointer-events: none; }
.roda.parou .clarao { animation: clarao 1.1s ease-out 2; }
@keyframes clarao { 0% { opacity: .55; } 100% { opacity: 0; } }

.roleta-texto { display: flex; flex-direction: column; align-items: center; margin-top: 14px; width: 100%; }
.roleta-texto .titulo { margin-top: 10px; font-size: clamp(32px, 8vw, 48px); }
.b-girar { margin-top: 22px; min-width: 260px; height: 62px; font-size: 19px; }
.dica { margin: 12px 0 0; color: var(--muted); font-size: 12px; letter-spacing: .02em; }
.t-roleta.girando .b-girar, .t-roleta.girando .dica { opacity: .0; pointer-events: none; transition: opacity .3s; }
.t-roleta.girando .roda-palco { cursor: default; }

/* ---------- 3 · resultado ---------- */
.t-resultado { max-width: 520px; }
.res-corpo { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; width: 100%; padding: 10px 0; }
.palco.p { width: clamp(70px, calc((100dvh - 560px) * .5), 120px); margin-bottom: 26px; }
.res-voce { margin: 18px 0 0; font-size: 16px; font-weight: 300; color: var(--muted); text-align: center; }
.res-premio {
  margin: 4px 0 0; text-align: center; font-weight: 200; font-size: clamp(40px, 11vw, 64px); line-height: 1.02; letter-spacing: -.025em;
  background: linear-gradient(180deg, #f6f1e6 20%, #d6c49e 100%); -webkit-background-clip: text; background-clip: text; color: transparent;
  text-wrap: balance;
}
.res-premio.quase { background: none; color: var(--ink); }
.res-texto { margin: 20px 0 0; text-align: center; color: rgba(var(--ink-rgb), .86); font-size: 16px; line-height: 1.45; font-weight: 300; max-width: 34ch; }
.res-aviso { margin: 18px 0 0; padding: 12px 18px; border-radius: 14px; background: var(--tag); border: 1px solid var(--fbd);
  text-align: center; color: rgba(var(--ink-rgb), .86); font-size: 14px; line-height: 1.4; max-width: 40ch; }
.res-proximo { margin-top: 26px; min-width: 240px; }
.insta-qr { flex: none; width: 112px; height: 112px; padding: 8px; background: #f6f1e6; border-radius: 14px; }
.insta-qr img { width: 100%; height: 100%; }
.contagem { min-width: 30px; height: 26px; padding: 0 8px; border-radius: 999px; background: var(--tag-2); display: inline-grid; place-items: center;
  font-size: 13px; font-weight: 500; font-variant-numeric: tabular-nums; color: var(--muted); }

/* ---------- tablet/notebook deitado: duas colunas ---------- */
@media (min-width: 880px) and (orientation: landscape) {
  .t-cadastro { max-width: 1120px; flex-direction: row; align-items: center; justify-content: center; gap: clamp(40px, 7vw, 110px); padding-top: 36px; padding-bottom: 36px; }
  .t-cadastro .lado-marca { width: auto; flex: 0 1 420px; }
  .t-cadastro .lado-form { flex: 0 1 440px; justify-content: center; }
  .t-cadastro .palco { width: clamp(90px, calc((100dvh - 560px) * .78), 240px); margin-top: 24px; }
  .t-cadastro .lado-marca .passo-insta { margin-top: 26px; max-width: 420px; }
  .t-cadastro .titulo { margin-top: 0; font-size: 58px; }
  .t-cadastro .rodape { margin-top: 0; }

  .t-roleta { max-width: 1240px; flex-direction: row; flex-wrap: wrap; justify-content: center; align-items: center; align-content: center; column-gap: clamp(30px, 6vw, 90px); }
  .t-roleta .roleta-topo { position: absolute; top: calc(24px + env(safe-area-inset-top)); left: 0; right: 0; }
  .t-roleta .roda-palco { margin-top: 30px; width: min(calc(100dvh - 90px), 56vw, 720px); }
  .t-roleta .roleta-texto { width: auto; flex: 0 1 360px; margin-top: 0; }
  .t-roleta .roleta-texto .titulo { font-size: 54px; }

  .t-resultado { max-width: 640px; }
}

@media (max-height: 640px) and (orientation: portrait) {
  .t-cadastro .palco { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .roda-halo, .roda-orbita circle, .roda.ociosa .lampada, .roda.festa .lampada, .roda .ponteiro.bate, .roda.parou .clarao { animation: none !important; }
}
