/* ==========================================================
   Roleta da Sorte | Contabilidade Facilitada
   ========================================================== */

@font-face {
  font-family: 'Montserrat';
  src: url('../fonts/montserrat-latin.woff2') format('woff2');
  font-weight: 100 900;
  font-display: block;
}
@font-face {
  font-family: 'Sora';
  src: url('../fonts/sora-latin.woff2') format('woff2');
  font-weight: 100 800;
  font-display: block;
}

:root {
  --azul: #102850;
  --azul-medio: #183c77;
  --azul-escuro: #081630;
  --laranja: #ff9933;
  --laranja-claro: #ffb366;
  --laranja-escuro: #e2700f;
  --branco: #f1f1f2;
  --cinza: #727376;

  /* Diâmetro da roleta */
  --tam: min(86vh, 54vw);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; overflow: hidden; overscroll-behavior: none; }

body {
  font-family: 'Montserrat', system-ui, sans-serif;
  color: var(--branco);
  background: var(--azul-escuro);
  -webkit-user-select: none;
  user-select: none;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  touch-action: manipulation;
}

button { font: inherit; }

kbd {
  font-family: inherit;
  font-weight: 700;
  font-size: .85em;
  padding: .1em .5em;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, .25);
  border-bottom-width: 3px;
  background: rgba(255, 255, 255, .08);
}

/* ---------- Fundo ---------- */

