* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

:root {
  --header-height: 92px;
  --bottom-ui-height: 145px;
}

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: Arial, Helvetica, sans-serif;
  background: #1c232b;
}

body {
  position: relative;
}

/* =========================
   PRELOADER
========================== */
.preloader-screen {
  position: fixed;
  inset: 0;
  background: #000;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 24px;
  transition: opacity .45s ease, visibility .45s ease;
}

.preloader-screen.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.preloader-logo {
  width: min(34vw, 220px);
  max-width: 220px;
  min-width: 120px;
  object-fit: contain;
  display: block;
  animation: preloaderPulse 1.3s ease-in-out infinite;
  filter: drop-shadow(0 0 18px rgba(255,255,255,.10));
}

.preloader-bar-wrap {
  width: min(78vw, 420px);
  height: 18px;
  border-radius: 999px;
  background: rgba(255,255,255,.10);
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.12);
  box-shadow: inset 0 2px 8px rgba(0,0,0,.45);
}

.preloader-bar {
  width: 0%;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #791111 0%, #e11a1a 55%, #ff8f1e 100%);
  box-shadow: 0 0 18px rgba(255, 60, 0, .35);
  transition: width .18s linear;
}

.preloader-percent {
  color: #fff;
  font-weight: 900;
  font-size: clamp(20px, 3vw, 28px);
  letter-spacing: 1px;
  text-shadow: 0 3px 10px rgba(0,0,0,.5);
}

@keyframes preloaderPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.04); }
}

/* =========================
   GAME WRAPPER
========================== */
.game-page {
  position: relative;
  width: 100%;
  height: 100%;
  background: #000;
  overflow: hidden;
}

.game-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  user-select: none;
  pointer-events: none;
}

.bg-mobile {
  display: none;
}

.bg-overlay {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at center, rgba(255,255,255,0.02) 0%, rgba(0,0,0,0.04) 30%, rgba(0,0,0,0.28) 100%),
    linear-gradient(to bottom, rgba(0,0,0,0.15) 0%, rgba(0,0,0,0.08) 20%, rgba(0,0,0,0.18) 100%);
  pointer-events: none;
  z-index: 1;
}

.ambient-glow {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 3;
  background:
    radial-gradient(circle at 20% 30%, rgba(255,170,0,.08), transparent 22%),
    radial-gradient(circle at 60% 18%, rgba(255,0,0,.07), transparent 25%),
    radial-gradient(circle at 72% 72%, rgba(255,90,0,.06), transparent 20%);
}

/* =========================
   TOP HEADER / LOGO
========================== */
.top-header {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: var(--header-height);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
  pointer-events: none;
  direction: ltr;
}

.top-header-inner {
  pointer-events: auto;
}

.logo-wrapper {
  position: relative;
  width: 320px;
  max-width: 90vw;
  margin: 0 auto;
}

.logo-bg {
  width: 100%;
  display: block;
}

.logo-text {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 65%;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

/* =========================
   FLOATING GIFTS
========================== */
.game-field {
  position: absolute;
  inset: 0;
  z-index: 8;
  overflow: hidden;
}

.gift {
  position: absolute;
  user-select: none;
  cursor: pointer;
  background: transparent;
  border: none;
  outline: none;
  padding: 0;
  bottom: -140px;
  aspect-ratio: 1 / 1;
  pointer-events: auto;
  will-change: transform, opacity;
}

.gift:hover {
  filter: brightness(1.08);
}

.gift:active {
  transform: scale(.95);
}

.gift-inner {
  position: relative;
  width: 100%;
  height: 100%;
}

.gift-inner.drifting {
  animation: driftSide 6s ease-in-out infinite;
}

.gift-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
  filter: drop-shadow(0 10px 14px rgba(0,0,0,.28));
  z-index: 1;
}

.gift-multi {
  position: absolute;
  left: 50%;
  bottom: 12%;
  transform: translateX(-50%);
  width: 55%;
  height: auto;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
  filter: drop-shadow(0 3px 8px rgba(0,0,0,.25));
  z-index: 2;
}

.gift.glow-1 .gift-inner { filter: drop-shadow(0 0 14px rgba(103,255,112,.22)); }
.gift.glow-2 .gift-inner { filter: drop-shadow(0 0 14px rgba(76,187,255,.22)); }
.gift.glow-3 .gift-inner { filter: drop-shadow(0 0 14px rgba(198,112,255,.24)); }
.gift.glow-4 .gift-inner { filter: drop-shadow(0 0 14px rgba(255,217,74,.25)); }
.gift.glow-5 .gift-inner { filter: drop-shadow(0 0 16px rgba(255,125,210,.25)); }

@keyframes floatUp {
  0% {
    transform: translateY(0);
    opacity: 1;
  }
  100% {
    transform: translateY(-120vh);
    opacity: 1;
  }
}

