:root {
  --app-height: 100dvh;
  --cyan: #68f8ff;
  --mint: #39ff91;
  --green: #15ef72;
  --pink: #ff56d8;
  --rose: #ff7ac8;
  --violet: #842be8;
  --purple: #40106d;
  --yellow: #ffe86a;
  --orange: #ff9a24;
  --bg: #120320;
  --panel: rgba(55, 11, 86, 0.46);
  --panel-strong: rgba(38, 8, 68, 0.74);
  --stroke: rgba(255, 255, 255, 0.28);
  --text: #fff7ff;
  --muted: #e7c8ff;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; width: 100%; min-height: 100%; background: #120320; color: var(--text); overflow: hidden; }
body {
  font-family: 'Space Grotesk', system-ui, sans-serif;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  overscroll-behavior: none;
}
button, input, select { font: inherit; }
button { cursor: pointer; }

.bubble-app {
  min-height: var(--app-height);
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 50% 8%, rgba(255,255,255,.10), transparent 12%),
    linear-gradient(180deg, rgba(54,8,93,.08), rgba(13,2,28,.22)),
    url('assets/fundobolhabruxa.png') center / cover no-repeat,
    linear-gradient(180deg, #341063 0%, #9d2bc3 52%, #e159b2 100%);
  overflow: hidden;
}

.bubble-app::before,
.bubble-app::after {
  content: '';
  position: fixed;
  pointer-events: none;
  border-radius: 999px;
  filter: blur(18px);
  opacity: .95;
}
.bubble-app::before {
  width: 52vw;
  height: 52vw;
  left: -20vw;
  bottom: 7vh;
  background: radial-gradient(circle, rgba(255, 101, 220, .32), transparent 64%);
}
.bubble-app::after {
  width: 42vw;
  height: 42vw;
  right: -14vw;
  top: 3vh;
  background: radial-gradient(circle, rgba(98, 248, 255, .24), transparent 62%);
}

.game-shell {
  position: relative;
  width: min(100vw, 560px);
  height: var(--app-height);
  max-height: 980px;
  background:
    linear-gradient(180deg, rgba(61, 9, 110, .05), rgba(17, 3, 34, .16)),
    url('assets/fundobolhabruxa.png') center / cover no-repeat;
  overflow: hidden;
  isolation: isolate;
  box-shadow: 0 0 74px rgba(255, 86, 216, .32), 0 0 120px rgba(104, 248, 255, .14);
}
.game-shell::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 50% 35%, transparent 0 36%, rgba(76, 16, 116, .18) 54%, rgba(13, 2, 28, .42) 100%),
    linear-gradient(180deg, rgba(9, 2, 24, .04), rgba(39, 6, 65, .2));
}
.game-shell::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  border-left: 1px solid rgba(255,255,255,.18);
  border-right: 1px solid rgba(255,255,255,.1);
  box-shadow: inset 0 0 70px rgba(0,0,0,.18), inset 0 0 48px rgba(255,255,255,.04);
}

