/* Spinters — игровой UI (Brawl-inspired) */

.game-ui {
  --game-bg-0: #0a0f2e;
  --game-bg-1: #1a0f3d;
  --game-bg-2: #2a1a5c;
  --game-gold: #ffd34a;
  --game-gold-dark: #c98a00;
  --game-cyan: #4de8ff;
  --game-pink: #ff4fd8;
  --game-purple: #7b5cff;
  --game-panel: rgba(18, 14, 48, 0.88);
  --game-panel-border: rgba(255, 255, 255, 0.14);
  --game-text: #f4f7ff;
  --game-text-soft: #b8c4e8;
  --game-shadow: 0 14px 32px rgba(2, 4, 18, 0.55);
  --game-radius: 18px;
  --game-font-display: 'Bangers', 'Tektur', cursive;
  --game-font-ui: 'Nunito', 'Exo 2', sans-serif;
}

.game-ui body,
.game-ui {
  font-family: var(--game-font-ui);
}

.game-ui body {
  background:
    radial-gradient(900px 520px at 88% -8%, rgba(77, 232, 255, 0.28), transparent 58%),
    radial-gradient(760px 480px at -12% 18%, rgba(255, 79, 216, 0.26), transparent 55%),
    radial-gradient(500px 400px at 50% 100%, rgba(123, 92, 255, 0.15), transparent 70%),
    linear-gradient(165deg, #0c1238 0%, #1a1050 40%, #281868 100%) !important;
  color: var(--game-text);
}

.game-bg-glow {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(420px 280px at 50% 12%, rgba(255, 211, 74, 0.12), transparent 70%),
    radial-gradient(360px 240px at 20% 80%, rgba(123, 92, 255, 0.1), transparent 72%);
  animation: gameGlowPulse 8s ease-in-out infinite alternate;
}

@keyframes gameGlowPulse {
  from { opacity: 0.65; transform: scale(1); }
  to { opacity: 1; transform: scale(1.04); }
}

.game-ui .app-shell {
  z-index: 2;
  padding-top: calc(118px + env(safe-area-inset-top, 0px)) !important;
  padding-bottom: calc(76px + env(safe-area-inset-bottom, 0px)) !important;
}

/* Шапка: ниже UI Telegram, по центру */
.game-ui .game-topbar {
  display: block !important;
  padding: 0 14px 10px !important;
  background: linear-gradient(180deg, rgba(8, 10, 32, 0.94), rgba(8, 10, 32, 0)) !important;
  pointer-events: none;
}

.game-ui .app-shell {
  overflow-x: hidden;
  overflow-y: visible;
  -webkit-overflow-scrolling: touch;
}

.game-ui .giveaways-list,
.game-ui .my-parts-list,
.game-ui #tasksList,
.game-ui .proposals-list {
  max-height: none !important;
  overflow: visible !important;
  overscroll-behavior: auto !important;
}

.game-ui .game-header-stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: 100%;
  max-width: min(980px, 100%);
  margin: 0 auto;
  padding-top: calc(52px + env(safe-area-inset-top, 0px));
  pointer-events: auto;
}

.game-ui .game-brand {
  margin: 0;
  padding: 0;
  font-family: var(--game-font-display);
  font-size: clamp(34px, 9vw, 44px);
  font-weight: 400;
  line-height: 0.95;
  text-align: center;
  letter-spacing: 0.04em;
  color: #fff4a8;
  -webkit-text-stroke: 2px #3b2200;
  paint-order: stroke fill;
  text-shadow:
    0 3px 0 #9a5f00,
    0 5px 0 rgba(20, 8, 0, 0.55),
    0 0 28px rgba(255, 220, 90, 0.35);
  filter: drop-shadow(0 4px 0 rgba(0, 0, 0, 0.35));
  animation: brandWiggle 4s ease-in-out infinite;
}

@keyframes brandWiggle {
  0%, 100% { transform: rotate(-1deg) scale(1); }
  50% { transform: rotate(1deg) scale(1.02); }
}

.game-ui .game-point-chip {
  align-self: flex-end;
  margin-top: 2px;
  padding: 7px 14px !important;
  border-radius: 999px !important;
  border: 2px solid rgba(255, 220, 120, 0.45) !important;
  background: linear-gradient(180deg, rgba(255, 240, 160, 0.22), rgba(30, 18, 8, 0.55)) !important;
  color: #fff6d8 !important;
  font-size: 12px !important;
  font-weight: 800 !important;
  box-shadow:
    0 3px 0 rgba(0, 0, 0, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.25) !important;
}