@keyframes driftSide {
  0%   { transform: translateX(0px); }
  50%  { transform: translateX(25px); }
  100% { transform: translateX(0px); }
}

@keyframes giftFail {
  0%   { transform: translateX(0); }
  20%  { transform: translateX(-6px); }
  40%  { transform: translateX(6px); }
  60%  { transform: translateX(-4px); }
  80%  { transform: translateX(4px); }
  100% { transform: translateX(0); }
}

.gift-failed {
  animation: giftFail .35s ease;
}

@keyframes giftPop {
  0%   { transform: scale(1); opacity: 1; }
  40%  { transform: scale(1.2); opacity: 1; }
  100% { transform: scale(0.2); opacity: 0; }
}

.gift.pop {
  animation: giftPop 0.5s ease forwards !important;
}

/* =========================
   GIFT INFO POPUP
========================== */
.gift-info-popup {
  position: absolute;
  z-index: 80;
  min-width: 120px;
  max-width: 180px;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(20, 10, 10, 0.92);
  color: #fff;
  border: 1px solid rgba(255,255,255,.12);
  box-shadow: 0 10px 24px rgba(0,0,0,.35);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  pointer-events: none;
  opacity: 0;
  transform: translateY(8px) scale(.96);
  transition: opacity .18s ease, transform .18s ease;
  direction: ltr;
}

.gift-info-popup.show {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.gift-info-popup .gift-info-line {
  font-size: 13px;
  font-weight: 700;
  line-height: 1.35;
  white-space: nowrap;
}

.gift-info-popup .gift-info-line + .gift-info-line {
  margin-top: 4px;
}

.gift-info-popup .gift-info-odds {
  color: #ffd36b;
}

.gift-info-popup .gift-info-clicks {
  color: #9fe8ff;
}

/* =========================
   CENTER BANNER
========================== */
.center-banner {
  position: absolute;
  top: 110px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 22;
  min-width: min(70vw, 360px);
  max-width: 88vw;
  padding: 14px 20px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(255,255,255,.16), rgba(255,255,255,.06));
  border: 1px solid rgba(255,255,255,.10);
  box-shadow: 0 12px 28px rgba(0,0,0,.22);
  text-align: center;
  color: #fff;
  font-weight: 900;
  font-size: clamp(16px, 2vw, 24px);
  letter-spacing: .4px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  text-shadow: 0 2px 8px rgba(0,0,0,.35);
  transition: opacity .25s ease, transform .25s ease;
  direction: ltr;
}

.center-banner.hidden {
  opacity: 0;
  transform: translateX(-50%) translateY(-12px);
  pointer-events: none;
}

/* =========================
   BOTTOM UI
========================== */
.bottom-ui {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  min-height: var(--bottom-ui-height);
  z-index: 25;
  padding: 18px 18px calc(18px + env(safe-area-inset-bottom));
  pointer-events: none;
}

.bottom-info,
.bottom-bet,
.bottom-center {
  position: absolute;
  bottom: calc(18px + env(safe-area-inset-bottom));
  pointer-events: auto;
}

.bottom-info {
  left: 18px;
  min-width: 170px;
  color: #fff;
  text-transform: uppercase;
  text-shadow: 0 3px 10px rgba(0,0,0,.45);
}

.bottom-center {
  left: 50%;
  transform: translateX(-50%);
  z-index: 40;
}

.bottom-bet {
  right: 18px;
  min-width: 220px;
  color: #fff;
  text-transform: uppercase;
  text-shadow: 0 3px 10px rgba(0,0,0,.45);
  text-align: right;
  z-index: 60;
  pointer-events: auto;
}

.info-label,
.bet-label {
  font-size: clamp(16px, 1.65vw, 24px);
  font-weight: 900;
  opacity: .94;
  margin-bottom: 6px;
}

.info-value,
.bet-value {
  font-size: clamp(18px, 2vw, 30px);
  font-weight: 900;
  line-height: 1.05;
}

.bet-control {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}

.bet-value {
  min-width: 120px;
  text-align: right;
}

.bet-arrows {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-shrink: 0;
}

.bet-arrow {
  display: block;
  width: 28px;
  height: 22px;
  border: none;
  background: transparent;
  cursor: pointer;
  position: relative;
  padding: 0;
  appearance: none;
  -webkit-appearance: none;
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  z-index: 61;
}

.bet-arrow::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 0;
  height: 0;
  transform: translate(-50%, -50%);
}

.bet-up::before {
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-bottom: 12px solid #fff;
}

.bet-down::before {
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-top: 12px solid #fff;
}

.bet-arrow:hover::before {
  filter: drop-shadow(0 0 6px rgba(255,255,255,.65));
}

.bet-arrow:active {
  transform: scale(0.95);
}