.fundo {
  position: fixed;
  inset: 0;
  overflow: hidden;
  background: radial-gradient(ellipse at 70% 50%, #24539e 0%, #183c77 22%, #102850 52%, #071330 100%);
}

.orbe {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  animation: flutuar 18s ease-in-out infinite alternate;
}
.orbe.o1 { width: 42vw; height: 42vw; left: -12vw; top: -14vw; background: var(--laranja); opacity: .16; }
.orbe.o2 { width: 46vw; height: 46vw; right: -10vw; bottom: -18vw; background: #2f6fd6; opacity: .32; animation-duration: 23s; }
.orbe.o3 { width: 26vw; height: 26vw; left: 34vw; bottom: -14vw; background: var(--laranja); opacity: .12; animation-duration: 27s; }

@keyframes flutuar {
  to { transform: translate(6vw, 5vh) scale(1.18); }
}

.pontos {
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(255, 255, 255, .07) 1px, transparent 1.5px);
  background-size: 30px 30px;
  -webkit-mask-image: radial-gradient(ellipse at 30% 50%, #000 0%, transparent 70%);
  mask-image: radial-gradient(ellipse at 30% 50%, #000 0%, transparent 70%);
}

.marca-dagua {
  position: absolute;
  width: 70vh;
  left: -18vh;
  bottom: -22vh;
  opacity: .05;
  animation: girarLento 140s linear infinite;
}

.faiscas span {
  position: absolute;
  bottom: -12px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #ffe0bd;
  box-shadow: 0 0 8px 2px rgba(255, 153, 51, .55);
  opacity: 0;
  animation: subir linear infinite;
}

@keyframes subir {
  0%   { transform: translate(0, 0) scale(var(--s, 1)); opacity: 0; }
  10%  { opacity: .9; }
  85%  { opacity: .6; }
  100% { transform: translate(var(--dx, 0), -110vh) scale(var(--s, 1)); opacity: 0; }
}

@keyframes girarLento { to { transform: rotate(360deg); } }

/* ---------- Layout ---------- */

.app {
  position: relative;
  z-index: 1;
  height: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 4vw;
  padding:
    max(4vh, env(safe-area-inset-top)) max(5vw, env(safe-area-inset-right))
    max(4vh, env(safe-area-inset-bottom)) max(5vw, env(safe-area-inset-left));
}

.info {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2.4vh;
  max-width: 640px;
}

.info > * { animation: entrarEsquerda .9s cubic-bezier(.2, .8, .2, 1) both; }
.info > :nth-child(2) { animation-delay: .08s; }
.info > :nth-child(3) { animation-delay: .16s; }
.info > :nth-child(4) { animation-delay: .24s; }
.info > :nth-child(5) { animation-delay: .32s; }
.info > :nth-child(6) { animation-delay: .40s; }
.info > :nth-child(7) { animation-delay: .48s; }

@keyframes entrarEsquerda {
  from { opacity: 0; transform: translateX(-40px); }
  to   { opacity: 1; transform: none; }
}

.logo { width: clamp(180px, 21vw, 330px); margin-bottom: 1vh; }

.selo {
  display: inline-flex;
  align-items: center;
  gap: .6em;
  padding: .45em 1em;
  border-radius: 999px;
  font-weight: 800;
  font-size: clamp(.75rem, .95vw, .95rem);
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--laranja-claro);
  background: rgba(255, 153, 51, .12);
  border: 1px solid rgba(255, 153, 51, .35);
}
.selo i {
  width: .55em;
  height: .55em;
  border-radius: 50%;
  background: var(--laranja);
  box-shadow: 0 0 0 0 rgba(255, 153, 51, .7);
  animation: pulsoPonto 1.8s ease-out infinite;
}
@keyframes pulsoPonto {
  to { box-shadow: 0 0 0 10px rgba(255, 153, 51, 0); }
}

.titulo {
  font-family: 'Sora', sans-serif;
  font-weight: 800;
  font-size: min(4.4vw, 7.4vh);
  line-height: 1.04;
  letter-spacing: -.025em;
}
.titulo .destaque {
  background: linear-gradient(90deg, #ff9933 0%, #ffd29e 25%, #ff9933 50%, #ff9933 100%);
  background-size: 200% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: brilhoTexto 4s linear infinite;
}
@keyframes brilhoTexto {
  from { background-position: 100% 0; }
  to   { background-position: -100% 0; }
}

.lead {
  font-size: clamp(1rem, 1.3vw, 1.35rem);
  font-weight: 500;
  color: rgba(241, 241, 242, .8);
  text-wrap: balance;
}

.premios {
  list-style: none;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.2vh 12px;
  width: 100%;
}
.premio {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 1.1vh 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, .06);
  border: 1px solid rgba(255, 255, 255, .1);
  font-weight: 700;
  font-size: clamp(.82rem, 1vw, 1.05rem);
  line-height: 1.2;
  transition: opacity .3s;
}
.premio .ic {
  flex: none;
  width: clamp(32px, 2.6vw, 42px);
  height: clamp(32px, 2.6vw, 42px);
  border-radius: 11px;
  display: grid;
  place-items: center;
  color: var(--azul);
  background: linear-gradient(135deg, var(--laranja-claro), var(--laranja));
  box-shadow: 0 4px 14px rgba(255, 153, 51, .35);
}
.premio .ic svg { width: 58%; height: 58%; }
.premio.esgotado { opacity: .4; }
.premio.esgotado .nome { text-decoration: line-through; }
.premio .tag {
  display: block;
  font-size: .7em;
  font-weight: 800;
  letter-spacing: .1em;
  color: var(--laranja-claro);
}

.acao { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; margin-top: 1vh; }

.botao-wrap { position: relative; }
.botao-wrap::before,
.botao-wrap::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 999px;
  border: 3px solid rgba(255, 153, 51, .7);
  animation: anel 2.2s ease-out infinite;
  pointer-events: none;
}
.botao-wrap::after { animation-delay: 1.1s; }
@keyframes anel {
  from { transform: scale(1); opacity: .9; }
  to   { transform: scale(1.35, 1.6); opacity: 0; }
}
.botao-wrap.inativo::before,
.botao-wrap.inativo::after { animation: none; opacity: 0; }

.botao-girar {
  position: relative;
  overflow: hidden;
  font-family: 'Sora', sans-serif;
  font-weight: 800;
  font-size: clamp(1.4rem, min(2.3vw, 4vh), 2.4rem);
  letter-spacing: .14em;
  color: var(--azul);
  padding: .8em 2.4em;
  border: none;
  border-radius: 999px;
  cursor: pointer;
  background: linear-gradient(180deg, #ffc285 0%, #ff9933 50%, #f2821f 100%);
  box-shadow: 0 9px 0 #b9570b, 0 20px 40px rgba(255, 153, 51, .45), inset 0 2px 0 rgba(255, 255, 255, .55);
  transition: transform .12s, box-shadow .12s, filter .3s;
}
.botao-girar::after {
  content: '';
  position: absolute;
  top: 0;
  left: -70%;
  width: 45%;
  height: 100%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .7), transparent);
  transform: skewX(-20deg);
  animation: varrer 3.2s ease-in-out infinite;
}
@keyframes varrer {
  0%, 55% { left: -70%; }
  100%    { left: 130%; }
}
.botao-girar:hover { filter: brightness(1.06); }
.botao-girar:active,
.botao-girar.pressionado {
  transform: translateY(6px);
  box-shadow: 0 3px 0 #b9570b, 0 10px 24px rgba(255, 153, 51, .4), inset 0 2px 0 rgba(255, 255, 255, .55);
}
.botao-girar:disabled { cursor: default; filter: grayscale(.35) brightness(.75); }
.botao-girar:disabled::after { animation: none; }