@media (max-width: 380px) {
  .game-ui .game-brand {
    font-size: 30px;
  }
}

/* Panels — мультяшные «пузырьки» */
.game-ui .game-panel,
.game-ui .wheel-zone,
.game-ui .media-card,
.game-ui .donate-card,
.game-ui .donations-card,
.game-ui .participants-card,
.game-ui .profile-card,
.game-ui .my-history-card,
.game-ui .my-actions-card,
.game-ui .winner-card,
.game-ui .upcoming-card,
.game-ui .profile-participations-card {
  border-radius: 20px !important;
  border: 3px solid rgba(255, 255, 255, 0.22) !important;
  background:
    linear-gradient(165deg, rgba(255, 255, 255, 0.12) 0%, rgba(255, 255, 255, 0.02) 38%, rgba(12, 8, 40, 0.94) 100%) !important;
  box-shadow:
    0 10px 0 rgba(0, 0, 0, 0.28),
    0 16px 32px rgba(2, 4, 18, 0.45),
    inset 0 2px 0 rgba(255, 255, 255, 0.14) !important;
  backdrop-filter: blur(10px);
}

.game-ui .game-section-head h2,
.game-ui .card-head h2 {
  font-family: var(--game-font-display) !important;
  font-size: 22px !important;
  font-weight: 400 !important;
  letter-spacing: 0.04em;
  color: var(--game-gold) !important;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.35);
}

.game-ui .card-head span {
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(123, 92, 255, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.18);
  font-weight: 800;
}

/* Search & filters */
.game-ui .giveaway-search-input {
  border-radius: 14px !important;
  border: 2px solid rgba(255, 255, 255, 0.16) !important;
  background: rgba(8, 12, 36, 0.75) !important;
  font-weight: 700;
}

.game-ui .giveaway-search-input:focus {
  border-color: rgba(77, 232, 255, 0.55) !important;
  box-shadow: 0 0 0 3px rgba(77, 232, 255, 0.18);
}

.game-ui .filter-btn {
  border-radius: 14px !important;
  border: 2px solid rgba(90, 70, 180, 0.45) !important;
  background: linear-gradient(180deg, rgba(70, 48, 140, 0.55), rgba(28, 18, 68, 0.88)) !important;
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.08) !important;
  transition: transform 120ms ease, border-color 120ms ease, background 120ms ease;
}

.game-ui .filter-btn:active {
  transform: scale(0.98);
}

.game-ui .filter-btn strong {
  color: var(--game-cyan) !important;
}

/* Raffle cards */
.game-ui .giveaway-item {
  border-radius: 18px !important;
  border: 3px solid rgba(30, 18, 70, 0.9) !important;
  background:
    linear-gradient(145deg, rgba(100, 70, 200, 0.45) 0%, rgba(42, 26, 96, 0.96) 48%, rgba(22, 14, 56, 0.98) 100%) !important;
  box-shadow:
    0 6px 0 rgba(0, 0, 0, 0.32),
    0 12px 24px rgba(2, 6, 22, 0.38) !important;
  padding: 11px !important;
  transition:
    transform 180ms cubic-bezier(0.22, 0.9, 0.32, 1),
    border-color 180ms ease,
    box-shadow 180ms ease;
  animation: cardRise 420ms cubic-bezier(0.22, 0.9, 0.32, 1) both;
}

.game-ui .giveaways-list .giveaway-item:nth-child(1) { animation-delay: 40ms; }
.game-ui .giveaways-list .giveaway-item:nth-child(2) { animation-delay: 80ms; }
.game-ui .giveaways-list .giveaway-item:nth-child(3) { animation-delay: 120ms; }
.game-ui .giveaways-list .giveaway-item:nth-child(4) { animation-delay: 160ms; }
.game-ui .giveaways-list .giveaway-item:nth-child(n+5) { animation-delay: 200ms; }

@keyframes cardRise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.game-ui .giveaway-item:hover,
.game-ui .giveaway-item:focus-visible {
  transform: translateY(-2px) scale(1.01);
  border-color: rgba(255, 211, 74, 0.45) !important;
  box-shadow: 0 14px 28px rgba(40, 20, 90, 0.45) !important;
}