.hud-top {
  position: absolute;
  z-index: 10;
  top: max(10px, env(safe-area-inset-top));
  left: 12px;
  right: 12px;
  display: grid;
  grid-template-columns: .78fr 1.35fr .78fr;
  gap: 9px;
  align-items: start;
  pointer-events: none;
}
.hud-card,
.hud-center {
  pointer-events: auto;
  border: 1px solid rgba(255, 255, 255, .18);
  background: linear-gradient(180deg, rgba(74, 18, 104, .82), rgba(44, 8, 74, .48));
  box-shadow: 0 16px 34px rgba(21, 3, 38, .24), inset 0 1px 0 rgba(255,255,255,.18);
  backdrop-filter: blur(10px);
}
.hud-card {
  min-height: 50px;
  border-radius: 999px;
  padding: 8px 10px 7px;
  text-align: center;
}
.hud-card span,
.hud-card em,
.hud-center small {
  display: block;
  color: #ffd8ff;
  font-size: 8.5px;
  line-height: 1.05;
  font-weight: 1000;
  text-transform: uppercase;
  letter-spacing: .55px;
  text-shadow: 0 1px 0 rgba(0,0,0,.3);
}
.hud-card strong {
  display: block;
  margin-top: 2px;
  color: var(--yellow);
  font-size: clamp(12px, 3.2vw, 17px);
  line-height: 1;
  font-weight: 1000;
  text-shadow: 0 3px 0 rgba(65, 11, 83, .75), 0 0 12px rgba(255, 232, 106, .36);
  white-space: nowrap;
}
.hud-card em { margin-top: 3px; color: #fff4a8; font-style: normal; text-transform: none; letter-spacing: 0; }
.hud-card.right { text-align: center; }
.hud-center {
  min-height: 70px;
  padding: 9px 12px 8px;
  border-radius: 18px;
  text-align: center;
  background: linear-gradient(180deg, rgba(89, 20, 130, .88), rgba(28, 6, 59, .64));
}
.hud-center b {
  display: block;
  color: var(--mint);
  font-family: 'Bangers', cursive;
  font-size: clamp(30px, 8.2vw, 50px);
  letter-spacing: .8px;
  line-height: .82;
  font-weight: 900;
  text-shadow: 0 4px 0 #073d2a, 0 0 20px rgba(57,255,145,.5);
  white-space: nowrap;
}
.hud-center small { margin-top: 5px; color: #f5dcff; text-transform: none; letter-spacing: 0; }
.progress-track {
  width: min(100%, 205px);
  height: 9px;
  margin: 8px auto 0;
  border: 1px solid rgba(255,255,255,.55);
  background: rgba(35, 7, 58, .64);
  border-radius: 999px;
  overflow: hidden;
  box-shadow: inset 0 2px 5px rgba(0,0,0,.3);
}
.progress-track i {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--mint), #c7ff77, var(--yellow));
  box-shadow: 0 0 16px rgba(57,255,145,.72);
  transition: width .16s linear;
}
.exit-btn {
  margin-top: 5px;
  border: 1px solid rgba(255,255,255,.18);
  background: rgba(40, 7, 66, .62);
  color: #fff;
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 10px;
  line-height: 1.1;
  font-weight: 1000;
}

.arena-wrap { position: absolute; inset: 0; z-index: 2; overflow: hidden; }
#gameCanvas { width: 100%; height: 100%; display: block; touch-action: none; image-rendering: auto; background: transparent; }

.bottom-panel {
  position: absolute;
  z-index: 12;
  inset: auto 0 0;
  height: 154px;
  pointer-events: none;
}
.next-bubble-card,
.sound-btn,
.cashout-btn {
  pointer-events: auto;
  border: 1px solid rgba(255,255,255,.22);
  color: #fff;
  box-shadow: 0 15px 34px rgba(29, 3, 47, .28), inset 0 1px 0 rgba(255,255,255,.15);
  backdrop-filter: blur(10px);
}
.next-bubble-card {
  position: absolute;
  right: calc(50% - min(35vw, 112px));
  bottom: max(92px, calc(env(safe-area-inset-bottom) + 92px));
  width: 46px;
  height: 54px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
  pointer-events: none;
}
.next-bubble-card::before,
.next-bubble-card::after {
  display: none;
}
@keyframes nextSpin { to { transform: rotate(360deg); } }
.next-bubble-card span {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  color: rgba(255,255,255,.82);
  font-size: 7.5px;
  text-transform: uppercase;
  text-align: center;
  font-weight: 1000;
  letter-spacing: .55px;
  text-shadow: 0 2px 5px rgba(0,0,0,.58), 0 0 8px rgba(255,255,255,.18);
}
.next-orb {
  position: relative;
  z-index: 1;
  width: 32px;
  height: 32px;
  margin-top: -11px;
  border-radius: 50%;
  background: transparent center / cover no-repeat;
  box-shadow: 0 0 15px rgba(255,255,255,.35), 0 5px 10px rgba(16, 2, 28, .32);
}
.cashout-btn {
  position: absolute;
  left: 50%;
  bottom: max(13px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: min(330px, calc(100vw - 136px));
  min-height: 58px;
  border-radius: 18px;
  font-size: 15px;
  font-weight: 1000;
  background: linear-gradient(135deg, rgba(52, 9, 80, .72), rgba(26, 4, 44, .64));
  color: rgba(255,255,255,.66);
}
.cashout-btn.ready {
  color: #220719;
  background: linear-gradient(135deg, #fff08a, #ffad30 48%, #ff5d87);
  box-shadow: 0 0 30px rgba(255, 173, 48, .5), 0 15px 34px rgba(29, 3, 47, .3);
  animation: cashPulse 1.05s ease-in-out infinite;
}
@keyframes cashPulse { 50% { transform: translateX(-50%) scale(1.025); filter: brightness(1.07); } }
.sound-btn {
  position: absolute;
  right: 14px;
  bottom: max(15px, env(safe-area-inset-bottom));
  width: 54px;
  height: 54px;
  border-radius: 17px;
  background: rgba(34, 6, 55, .58);
  color: var(--yellow);
  font-size: 23px;
  font-weight: 1000;
}
.sound-btn.muted { color: #908299; }

.modal-layer {
  position: absolute;
  z-index: 20;
  inset: 0;
  display: none;
  place-items: center;
  padding: max(18px, env(safe-area-inset-top)) 18px max(18px, env(safe-area-inset-bottom));
  background: radial-gradient(circle at 50% 42%, rgba(255,86,216,.12), rgba(14,3,28,.72));
  backdrop-filter: blur(10px);
}
.modal-layer.active { display: grid; }
.modal-card {
  position: relative;
  width: min(100%, 410px);
  border-radius: 30px;
  border: 1px solid rgba(255,255,255,.2);
  background:
    radial-gradient(circle at 50% 0%, rgba(104,248,255,.18), transparent 34%),
    linear-gradient(180deg, rgba(86, 18, 126, .96), rgba(31, 5, 58, .98));
  padding: 26px 22px 22px;
  box-shadow: 0 26px 80px rgba(0,0,0,.45), 0 0 44px rgba(255,86,216,.2);
  text-align: center;
  overflow: hidden;
}
.modal-card::before { content: ''; position: absolute; inset: 14px; border: 1px solid rgba(255,255,255,.06); border-radius: 24px; pointer-events: none; }
.bubble-logo { width: 82px; height: 82px; margin: 0 auto 12px; border-radius: 50%; background: radial-gradient(circle at 32% 24%, #fff, var(--cyan) 18%, #ff56d8 56%, #5b13bd); box-shadow: 0 0 36px rgba(255,86,216,.42); position: relative; }
.bubble-logo::after { content: ''; position: absolute; left: 20px; top: 15px; width: 22px; height: 14px; background: rgba(255,255,255,.82); border-radius: 50%; transform: rotate(-28deg); }
.eyebrow { display: inline-flex; justify-content: center; align-items: center; gap: 7px; margin: 0 0 9px; color: var(--cyan); text-transform: uppercase; font-size: 11px; letter-spacing: 1.4px; font-weight: 1000; }
.modal-card h1,
.modal-card h2 { margin: 0; font-size: clamp(30px, 9vw, 46px); line-height: .95; font-family: 'Bangers', cursive; letter-spacing: 1px; color: #fff; text-shadow: 0 4px 0 rgba(0,0,0,.38); }
.modal-text { margin: 14px auto 18px; max-width: 310px; color: #f2dcff; font-weight: 800; line-height: 1.45; }
.primary-btn,
.ghost-btn { width: 100%; min-height: 58px; border: 0; border-radius: 19px; font-weight: 1000; font-size: 15px; }
.primary-btn { color: #1f062d; background: linear-gradient(135deg, var(--mint), var(--cyan), #fff08a); box-shadow: 0 15px 35px rgba(104,248,255,.24); }
.ghost-btn { margin-top: 10px; color: #fff; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.14); }
.prize-box { margin: 14px 0 18px; border-radius: 22px; border: 1px solid rgba(255,232,106,.35); background: rgba(255,232,106,.1); padding: 16px 12px; }
.prize-box span { display: block; color: var(--yellow); font-size: clamp(34px, 10vw, 54px); font-weight: 1000; line-height: .95; text-shadow: 0 4px 0 rgba(0,0,0,.35); }

.bet-layer .modal-card { text-align: left; }
.bet-layer h2 { text-align: center; }
.bet-subtitle { text-align: center; color: #f2dcff; font-weight: 800; line-height: 1.4; margin: 10px 0 18px; }
.bet-control { display: grid; grid-template-columns: 58px 1fr 58px; gap: 10px; align-items: center; margin: 10px 0; }
.bet-control button { height: 58px; border-radius: 17px; border: 1px solid rgba(255,255,255,.2); background: rgba(255,255,255,.08); color: #fff; font-weight: 1000; font-size: 24px; }
.bet-display { min-height: 58px; display: grid; place-items: center; border: 1px solid rgba(255,255,255,.22); background: rgba(0,0,0,.24); border-radius: 17px; color: var(--yellow); font-size: 25px; font-weight: 1000; }
.bet-presets { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 12px 0 14px; }
.bet-presets button { min-height: 48px; border-radius: 15px; border: 1px solid rgba(255,255,255,.16); background: rgba(255,255,255,.07); color: #fff; font-weight: 1000; }
.bet-info { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 13px 0 15px; }
.bet-chip { border: 1px solid rgba(255,255,255,.14); background: rgba(255,255,255,.07); border-radius: 15px; padding: 12px; text-align: center; }
.bet-chip span { display: block; color: #e7c8ff; text-transform: uppercase; font-size: 10px; font-weight: 1000; }
.bet-chip strong { display: block; margin-top: 4px; color: #fff; font-size: 16px; }

.toast-stack { position: absolute; z-index: 30; top: 118px; left: 0; right: 0; display: grid; justify-content: center; gap: 8px; pointer-events: none; }
.toast { padding: 9px 13px; border: 1px solid rgba(255,255,255,.22); border-radius: 999px; background: rgba(47,8,78,.68); color: #fff; font-weight: 1000; box-shadow: 0 12px 25px rgba(0,0,0,.28); animation: toastRise .9s ease forwards; }
@keyframes toastRise { 0% { opacity: 0; transform: translateY(18px) scale(.92); } 20%, 76% { opacity: 1; } 100% { opacity: 0; transform: translateY(-20px) scale(1.02); } }


.game-shell.tutorial-focus .hud-top,
.game-shell.tutorial-focus .arena-wrap,
.game-shell.tutorial-focus .bottom-panel {
  filter: blur(3px) brightness(0.72) saturate(0.9);
  transition: filter 0.18s ease;
}

.demo-tutorial-scrim {
  position: absolute;
  inset: 0;
  z-index: 34;
  display: none;
  pointer-events: none;
  background:
    radial-gradient(circle at 50% 70%, rgba(255, 235, 171, 0.12), transparent 19%),
    linear-gradient(180deg, rgba(22, 6, 48, 0.18), rgba(12, 2, 28, 0.42));
  backdrop-filter: blur(2px);
}

.demo-tutorial-scrim.active {
  display: block;
}
.demo-tutorial {
  position: absolute;
  z-index: 36;
  left: 50%;
  width: min(288px, calc(100% - 28px));
  display: none;
  align-items: center;
  gap: 8px;
  padding: 8px 9px 8px 10px;
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 17px;
  background:
    radial-gradient(circle at 18% 0%, rgba(255,255,255,.18), transparent 32%),
    linear-gradient(135deg, rgba(72, 13, 105, .9), rgba(28, 4, 55, .82));
  box-shadow: 0 12px 25px rgba(20, 2, 38, .28), inset 0 1px 0 rgba(255,255,255,.15);
  backdrop-filter: blur(10px);
  color: #fff;
  pointer-events: none;
  transform: translateX(-50%) translateY(8px) scale(.98);
  opacity: 0;
}
.demo-tutorial.active {
  display: flex;
  animation: tutorialPop .24s ease forwards;
}
.demo-tutorial.is-bottom { bottom: max(154px, calc(env(safe-area-inset-bottom) + 154px)); }
.demo-tutorial.is-top { top: max(86px, calc(env(safe-area-inset-top) + 86px)); }
.demo-tutorial.is-middle { top: 48%; }
.demo-tutorial.is-cashout { bottom: max(78px, calc(env(safe-area-inset-bottom) + 78px)); }
.demo-tutorial.is-side {
  left: 12px;
  bottom: max(168px, calc(env(safe-area-inset-bottom) + 168px));
  width: min(252px, calc(100% - 24px));
  transform: translateY(8px) scale(.98);
}
.demo-tutorial.is-side.active {
  animation: tutorialPopSide .22s ease forwards;
}
.demo-tutorial.is-side::after {
  left: 34px;
  transform: rotate(45deg);
}
@keyframes tutorialPopSide {
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.demo-tutorial::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: -9px;
  width: 18px;
  height: 18px;
  background: rgba(28, 4, 55, .88);
  border-right: 1px solid rgba(255,255,255,.18);
  border-bottom: 1px solid rgba(255,255,255,.18);
  transform: translateX(-50%) rotate(45deg);
}
.demo-tutorial.is-top::after,
.demo-tutorial.is-middle::after {
  top: -9px;
  bottom: auto;
  border: 0;
  border-left: 1px solid rgba(255,255,255,.18);
  border-top: 1px solid rgba(255,255,255,.18);
}
.demo-tutorial-orb {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: radial-gradient(circle at 32% 25%, #fff 0 10%, var(--cyan) 18%, #ff56d8 58%, #411073 100%);
  color: #fff;
  font-size: 7px;
  font-weight: 1000;
  text-transform: uppercase;
  letter-spacing: .35px;
  box-shadow: 0 0 15px rgba(255,86,216,.4), inset -5px -7px 9px rgba(0,0,0,.2);
}
.demo-tutorial-copy { flex: 1; min-width: 0; }
.demo-tutorial-copy span { display: block; margin-bottom: 1px; color: var(--cyan); font-size: 7px; font-weight: 1000; text-transform: uppercase; letter-spacing: .65px; }
.demo-tutorial-copy strong { display: block; font-size: 13px; line-height: 1; font-weight: 1000; color: #fff7be; text-shadow: 0 2px 0 rgba(0,0,0,.24); }
.demo-tutorial-copy p { margin: 3px 0 0; color: #f5dcff; font-size: 10.5px; font-weight: 800; line-height: 1.18; }
.demo-tutorial-copy em { display: inline-flex; margin-top: 5px; padding: 3px 7px; border-radius: 999px; background: rgba(255,255,255,.11); color: #fff; font-size: 8px; line-height: 1; font-style: normal; font-weight: 1000; text-transform: uppercase; letter-spacing: .45px; }
.demo-tutorial-skip { align-self: flex-start; pointer-events: auto; border: 1px solid rgba(255,255,255,.16); border-radius: 999px; background: rgba(255,255,255,.08); color: rgba(255,255,255,.82); padding: 4px 7px; font-size: 8px; font-weight: 1000; }
@keyframes tutorialPop {
  to { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
}
.shake { animation: shake .28s linear; }
@keyframes shake { 20% { transform: translateX(-8px); } 40% { transform: translateX(7px); } 60% { transform: translateX(-5px); } 80% { transform: translateX(4px); } }

@media (min-width: 760px) {
  body { overflow: auto; }
  .bubble-app { min-height: 100vh; padding: 18px 0; }
  .game-shell { border-radius: 28px; height: min(940px, calc(100vh - 36px)); border: 1px solid rgba(255,255,255,.16); }
}

@media (max-width: 390px) {
  .hud-top { left: 7px; right: 7px; gap: 5px; grid-template-columns: .72fr 1.2fr .72fr; }
  .hud-card { min-height: 46px; padding: 7px 7px 6px; }
  .hud-card strong { font-size: 11.5px; }
  .hud-card span, .hud-card em, .hud-center small { font-size: 7.4px; }
  .hud-center { min-height: 64px; padding: 8px 8px 7px; border-radius: 16px; }
  .hud-center b { font-size: clamp(27px, 7.6vw, 36px); text-shadow: 0 3px 0 #073d2a, 0 0 16px rgba(57,255,145,.46); }
  .progress-track { height: 7px; margin-top: 7px; }
  .exit-btn { margin-top: 4px; padding: 4px 8px; font-size: 9px; }
  .next-bubble-card { right: calc(50% - 104px); width: 42px; height: 52px; }
  .next-orb { width: 30px; height: 30px; }
  .demo-tutorial { width: min(270px, calc(100% - 22px)); padding: 7px 8px; gap: 7px; }
  .demo-tutorial.is-side { left: 9px; bottom: max(164px, calc(env(safe-area-inset-bottom) + 164px)); width: min(232px, calc(100% - 18px)); }
  .demo-tutorial-orb { width: 31px; height: 31px; flex-basis: 31px; font-size: 6.5px; }
  .demo-tutorial-copy span { font-size: 6.8px; }
  .demo-tutorial-copy strong { font-size: 12px; }
  .demo-tutorial-copy p { font-size: 10px; }
  .demo-tutorial-copy em { font-size: 7.5px; padding: 3px 6px; }
  .demo-tutorial-skip { padding: 4px 6px; font-size: 7.5px; }
  .sound-btn { right: 9px; width: 49px; height: 49px; border-radius: 16px; }
  .cashout-btn { width: min(292px, calc(100vw - 116px)); min-height: 52px; font-size: 13px; }
  .modal-layer { padding-left: 12px; padding-right: 12px; }
  .modal-card { padding: 22px 16px 18px; border-radius: 25px; }
}