.dica { font-size: clamp(.85rem, 1vw, 1rem); color: rgba(241, 241, 242, .65); font-weight: 500; }


/* ---------- Roleta ---------- */

/* Só vira caixa no modo em pé, onde define o espaço disponível para a roda */
.roda-espaco { display: contents; }

.roda-area {
  position: relative;
  width: var(--tam);
  height: var(--tam);
  animation: entrarRoda 1.1s cubic-bezier(.2, .9, .2, 1.05) both .15s;
  touch-action: none;
  cursor: grab;
}
.roda-area:active { cursor: grabbing; }
@keyframes entrarRoda {
  from { opacity: 0; transform: scale(.7) rotate(-40deg); }
  to   { opacity: 1; transform: none; }
}

.raios {
  position: absolute;
  inset: -32%;
  border-radius: 50%;
  background: repeating-conic-gradient(from 0deg, rgba(255, 153, 51, .14) 0deg 5deg, transparent 5deg 15deg);
  -webkit-mask-image: radial-gradient(circle, #000 28%, transparent 68%);
  mask-image: radial-gradient(circle, #000 28%, transparent 68%);
  animation: girarLento 60s linear infinite;
}

.brilho-fundo {
  position: absolute;
  inset: -6%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 153, 51, .4) 30%, transparent 66%);
  filter: blur(24px);
  animation: respirar 3.2s ease-in-out infinite;
}
@keyframes respirar {
  0%, 100% { opacity: .55; transform: scale(.97); }
  50%      { opacity: 1;   transform: scale(1.03); }
}
.roda-area.vitoria .brilho-fundo { animation-duration: .6s; }

.roda { position: absolute; inset: 0; }