.game-ui .giveaway-item.active {
  border-color: rgba(255, 211, 74, 0.75) !important;
  background:
    linear-gradient(135deg, rgba(255, 211, 74, 0.22), rgba(123, 92, 255, 0.2)) !important;
  box-shadow:
    0 0 0 1px rgba(255, 211, 74, 0.35),
    0 14px 30px rgba(80, 40, 10, 0.35) !important;
}

.game-ui .giveaway-item-thumb {
  border-radius: 16px !important;
  border: 3px solid rgba(255, 255, 255, 0.35) !important;
  box-shadow:
    0 4px 0 rgba(0, 0, 0, 0.35),
    inset 0 -4px 0 rgba(0, 0, 0, 0.2);
}

.game-ui .giveaway-item-thumb-fallback {
  font-size: 26px !important;
}

.game-ui .giveaway-item-title {
  font-weight: 900 !important;
  font-size: 15px !important;
  color: #fff !important;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.45);
}

.game-ui .giveaway-item-meta {
  color: var(--game-text-soft) !important;
  font-size: 11px !important;
}

.game-ui .giveaway-badge {
  border-radius: 10px !important;
  font-weight: 900 !important;
  font-size: 10px !important;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  border: 2px solid rgba(0, 0, 0, 0.25) !important;
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.25);
}

.game-ui .giveaway-badge.status-active,
.game-ui .giveaway-badge.status-spinning {
  background: linear-gradient(180deg, #ff5b7a, #d91e45) !important;
  color: #fff !important;
  animation: tagPulse 1.6s ease-in-out infinite;
}

.game-ui .giveaway-badge.status-scheduled {
  background: linear-gradient(180deg, #5dffb1, #12b86a) !important;
  color: #042a18 !important;
}

.game-ui .giveaway-badge.new-for-user {
  background: linear-gradient(180deg, #7cf0ff, #2aabff) !important;
  color: #042238 !important;
}

.game-ui .giveaway-badge.tag-hot {
  background: linear-gradient(180deg, #ff8a4d, #ff3d20) !important;
  color: #fff !important;
}

.game-ui .giveaway-badge.tag-live {
  background: linear-gradient(180deg, #6ef0ff, #2a9dff) !important;
  color: #032238 !important;
}

@keyframes tagPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.04); }
}

.game-ui .giveaway-fav-btn {
  border-radius: 12px !important;
  border: 2px solid rgba(255, 211, 74, 0.35) !important;
  background: rgba(0, 0, 0, 0.25) !important;
  font-size: 16px !important;
}

.game-ui .giveaway-fav-btn.active {
  background: linear-gradient(180deg, #ffe566, #ffb800) !important;
  color: #2a1600 !important;
}

/* 3D action buttons */
.game-ui .action-btn {
  border-radius: 14px !important;
  border: 0 !important;
  font-weight: 800 !important;
  min-height: 44px;
  background: linear-gradient(180deg, #5ce8ff 0%, #2a9dff 55%, #1a6fd4 100%) !important;
  color: #032238 !important;
  box-shadow: 0 5px 0 #124a8a, 0 12px 20px rgba(0, 0, 0, 0.28) !important;
  transition: transform 120ms ease, box-shadow 120ms ease, filter 120ms ease !important;
}

.game-ui .action-btn:active {
  transform: translateY(3px) !important;
  box-shadow: 0 2px 0 #124a8a, 0 6px 12px rgba(0, 0, 0, 0.25) !important;
}

.game-ui .action-btn.secondary {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.14), rgba(0, 0, 0, 0.28)) !important;
  color: #e8f0ff !important;
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.12) !important;
}

.game-ui .donate-open,
.game-ui #openDonateModalBtn {
  background: linear-gradient(180deg, #ffe566 0%, #ffb800 55%, #e69500 100%) !important;
  color: #2a1600 !important;
  box-shadow: 0 6px 0 #9a6b00, 0 14px 24px rgba(0, 0, 0, 0.32) !important;
  font-family: var(--game-font-display) !important;
  font-size: 20px !important;
  letter-spacing: 0.03em;
}

/* Bottom dock */
.game-ui .game-dock {
  z-index: 120 !important;
  border-radius: 16px !important;
  padding: 4px !important;
  border: 2px solid rgba(255, 255, 255, 0.16) !important;
  background:
    linear-gradient(180deg, rgba(30, 22, 68, 0.96), rgba(10, 8, 28, 0.98)) !important;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45) !important;
  pointer-events: auto !important;
  touch-action: manipulation;
  width: min(380px, calc(100vw - 24px)) !important;
}