.start-wrap {
  position: relative;
  width: clamp(128px, 15vw, 220px);
  height: clamp(128px, 15vw, 220px);
  pointer-events: auto;
}

.start-btn {
  position: relative;
  width: 100%;
  height: 100%;
  border: none;
  outline: none;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform .18s ease, filter .18s ease;
}

.start-btn:hover {
  transform: scale(1.03);
  filter: brightness(1.05);
}

.start-btn:active {
  transform: scale(.97);
}

.start-btn img.start-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 10px 20px rgba(0,0,0,.35));
  pointer-events: none;
  user-select: none;
}

.start-btn img.start-icon {
  position: relative;
  width: 34%;
  height: 34%;
  object-fit: contain;
  z-index: 2;
  margin-left: 8px;
  filter: drop-shadow(0 4px 10px rgba(0,0,0,.30));
  pointer-events: none;
  user-select: none;
}

.start-btn.pulse {
  animation: startPulse 1.15s ease-in-out infinite;
}

@keyframes startPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.045); }
}

.start-wrap.hidden {
  display: none;
}

/* =========================
   HUD CHIP
========================== */
.hud-chip {
  position: absolute;
  top: 18px;
  left: 18px;
  z-index: 35;
  background: rgba(255, 210, 67, 0.95);
  color: #111;
  font-weight: 900;
  font-size: 24px;
  border-radius: 8px;
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 22px rgba(0,0,0,.24);
  direction: ltr;
}

/* =========================
   WIN TOAST
========================== */
.win-toast {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 60;
  min-width: min(72vw, 320px);
  max-width: 90vw;
  text-align: center;
  background: transparent;
  border: none;
  box-shadow: none;
  opacity: 0;
  pointer-events: none;
  transition: opacity .22s ease;
  direction: ltr;
}

.win-toast.show {
  opacity: 1;
}

.win-toast .toast-title {
  font-size: clamp(30px, 4.2vw, 52px);
  font-weight: 900;
  color: #ffd54a;
  line-height: 1;
  margin-bottom: 8px;
  text-transform: uppercase;
  text-shadow:
    0 2px 0 rgba(0,0,0,.45),
    0 6px 18px rgba(0,0,0,.45);
}

.win-toast .toast-sub {
  font-size: clamp(22px, 3vw, 34px);
  font-weight: 900;
  color: #ffd54a;
  line-height: 1.1;
  text-shadow:
    0 2px 0 rgba(0,0,0,.45),
    0 6px 18px rgba(0,0,0,.45);
}

.win-toast.big-win .toast-title,
.win-toast.big-win .toast-sub {
  animation: bigWinPulse 0.9s ease-in-out infinite;
  text-shadow:
    0 0 6px #ffd54a,
    0 0 12px #ffd54a,
    0 0 22px #ffb300,
    0 0 36px #ff8f00,
    0 2px 0 rgba(0,0,0,.45);
}

@keyframes bigWinPulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.08); }
  100% { transform: scale(1); }
}

/* =========================
   RESPONSIVE
========================== */
@media (max-width: 900px) {
  :root {
    --header-height: 78px;
    --bottom-ui-height: 125px;
  }

  .bg-desktop {
    display: none;
  }

  .bg-mobile {
    display: block;
  }

  .top-header {
    padding: 10px 10px;
  }

  .logo-wrapper {
    width: 260px;
    max-width: 88vw;
  }

  .center-banner {
    top: 88px;
    font-size: 14px;
    padding: 11px 14px;
  }

  .bottom-info,
  .bottom-bet,
  .bottom-center {
    bottom: calc(14px + env(safe-area-inset-bottom));
  }

  .bottom-info {
    left: 14px;
    min-width: 110px;
  }

  .bottom-bet {
    right: 14px;
    min-width: 130px;
  }

  .info-label,
  .bet-label {
    font-size: 13px;
  }

  .info-value,
  .bet-value {
    font-size: 16px;
  }

  .start-wrap {
    width: 118px;
    height: 118px;
  }

  .bet-control {
    gap: 8px;
  }

  .bet-arrow {
    width: 22px;
    height: 18px;
  }

  .bet-up::before {
    border-left: 7px solid transparent;
    border-right: 7px solid transparent;
    border-bottom: 10px solid #fff;
  }

  .bet-down::before {
    border-left: 7px solid transparent;
    border-right: 7px solid transparent;
    border-top: 10px solid #fff;
  }

  .hud-chip {
    top: 10px;
    left: 10px;
    width: 34px;
    height: 34px;
    font-size: 20px;
  }
}

@media (max-width: 520px) {
  .preloader-logo {
    width: 130px;
  }

  .logo-wrapper {
    width: 220px;
    max-width: 86vw;
  }

  .center-banner {
    width: calc(100vw - 24px);
  }

  .start-wrap {
    width: 112px;
    height: 112px;
  }

  .gift-multi {
    width: 58%;
  }
}