.aro {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background:
    radial-gradient(circle at 30% 22%, rgba(255, 255, 255, .22), transparent 45%),
    radial-gradient(circle, #183c77 60%, #0b1d3d 100%);
  box-shadow:
    inset 0 0 0 calc(var(--tam) * .011) var(--laranja),
    inset 0 0 0 calc(var(--tam) * .016) rgba(255, 255, 255, .25),
    inset 0 0 calc(var(--tam) * .05) rgba(0, 0, 0, .55),
    0 0 0 calc(var(--tam) * .005) rgba(255, 255, 255, .35),
    0 calc(var(--tam) * .04) calc(var(--tam) * .08) rgba(0, 0, 0, .55);
}

/* Lâmpadas */
.lampada {
  position: absolute;
  left: 50%;
  top: 50%;
  width: calc(var(--tam) * .026);
  height: calc(var(--tam) * .026);
  margin: calc(var(--tam) * -.013);
  border-radius: 50%;
  transform: rotate(var(--a)) translateY(calc(var(--tam) * -.468));
  background: radial-gradient(circle at 35% 35%, #fff 0%, #ffe6c4 35%, #ff9933 100%);
  box-shadow: 0 0 calc(var(--tam) * .014) calc(var(--tam) * .004) rgba(255, 190, 110, .95);
}

@keyframes lampada {
  0%, 49% {
    filter: none;
    box-shadow: 0 0 calc(var(--tam) * .014) calc(var(--tam) * .004) rgba(255, 190, 110, .95);
  }
  50%, 100% {
    filter: brightness(.38) saturate(.5);
    box-shadow: none;
  }
}
@keyframes perseguir {
  0%, 30% {
    filter: none;
    box-shadow: 0 0 calc(var(--tam) * .016) calc(var(--tam) * .005) rgba(255, 200, 120, 1);
  }
  31%, 100% {
    filter: brightness(.38) saturate(.5);
    box-shadow: none;
  }
}

.roda[data-modo="ocioso"] .lampada {
  animation: lampada 1.6s infinite;
  animation-delay: calc(var(--par) * -.8s);
}
.roda[data-modo="girando"] .lampada {
  animation: perseguir .42s infinite;
  animation-delay: calc(var(--i) * -.06s);
}
.roda[data-modo="vitoria"] .lampada {
  animation: lampada .32s infinite;
}
.roda[data-modo="derrota"] .lampada {
  animation: none;
  filter: brightness(.55) saturate(.6);
  box-shadow: none;
}

#canvasRoda,
.vinheta,
.holofote,
.reflexo {
  position: absolute;
  inset: 6.5%;
  width: 87%;
  height: 87%;
  border-radius: 50%;
}

#canvasRoda {
  box-shadow: 0 0 0 calc(var(--tam) * .007) #fff, 0 0 calc(var(--tam) * .04) rgba(0, 0, 0, .6);
  will-change: transform;
}

.vinheta {
  pointer-events: none;
  background: radial-gradient(circle, transparent 62%, rgba(0, 0, 0, .28) 100%);
}

.reflexo {
  pointer-events: none;
  background:
    radial-gradient(ellipse 70% 45% at 35% 18%, rgba(255, 255, 255, .22), transparent 70%),
    linear-gradient(160deg, rgba(255, 255, 255, .08) 0%, transparent 45%);
}

.holofote {
  pointer-events: none;
  opacity: 0;
  transition: opacity .5s;
  overflow: visible;
}
.holofote.ativo { opacity: 1; }
.holofote-mascara { fill: rgba(4, 10, 26, .62); }
.holofote-fatia {
  fill: rgba(255, 255, 255, .08);
  stroke: #fff;
  stroke-width: 2.4;
  stroke-linejoin: round;
  filter: drop-shadow(0 0 3px #ffb366) drop-shadow(0 0 8px #ff9933);
  animation: pulsoFatia .7s ease-in-out infinite alternate;
}
@keyframes pulsoFatia {
  from { fill: rgba(255, 255, 255, .02); }
  to   { fill: rgba(255, 255, 255, .18); }
}

.centro {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 18%;
  height: 18%;
  transform: translate(-50%, -50%);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 35% 30%, #ffffff 0%, #eef0f4 55%, #c4c9d4 100%);
  box-shadow:
    0 0 0 calc(var(--tam) * .011) var(--laranja),
    0 0 0 calc(var(--tam) * .019) var(--azul),
    0 0 0 calc(var(--tam) * .023) rgba(255, 255, 255, .5),
    0 calc(var(--tam) * .012) calc(var(--tam) * .035) rgba(0, 0, 0, .55);
  transition: transform .2s;
}
.centro img { width: 58%; pointer-events: none; }
.centro:hover { transform: translate(-50%, -50%) scale(1.05); }
.centro:active { transform: translate(-50%, -50%) scale(.95); }

.ponteiro {
  position: absolute;
  left: 50%;
  top: -4.77%;
  width: 10%;
  margin-left: -5%;
  transform-origin: 50% 31.8%;
  z-index: 5;
  filter: drop-shadow(0 calc(var(--tam) * .008) calc(var(--tam) * .01) rgba(0, 0, 0, .5));
}
.ponteiro svg { display: block; width: 100%; height: auto; }

.roda-area.tremer { animation: tremer .55s cubic-bezier(.36, .07, .19, .97) both; }
@keyframes tremer {
  10%, 90% { transform: translateX(-3px); }
  20%, 80% { transform: translateX(6px); }
  30%, 50%, 70% { transform: translateX(-10px); }
  40%, 60% { transform: translateX(10px); }
}

/* ---------- Controles ---------- */

.controles {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 10;
  display: flex;
  gap: 8px;
}
.controle {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, .14);
  background: rgba(255, 255, 255, .06);
  color: #fff;
  cursor: pointer;
  opacity: .35;
  transition: opacity .2s, background .2s;
}
.controle:hover { opacity: 1; background: rgba(255, 255, 255, .14); }
.controle svg { width: 20px; height: 20px; }

/* ---------- Resultado ---------- */

.resultado {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 24px;
  background: radial-gradient(circle, rgba(16, 40, 80, .55), rgba(4, 10, 24, .82));
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  opacity: 0;
  visibility: hidden;
  transition: opacity .35s, visibility 0s .35s;
}
.resultado.aberto { opacity: 1; visibility: visible; transition: opacity .35s; }

.cartao {
  position: relative;
  z-index: 1;
  width: min(600px, 92vw);
  padding: clamp(70px, 11vh, 96px) clamp(24px, 4vw, 48px) clamp(28px, 4.5vh, 40px);
  margin-top: 70px;
  border-radius: 30px;
  text-align: center;
  background: linear-gradient(165deg, #22508f 0%, #102850 62%);
  border: 1px solid rgba(255, 255, 255, .18);
  box-shadow: 0 40px 100px rgba(0, 0, 0, .6), 0 0 0 7px rgba(255, 153, 51, .28), 0 0 90px rgba(255, 153, 51, .25);
}
.resultado.aberto .cartao { animation: entrarCartao .75s cubic-bezier(.18, 1.35, .4, 1) both; }
.resultado.aberto.derrota .cartao { animation: entrarCartao .75s cubic-bezier(.18, 1.35, .4, 1) both, balancar .6s ease-in-out .75s; }
@keyframes entrarCartao {
  from { opacity: 0; transform: scale(.55) translateY(60px) rotate(-4deg); }
  to   { opacity: 1; transform: none; }
}
@keyframes balancar {
  25% { transform: rotate(-2.5deg); }
  50% { transform: rotate(2deg); }
  75% { transform: rotate(-1deg); }
}

.medalha {
  position: absolute;
  left: 50%;
  top: 0;
  width: clamp(150px, 22vh, 190px);
  height: clamp(150px, 22vh, 190px);
  transform: translate(-50%, -55%);
}
.medalha-raios {
  position: absolute;
  inset: -45%;
  border-radius: 50%;
  background: repeating-conic-gradient(from 0deg, rgba(255, 200, 130, .45) 0deg 8deg, transparent 8deg 20deg);
  -webkit-mask-image: radial-gradient(circle, #000 20%, transparent 66%);
  mask-image: radial-gradient(circle, #000 20%, transparent 66%);
  animation: girarLento 12s linear infinite;
}
.resultado.derrota .medalha-raios { opacity: .25; }
.medalha-disco {
  position: absolute;
  inset: 8%;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--azul);
  background: radial-gradient(circle at 35% 30%, #ffd3a3 0%, #ff9933 50%, #e2700f 100%);
  box-shadow: 0 0 0 7px #fff, 0 0 0 13px rgba(255, 153, 51, .45), 0 18px 40px rgba(0, 0, 0, .45);
}
.resultado.aberto .medalha-disco { animation: entrarMedalha .9s cubic-bezier(.2, 1.6, .4, 1) .15s both; }
@keyframes entrarMedalha {
  from { transform: scale(0) rotate(-180deg); }
  to   { transform: none; }
}
.resultado.derrota .medalha-disco {
  color: #fff;
  background: radial-gradient(circle at 35% 30%, #5b8fe0 0%, #24539e 50%, #183c77 100%);
  box-shadow: 0 0 0 7px #fff, 0 0 0 13px rgba(91, 143, 224, .4), 0 18px 40px rgba(0, 0, 0, .45);
}
.medalha-disco svg { width: 50%; height: 50%; }
.resultado.derrota.aberto .medalha-disco svg { animation: girarIcone 1.2s ease-in-out .5s; }
@keyframes girarIcone { to { transform: rotate(360deg); } }

.resultado-sobre {
  font-family: 'Sora', sans-serif;
  font-weight: 800;
  font-size: clamp(1rem, 1.4vw, 1.3rem);
  letter-spacing: .3em;
  color: var(--laranja);
}
.resultado.derrota .resultado-sobre { color: #8fb4f0; }

.resultado-titulo {
  font-family: 'Sora', sans-serif;
  font-weight: 800;
  font-size: clamp(2rem, min(4.2vw, 7vh), 3.6rem);
  line-height: 1.06;
  letter-spacing: -.02em;
  margin: .25em 0 .35em;
}
.resultado-titulo .palavra { display: inline-block; white-space: nowrap; }
.resultado-titulo .letra {
  display: inline-block;
  animation: entrarLetra .55s cubic-bezier(.2, 1.6, .4, 1) both;
  animation-delay: calc(.35s + var(--d) * .03s);
}
@keyframes entrarLetra {
  from { opacity: 0; transform: translateY(.6em) scale(.4) rotate(-12deg); }
  to   { opacity: 1; transform: none; }
}

.resultado-sub {
  font-size: clamp(1rem, 1.3vw, 1.25rem);
  font-weight: 600;
  color: rgba(241, 241, 242, .88);
}
.resultado-imagem {
  display: none;
  width: 92px;
  margin: 18px auto 0;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 10px 24px rgba(0, 0, 0, .35);
}
.resultado-imagem.visivel { display: block; }
.resultado-nota {
  margin-top: 16px;
  font-size: clamp(.9rem, 1.1vw, 1.05rem);
  font-weight: 700;
  color: var(--laranja-claro);
}
.resultado-nota:empty { display: none; }

.botao-resultado {
  margin-top: clamp(20px, 3.5vh, 30px);
  font-family: 'Sora', sans-serif;
  font-weight: 800;
  font-size: clamp(1rem, 1.3vw, 1.2rem);
  letter-spacing: .06em;
  color: var(--azul);
  padding: .9em 2.2em;
  border: none;
  border-radius: 999px;
  cursor: pointer;
  background: linear-gradient(180deg, #ffc285, #ff9933 55%, #f2821f);
  box-shadow: 0 6px 0 #b9570b, 0 14px 30px rgba(255, 153, 51, .4);
  transition: transform .12s, box-shadow .12s;
}
.botao-resultado:active { transform: translateY(4px); box-shadow: 0 2px 0 #b9570b, 0 8px 20px rgba(255, 153, 51, .4); }

/* ---------- Painel do operador ---------- */

.painel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  width: min(540px, 100vw);
  display: flex;
  flex-direction: column;
  background: #0c2147;
  border-left: 1px solid rgba(255, 255, 255, .12);
  box-shadow: -30px 0 80px rgba(0, 0, 0, .5);
  transform: translateX(105%);
  transition: transform .4s cubic-bezier(.2, .8, .2, 1);
  -webkit-user-select: text;
  user-select: text;
}
.painel.aberto { transform: none; }

.painel-topo {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid rgba(255, 255, 255, .1);
}
.painel-topo h2 { font-family: 'Sora', sans-serif; font-size: 1.2rem; }
.painel-fechar {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, .15);
  background: transparent;
  color: #fff;
  cursor: pointer;
}

.painel-corpo { flex: 1; overflow-y: auto; padding: 8px 24px 28px; }
.painel-corpo h3 {
  margin: 22px 0 8px;
  font-size: .8rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--laranja-claro);
}
.painel-corpo h3 span { color: rgba(241, 241, 242, .6); letter-spacing: 0; text-transform: none; font-weight: 600; }
.painel-ajuda { font-size: .85rem; color: rgba(241, 241, 242, .7); line-height: 1.45; margin-bottom: 12px; }

.tabela { width: 100%; border-collapse: collapse; font-size: .88rem; }
.tabela th {
  text-align: left;
  font-size: .72rem;
  font-weight: 700;
  color: rgba(241, 241, 242, .55);
  padding: 6px 4px;
  border-bottom: 1px solid rgba(255, 255, 255, .1);
}
.tabela td { padding: 8px 4px; border-bottom: 1px solid rgba(255, 255, 255, .06); font-weight: 600; }
.tabela td:first-child { display: flex; align-items: center; gap: 8px; }
.tabela .cor { width: 12px; height: 12px; border-radius: 4px; flex: none; border: 1px solid rgba(255, 255, 255, .3); }
.tabela input {
  width: 64px;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, .2);
  background: rgba(255, 255, 255, .06);
  color: #fff;
  font: inherit;
}
.tabela input:focus { outline: 2px solid var(--laranja); outline-offset: 1px; }
.tabela .chance { color: var(--laranja-claro); }
.tabela .zerado { color: #ff8a80; }

.historico {
  list-style: none;
  max-height: 220px;
  overflow-y: auto;
  border-radius: 12px;
  background: rgba(0, 0, 0, .18);
  font-size: .85rem;
}
.historico li { display: flex; justify-content: space-between; gap: 12px; padding: 7px 12px; border-bottom: 1px solid rgba(255, 255, 255, .05); }
.historico li span:first-child { color: rgba(241, 241, 242, .55); font-variant-numeric: tabular-nums; }
.historico li.vazio { justify-content: center; color: rgba(241, 241, 242, .5); }

.painel-botoes { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.painel-botoes button {
  padding: 9px 14px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, .2);
  background: rgba(255, 255, 255, .06);
  color: #fff;
  font-weight: 700;
  font-size: .85rem;
  cursor: pointer;
}
.painel-botoes button:hover { background: rgba(255, 255, 255, .14); }

.atalhos { list-style: none; font-size: .85rem; color: rgba(241, 241, 242, .75); display: grid; gap: 8px; }

/* ---------- Aviso e confete ---------- */

.aviso {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 50;
  max-width: 90vw;
  padding: 14px 22px;
  border-radius: 14px;
  background: #fff;
  color: var(--azul);
  font-weight: 700;
  box-shadow: 0 20px 50px rgba(0, 0, 0, .45);
  transform: translate(-50%, calc(100% + 60px));
  visibility: hidden;
  transition: transform .4s cubic-bezier(.2, 1.3, .4, 1), visibility 0s .4s;
}
.aviso.visivel { transform: translate(-50%, 0); visibility: visible; transition: transform .4s cubic-bezier(.2, 1.3, .4, 1); }

.confete {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

/* ---------- Telas de toque ---------- */

.dica-toque { display: none; }

@media (hover: none) and (pointer: coarse) {
  .dica-teclado { display: none; }
  .dica-toque { display: inline; }
  .controle { width: 44px; height: 44px; opacity: .55; }
  .tabela input { font-size: 16px; }   /* evita o zoom automático do iOS ao focar */
  .so-teclado { display: none; }
}

/* ---------- Tablet deitado e telas médias ---------- */

@media (min-aspect-ratio: 5/4) and (max-width: 1180px) {
  :root { --tam: min(84vh, 56vw); }
  .app { gap: 3vw; padding-left: max(4vw, env(safe-area-inset-left)); padding-right: max(3vw, env(safe-area-inset-right)); }
  .premios { grid-template-columns: 1fr; gap: 1vh; }
  .premio { padding: .8vh 12px; }
  .premio .ic { width: 32px; height: 32px; }
  .lead { display: none; }
}

/* ---------- Celular deitado ---------- */

@media (min-aspect-ratio: 5/4) and (max-height: 540px) {
  :root { --tam: min(calc(100dvh - 40px), 56vw); }
  .app {
    gap: 3vw;
    padding:
      max(26px, env(safe-area-inset-top)) max(3vw, env(safe-area-inset-right))
      max(14px, env(safe-area-inset-bottom)) max(4vw, env(safe-area-inset-left));
  }
  .info { gap: 2.4vh; }
  .logo { width: clamp(120px, 20vw, 190px); margin: 0; }
  .selo { font-size: .7rem; }
  .titulo { font-size: min(4.6vw, 10vh); }
  .lead, .premios { display: none; }
  .acao { gap: 6px 16px; margin: 0; }
  .botao-girar { font-size: clamp(1.1rem, 6vh, 1.6rem); padding: .7em 2em; box-shadow: 0 6px 0 #b9570b, 0 12px 28px rgba(255, 153, 51, .45), inset 0 2px 0 rgba(255, 255, 255, .55); }
  .dica { font-size: .8rem; }
  .controles { top: max(10px, env(safe-area-inset-top)); right: max(10px, env(safe-area-inset-right)); }
  .controle { width: 38px; height: 38px; }
}

/* ---------- Em pé: celulares e tablets ----------
   O bloco de texto se dissolve na coluna principal para a roda ficar entre
   o título e o botão (perto do polegar). A roda ocupa todo o espaço que sobra. */

@media (max-aspect-ratio: 5/4) {
  .app {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: clamp(8px, 1.6vh, 20px);
    padding:
      max(14px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right))
      max(18px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  }
  .info { display: contents; }
  /* As margens alinham o logo à altura dos botões do canto e afastam o selo deles */
  .logo { order: 1; align-self: flex-start; width: clamp(130px, 40vw, 240px); margin: 6px 0 10px; }
  .selo { order: 2; font-size: clamp(.68rem, 2.2vw, .9rem); }
  .titulo { order: 3; text-align: center; font-size: clamp(1.55rem, 7.6vw, 3.4rem); text-wrap: balance; }
  .lead { display: none; }
  .premios { order: 4; display: none; }
  .roda-espaco {
    order: 5;
    flex: 1 1 0;
    min-height: 0;
    width: 100%;
    display: grid;
    place-items: center;
    container-type: size;
  }
  /* 95% da altura: o restante acomoda o ponteiro, que sobe acima da roda */
  .roda-area { --tam: min(100cqw, 95cqh); margin-top: calc(var(--tam) * .05); }
  .acao { order: 6; flex-direction: column; gap: 10px; margin: 0; }
  .botao-girar { font-size: clamp(1.25rem, 5.4vw, 2rem); padding: .75em 2.6em; }
  .dica { text-align: center; }
}

/* Tablet grande em pé: há espaço para a lista de prêmios */
@media (max-aspect-ratio: 5/4) and (min-width: 600px) and (min-height: 1100px) {
  .premios { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); max-width: 860px; gap: 10px; }
  .premio { flex-direction: column; justify-content: center; text-align: center; gap: 8px; padding: 12px 8px; font-size: clamp(.78rem, 1.7vw, .95rem); }
}

/* ---------- Resultado em telas baixas ---------- */

@media (max-height: 560px) {
  .resultado { padding: 10px; }
  .cartao { margin-top: 46px; padding: 54px 22px 18px; border-radius: 22px; }
  .medalha { width: 112px; height: 112px; }
  .medalha-disco { box-shadow: 0 0 0 5px #fff, 0 0 0 10px rgba(255, 153, 51, .45), 0 12px 30px rgba(0, 0, 0, .45); }
  .resultado-sobre { font-size: .85rem; }
  .resultado-titulo { font-size: clamp(1.4rem, 8vh, 2.2rem); margin: .15em 0 .25em; }
  .resultado-sub { font-size: .9rem; }
  .resultado-imagem { width: 56px; margin-top: 8px; border-radius: 12px; }
  .resultado-nota { margin-top: 8px; font-size: .85rem; }
  .botao-resultado { margin-top: 12px; padding: .75em 2em; }
}

@media (max-height: 420px) {
  .cartao { margin-top: 38px; padding-top: 46px; }
  .medalha { width: 96px; height: 96px; }
  .resultado-imagem.visivel { display: none; }
}

/* ---------- Painel em telas estreitas ---------- */

@media (max-width: 520px) {
  .painel-topo { padding: max(14px, env(safe-area-inset-top)) 16px 14px; }
  .painel-corpo { padding: 4px 14px max(24px, env(safe-area-inset-bottom)); }
  .tabela { font-size: .8rem; }
  .tabela th, .tabela td { padding-left: 2px; padding-right: 2px; }
  .tabela input { width: 52px; padding: 6px; }
}

@media (prefers-reduced-motion: reduce) {
  .orbe, .marca-dagua, .faiscas span, .raios { animation: none; }
}