.game-ui .bottom-nav-btn {
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  gap: 1px !important;
  padding: 5px 2px !important;
  border-radius: 12px !important;
  color: var(--game-text-soft) !important;
  transition: transform 140ms ease, background 140ms ease, color 140ms ease;
}

.game-ui .bottom-nav-btn[hidden] {
  display: none !important;
  pointer-events: none !important;
  visibility: hidden !important;
}

.game-ui .bottom-nav-btn .nav-icon {
  width: 22px;
  height: 22px;
  line-height: 1;
}

.game-ui .nav-emoji {
  width: 20px;
  height: 20px;
}

.game-ui .bottom-nav-btn .nav-label {
  font-size: 9px;
  font-weight: 800;
}

.game-ui .bottom-nav-btn {
  touch-action: manipulation;
}

.game-ui .bottom-nav-btn.active {
  color: var(--game-gold) !important;
  background: linear-gradient(180deg, rgba(120, 90, 220, 0.95), rgba(58, 38, 130, 0.98)) !important;
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.2);
  transform: translateY(-1px);
}

.game-ui .bottom-nav-btn.active .nav-icon {
  filter: drop-shadow(0 0 6px rgba(255, 211, 74, 0.55));
}

/* Wheel / detail */
.game-ui .wheel-zone {
  border-width: 3px !important;
  background:
    linear-gradient(160deg, rgba(255, 211, 74, 0.1), rgba(77, 232, 255, 0.06) 28%, rgba(12, 10, 40, 0.94)) !important;
}

.game-ui .round-title,
.game-ui #roundTitle {
  font-family: var(--game-font-display) !important;
  font-size: clamp(24px, 6vw, 32px) !important;
  color: #fff !important;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.4);
}

.game-ui .round-kicker {
  font-family: var(--game-font-display);
  color: #2a1600 !important;
  background: linear-gradient(90deg, #ffe566, #ffb800) !important;
  letter-spacing: 0.08em;
  border: 2px solid rgba(0, 0, 0, 0.2);
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.28);
}

.game-ui .wheel-stage {
  position: relative;
  border: 14px solid #f4d67a !important;
  background:
    radial-gradient(circle at 28% 22%, rgba(255, 255, 255, 0.28), transparent 42%),
    radial-gradient(circle at 78% 80%, rgba(77, 232, 255, 0.22), transparent 44%),
    radial-gradient(circle at 50% 115%, rgba(255, 79, 180, 0.16), transparent 48%),
    linear-gradient(180deg, rgba(36, 22, 88, 0.95), rgba(12, 10, 36, 0.98)) !important;
  box-shadow:
    0 12px 0 #7a5510,
    0 0 0 5px rgba(123, 92, 255, 0.28),
    0 0 36px rgba(255, 211, 74, 0.28),
    inset 0 0 28px rgba(255, 255, 255, 0.08) !important;
}

.game-ui .wheel-stage::before {
  content: '';
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 3px dashed rgba(255, 230, 140, 0.22);
  pointer-events: none !important;
  z-index: 0;
  animation: wheelAuraSpin 24s linear infinite;
}

.game-ui .wheel-stage::after {
  content: '';
  position: absolute;
  inset: 10px;
  border-radius: 50%;
  box-shadow: inset 0 0 22px rgba(0, 0, 0, 0.35);
  pointer-events: none !important;
  z-index: 2;
}

.game-ui #wheelCanvas {
  position: relative;
  z-index: 1;
}

