:root {
  --red-900: #3a0009;
  --red-800: #5a0010;
  --red-700: #8a0a1c;
  --red-600: #c8102e;
  --gold-300: #fff1b8;
  --gold-400: #ffd970;
  --gold-500: #f5b72a;
  --gold-600: #c98a10;
  --gold-700: #8a5a00;
  --cream: #fff8e7;
  --ink: #2a0a0a;
  --cell: min(27vw, 128px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  background:
    radial-gradient(120% 60% at 50% 0%, #a3122a 0%, transparent 60%),
    radial-gradient(80% 50% at 50% 100%, #6b0014 0%, transparent 70%),
    var(--red-900);
  color: var(--cream);
  font-family: "Nunito", system-ui, sans-serif;
  overflow-x: hidden;
  user-select: none;
  -webkit-user-select: none;
}

.app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: max(10px, env(safe-area-inset-top)) 16px max(12px, env(safe-area-inset-bottom));
  gap: 10px;
}

/* ---------- header ---------- */
.ticker {
  overflow: hidden;
  white-space: nowrap;
  border-radius: 999px;
  background: rgba(0,0,0,.35);
  border: 1px solid rgba(255,217,112,.35);
  font-size: 13px;
  padding: 5px 0;
  color: var(--gold-300);
}
.ticker span { display: inline-block; padding-left: 100%; animation: tick 22s linear infinite; }
@keyframes tick { to { transform: translateX(-100%); } }

.title { margin: 8px 0 0; text-align: center; line-height: 1; }
.title-small {
  display: inline-block;
  font: 800 12px/1 "Nunito", sans-serif;
  letter-spacing: .25em;
  text-transform: uppercase;
  background: var(--red-600);
  color: #fff;
  padding: 5px 10px 4px;
  border-radius: 6px;
  box-shadow: 0 2px 0 var(--red-900);
}
.title-big {
  display: block;
  margin-top: 6px;
  font-family: "Lilita One", "Nunito", sans-serif;
  font-size: clamp(38px, 12vw, 54px);
  background: linear-gradient(180deg, #fff6cf 0%, #ffd970 40%, #f5b72a 60%, #b07208 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 3px 0 var(--red-900)) drop-shadow(0 0 14px rgba(255,200,80,.35));
}
.title-big em { font-style: normal; font-size: .6em; }

/* ---------- machine ---------- */
.machine { position: relative; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.lanterns { position: absolute; inset: -6px -4px auto; display: flex; justify-content: space-between; pointer-events: none; z-index: 2; }
.lanterns i {
  width: 22px; height: 30px; border-radius: 45%;
  background: radial-gradient(circle at 40% 35%, #ffb3b3, var(--red-600) 55%, var(--red-800));
  box-shadow: 0 0 12px rgba(255,80,80,.6);
  position: relative;
  animation: sway 3s ease-in-out infinite;
  transform-origin: top center;
}
.lanterns i::before, .lanterns i::after { content: ""; position: absolute; left: 50%; transform: translateX(-50%); background: var(--gold-500); }
.lanterns i::before { top: -3px; width: 12px; height: 4px; border-radius: 2px; }
.lanterns i::after { bottom: -8px; width: 2px; height: 8px; }
.lanterns i:last-child { animation-delay: -1.5s; }
@keyframes sway { 50% { transform: rotate(6deg); } }

.frame {
  position: relative;
  padding: 10px;
  border-radius: 22px;
  background: linear-gradient(160deg, #ffe9a3, #e0a21c 35%, #8a5a00 70%, #f5c84a);
  box-shadow: 0 10px 30px rgba(0,0,0,.5), inset 0 2px 0 rgba(255,255,255,.6);
}
.reels {
  display: grid;
  grid-template-columns: repeat(3, var(--cell));
  gap: 6px;
  padding: 6px;
  border-radius: 14px;
  background: linear-gradient(180deg, #4a0610, #2a0208);
  box-shadow: inset 0 4px 12px rgba(0,0,0,.7);
}
.reel {
  height: calc(var(--cell) * 3);
  overflow: hidden;
  border-radius: 10px;
  background: linear-gradient(180deg, #fff8e7, #f6e2b3);
  position: relative;
}
.reel::before, .reel::after {
  content: ""; position: absolute; left: 0; right: 0; height: 18px; z-index: 1; pointer-events: none;
}
.reel::before { top: 0; background: linear-gradient(rgba(0,0,0,.25), transparent); }
.reel::after { bottom: 0; background: linear-gradient(transparent, rgba(0,0,0,.25)); }
.strip { will-change: transform; }
.strip.blur .cell > * { filter: blur(1.5px); }

.cell {
  height: var(--cell);
  display: grid;
  place-items: center;
  position: relative;
  padding: 8px;
}
.cell.win > * { animation: pop .6s ease-in-out infinite alternate; }
.cell.win::after {
  content: ""; position: absolute; inset: 3px; border-radius: 12px;
  border: 3px solid var(--gold-500);
  box-shadow: 0 0 14px var(--gold-400), inset 0 0 14px rgba(255,217,112,.6);
  animation: glow .6s ease-in-out infinite alternate;
}
.cell.dim > * { opacity: .35; filter: grayscale(.6); }
@keyframes pop { to { transform: scale(1.1); } }
@keyframes glow { to { opacity: .55; } }

/* símbolos */
.sym { width: 100%; height: 100%; display: grid; place-items: center; position: relative; }
.sym img { max-width: 100%; max-height: 100%; object-fit: contain; }
.sym-emoji { font-size: calc(var(--cell) * .52); line-height: 1; filter: drop-shadow(0 3px 2px rgba(0,0,0,.25)); }

.sym-lider .avatar {
  width: 86%; aspect-ratio: 1; border-radius: 50%;
  overflow: hidden;
  border: 4px solid var(--gold-500);
  box-shadow: 0 0 0 2px var(--gold-700), 0 4px 8px rgba(0,0,0,.35);
  background: var(--c, #888);
  display: grid; place-items: center;
}
.sym-lider .avatar img { width: 100%; height: 100%; object-fit: cover; max-width: none; max-height: none; }
.sym-lider .initials { font: 400 calc(var(--cell) * .3) "Lilita One", sans-serif; color: #fff; text-shadow: 0 2px 0 rgba(0,0,0,.3); }
.sym-lider .tag {
  position: absolute; bottom: 2px; left: 50%; transform: translateX(-50%);
  max-width: 110%;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  font-size: 10px; font-weight: 800;
  background: var(--red-600); color: #fff;
  padding: 2px 7px; border-radius: 999px;
  box-shadow: 0 2px 0 var(--red-900);
}

.fb-bni {
  width: 92%; aspect-ratio: 1.25;
  border-radius: 14px;
  background: linear-gradient(180deg, #e8233f, var(--red-600) 60%, #8a0a1c);
  border: 3px solid var(--gold-500);
  display: grid; place-items: center;
  font: 400 calc(var(--cell) * .34) "Lilita One", sans-serif;
  color: #fff; letter-spacing: .04em;
  text-shadow: 0 3px 0 rgba(0,0,0,.25);
  box-shadow: 0 4px 8px rgba(0,0,0,.3);
}
.fb-gg {
  width: 90%; aspect-ratio: 1; border-radius: 50%;
  background: radial-gradient(circle at 40% 30%, #fff3c4, var(--gold-500) 55%, var(--gold-700));
  border: 3px solid var(--red-600);
  display: grid; place-items: center; text-align: center;
  font: 400 calc(var(--cell) * .16)/1 "Lilita One", sans-serif;
  color: var(--red-800);
  box-shadow: 0 4px 8px rgba(0,0,0,.3);
}
.wild-tag {
  position: absolute; top: 2px; right: 2px;
  font-size: 9px; font-weight: 800; letter-spacing: .05em;
  background: var(--gold-500); color: var(--red-900);
  padding: 1px 5px; border-radius: 4px;
}

/* linhas de prêmio */
.lines { position: absolute; inset: 16px; width: calc(100% - 32px); height: calc(100% - 32px); pointer-events: none; z-index: 3; }
.lines polyline {
  fill: none; stroke: var(--gold-400); stroke-width: 5; stroke-linecap: round; stroke-linejoin: round;
  filter: drop-shadow(0 0 4px #ff9);
  stroke-dasharray: 600; stroke-dashoffset: 600;
  animation: draw .5s ease-out forwards;
  vector-effect: non-scaling-stroke;
}
@keyframes draw { to { stroke-dashoffset: 0; } }

.feature-banner {
  position: absolute; inset: 0; z-index: 4;
  display: grid; place-items: center; text-align: center;
  font: 400 clamp(30px, 10vw, 44px)/1 "Lilita One", sans-serif;
  color: var(--gold-300);
  text-shadow: 0 4px 0 var(--red-900), 0 0 20px #ffcc33;
  background: rgba(58,0,9,.7);
  border-radius: 22px;
  opacity: 0; pointer-events: none;
  transform: scale(.6);
  transition: opacity .3s, transform .3s cubic-bezier(.2,1.6,.4,1);
}
.feature-banner.show { opacity: 1; transform: scale(1); }
.machine.feature .frame { animation: feature-glow 1s ease-in-out infinite alternate; }
@keyframes feature-glow { to { box-shadow: 0 0 40px 8px #ffcc33, inset 0 2px 0 rgba(255,255,255,.6); } }

.win-bar {
  min-height: 40px; width: 100%;
  display: grid; place-items: center; text-align: center;
  padding: 6px 14px;
  border-radius: 12px;
  background: rgba(0,0,0,.35);
  border: 1px solid rgba(255,217,112,.3);
  color: var(--gold-300);
  font-weight: 800;
  font-size: 15px;
}
.win-bar.hit { color: #fff; background: linear-gradient(90deg, var(--red-700), var(--red-600), var(--red-700)); border-color: var(--gold-500); }

/* ---------- painel ---------- */
.panel { margin-top: auto; display: flex; flex-direction: column; gap: 12px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat {
  background: rgba(0,0,0,.35);
  border: 1px solid rgba(255,217,112,.3);
  border-radius: 12px;
  padding: 6px 8px;
  text-align: center;
}
.stat small { display: block; font-size: 11px; color: var(--gold-400); text-transform: uppercase; letter-spacing: .08em; }
.stat b { font: 400 19px "Lilita One", sans-serif; color: #fff; font-variant-numeric: tabular-nums; }

.controls { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.ctl {
  width: 54px; height: 54px; border-radius: 50%;
  border: 2px solid var(--gold-600);
  background: linear-gradient(180deg, var(--red-700), var(--red-800));
  color: var(--gold-300);
  font: 800 24px/1 "Nunito", sans-serif;
  display: grid; place-items: center; align-content: center;
  box-shadow: 0 3px 0 var(--red-900);
  cursor: pointer;
}
.ctl small { font-size: 9px; font-weight: 800; text-transform: uppercase; margin-top: 2px; }
.ctl:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--red-900); }
.ctl[aria-pressed="true"] { background: linear-gradient(180deg, var(--gold-400), var(--gold-600)); color: var(--red-900); }
.ctl:disabled { opacity: .45; }

.spin {
  width: 96px; height: 96px; border-radius: 50%;
  border: 4px solid var(--gold-300);
  background: radial-gradient(circle at 40% 30%, #fff1b8, var(--gold-500) 45%, var(--gold-700));
  box-shadow: 0 6px 0 var(--gold-700), 0 0 24px rgba(255,200,60,.5);
  color: var(--red-800);
  font: 400 48px/1 "Lilita One", sans-serif;
  cursor: pointer;
  display: grid; place-items: center;
}
.spin:active { transform: translateY(3px); box-shadow: 0 3px 0 var(--gold-700); }
.spin.spinning span { display: inline-block; animation: rot .6s linear infinite; }
.spin:disabled { filter: saturate(.6); }
@keyframes rot { to { transform: rotate(360deg); } }

.foot { display: flex; justify-content: space-between; }
.link { background: none; border: 0; color: var(--gold-400); font: 800 13px "Nunito", sans-serif; padding: 6px 2px; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.disclaimer { margin: 0; text-align: center; font-size: 11px; color: rgba(255,241,184,.55); }

/* ---------- overlays ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(20,0,4,.82);
  display: grid; place-items: center;
  padding: 16px;
  animation: fade .25s ease-out;
}
.overlay[hidden] { display: none; }
@keyframes fade { from { opacity: 0; } }

.bigwin-box { text-align: center; animation: zoom .5s cubic-bezier(.2,1.6,.4,1); }
@keyframes zoom { from { transform: scale(.3); } }
.bigwin-title {
  font: 400 clamp(32px, 11vw, 52px)/1.05 "Lilita One", sans-serif;
  background: linear-gradient(180deg, #fff6cf, #ffd970 45%, #c98a10);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 4px 0 var(--red-700));
}
.bigwin-amount { margin-top: 14px; font: 400 clamp(44px, 16vw, 72px)/1 "Lilita One", sans-serif; color: #fff; text-shadow: 0 0 24px #ffcc33, 0 4px 0 var(--red-700); font-variant-numeric: tabular-nums; }
.bigwin-tap { margin-top: 22px; font-size: 13px; color: var(--gold-300); opacity: .8; }

.sheet {
  width: 100%; max-width: 420px; max-height: 88dvh; overflow: auto;
  background: linear-gradient(180deg, #fff8e7, #f6e2b3);
  color: var(--ink);
  border-radius: 20px;
  border: 4px solid var(--gold-500);
  padding: 18px 18px 20px;
}
.sheet.center { text-align: center; }
.sheet h2 { margin: 0 0 6px; font: 400 26px "Lilita One", sans-serif; color: var(--red-700); }
.muted { font-size: 14px; color: #6b4a2a; margin: 6px 0 12px; }
.big-emoji { font-size: 64px; }
.pay-list { display: grid; gap: 6px; margin-bottom: 8px; }
.pay-row { display: grid; grid-template-columns: 56px 1fr auto; align-items: center; gap: 10px; background: rgba(255,255,255,.6); border-radius: 12px; padding: 4px 12px 4px 4px; }
.pay-row .icon { --cell: 56px; height: 56px; }
.pay-row .icon .sym-lider .tag { display: none; }
.pay-row .icon .wild-tag { display: none; }
.pay-row .name { font-weight: 800; font-size: 14px; }
.pay-row .mult { font: 400 20px "Lilita One", sans-serif; color: var(--red-700); }
.btn-gold {
  display: block; width: 100%; margin-top: 8px;
  border: 0; border-radius: 14px; padding: 14px;
  background: linear-gradient(180deg, var(--gold-400), var(--gold-600));
  color: var(--red-900); font: 400 20px "Lilita One", sans-serif;
  box-shadow: 0 4px 0 var(--gold-700);
  cursor: pointer;
}
.btn-gold:active { transform: translateY(2px); box-shadow: 0 2px 0 var(--gold-700); }

/* moedas caindo */
.coins { position: fixed; inset: 0; pointer-events: none; z-index: 60; overflow: hidden; }
.coin {
  position: absolute; top: -40px;
  width: 26px; height: 26px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff6cf, var(--gold-500) 50%, var(--gold-700));
  border: 2px solid var(--gold-700);
  display: grid; place-items: center;
  font: 400 12px "Lilita One", sans-serif; color: var(--gold-700);
  animation: fall linear forwards;
}
@keyframes fall { to { transform: translateY(calc(100dvh + 80px)) rotate(720deg); } }

@media (max-height: 700px) {
  :root { --cell: min(24vw, 96px); }
  .title-big { font-size: 34px; }
  .spin { width: 80px; height: 80px; font-size: 40px; }
  .ctl { width: 48px; height: 48px; }
}
@media (prefers-reduced-motion: reduce) {
  .ticker span, .lanterns i { animation: none; }
}