.game-ui .pointer {
  z-index: 5;
  border-left-width: 22px !important;
  border-right-width: 22px !important;
  border-top-width: 44px !important;
  border-top-color: #ff5a6e !important;
  filter: drop-shadow(0 5px 0 #8f1e32) drop-shadow(0 10px 14px rgba(0, 0, 0, 0.45));
}

.game-ui .pointer::after {
  content: '';
  position: absolute;
  top: -38px;
  left: 50%;
  width: 16px;
  height: 16px;
  transform: translateX(-50%);
  border-radius: 50%;
  background: linear-gradient(180deg, #fff4c8, #ffd34a);
  border: 2px solid rgba(80, 40, 0, 0.45);
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.35);
}

body.is-spinning.game-ui .wheel-stage {
  animation: wheelSpinGlow 900ms ease-in-out infinite alternate;
}

body.is-spinning.game-ui .pointer {
  animation: pointerBounce 620ms ease-in-out infinite;
}

@keyframes wheelAuraSpin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes wheelSpinGlow {
  from {
    box-shadow:
      0 12px 0 #7a5510,
      0 0 0 5px rgba(123, 92, 255, 0.28),
      0 0 28px rgba(255, 211, 74, 0.22),
      inset 0 0 28px rgba(255, 255, 255, 0.08);
  }
  to {
    box-shadow:
      0 12px 0 #7a5510,
      0 0 0 6px rgba(77, 232, 255, 0.35),
      0 0 44px rgba(255, 120, 200, 0.38),
      inset 0 0 32px rgba(255, 255, 255, 0.12);
  }
}

@keyframes pointerBounce {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50% { transform: translateX(-50%) translateY(-4px); }
}

.game-ui .spin-sequence-banner {
  border-radius: 14px !important;
  border: 2px solid rgba(255, 211, 74, 0.35) !important;
  background: linear-gradient(135deg, rgba(123, 92, 255, 0.35), rgba(18, 12, 48, 0.92)) !important;
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.32);
}

.game-ui .spin-sequence-banner strong {
  font-family: var(--game-font-display);
  color: var(--game-gold);
  letter-spacing: 0.03em;
}

.game-ui.lite-mode .wheel-stage::before,
.game-ui.lite-mode body.is-spinning .wheel-stage,
.game-ui.lite-mode body.is-spinning .pointer {
  animation: none !important;
}

.game-ui .metric-card {
  border-radius: 14px !important;
  border: 2px solid rgba(255, 255, 255, 0.12) !important;
  background: rgba(8, 12, 36, 0.65) !important;
}

.game-ui .metric-card.winner,
.game-ui .winners-under-pointer {
  border-color: rgba(255, 211, 74, 0.35) !important;
  background: linear-gradient(145deg, rgba(255, 211, 74, 0.12), rgba(8, 12, 36, 0.8)) !important;
}

.game-ui .back-to-main {
  border-radius: 12px !important;
  font-weight: 800 !important;
}

/* Modals */
.game-ui .pay-modal,
.game-ui .task-modal,
.game-ui .filter-sheet {
  border-radius: 20px !important;
  border: 2px solid rgba(255, 255, 255, 0.18) !important;
  background:
    linear-gradient(160deg, rgba(123, 92, 255, 0.15), rgba(10, 14, 40, 0.98)) !important;
}

.game-ui .pay-method-btn {
  border-radius: 14px !important;
  border: 2px solid rgba(255, 255, 255, 0.14) !important;
  font-weight: 800 !important;
  transition: transform 120ms ease;
}

.game-ui .pay-method-btn:active {
  transform: scale(0.98);
}

/* Tasks */
.game-ui .task-card-item,
.game-ui .snezh-task-card {
  border-radius: 16px !important;
  border: 2px solid rgba(255, 255, 255, 0.16) !important;
  background:
    linear-gradient(145deg, rgba(255, 211, 74, 0.1), rgba(77, 232, 255, 0.06), rgba(12, 18, 48, 0.95)) !important;
}

.game-ui .task-status-pill.ready {
  background: linear-gradient(180deg, #5dffb1, #12b86a) !important;
  color: #042a18 !important;
}

/* Profile */
.game-ui .profile-avatar-wrap {
  border: none;
  box-shadow: none;
}

.game-ui .profile-balance {
  background: linear-gradient(180deg, rgba(255, 211, 74, 0.2), rgba(0, 0, 0, 0.2)) !important;
  border-color: rgba(255, 211, 74, 0.4) !important;
  font-weight: 800 !important;
}

/* Skeleton */
.game-ui .skeleton-row {
  border-radius: 14px !important;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0.06)) !important;
  background-size: 200% 100% !important;
  animation: skeletonShine 1.2s ease-in-out infinite !important;
}

@keyframes skeletonShine {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

/* View transitions */
.game-ui .view.entering {
  animation: viewSlide 320ms cubic-bezier(0.22, 0.9, 0.32, 1) both !important;
}

@keyframes viewSlide {
  from { opacity: 0; transform: translateX(12px); }
  to { opacity: 1; transform: translateX(0); }
}

/* Lite / reduced motion */
.game-ui.lite-mode .game-bg-glow,
.game-ui.lite-mode .game-brand {
  animation: none !important;
}

@media (prefers-reduced-motion: reduce) {
  .game-ui *,
  .game-ui *::before,
  .game-ui *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
