:root {
  --bg: #1a1a2e;
  --bg-card: rgba(36, 36, 56, 0.92);
  --bg-card-hover: rgba(48, 48, 72, 0.95);
  --accent: #a78bfa;
  --accent-2: #c084fc;
  --ton-blue: #38bdf8;
  --text: #ffffff;
  --text-muted: #c4b5fd;
  --border: rgba(167, 139, 250, 0.35);
  --success: #4ade80;
  --danger: #f87171;
  --header-h: 64px;
  --nav-h: 72px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

/* Hide scrollbars */
* {
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE */
}
*::-webkit-scrollbar {
  display: none; /* Chrome, Safari */
}


html {
  color-scheme: dark;
}
html, body {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: manipulation;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
}

#app {
  display: flex;
  flex-direction: column;
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: 480px;
  margin: 0 auto;
  overflow: hidden;
  background: 
    radial-gradient(ellipse at top, rgba(167, 139, 250, 0.35) 0%, transparent 55%),
    radial-gradient(ellipse at bottom right, rgba(56, 189, 248, 0.18) 0%, transparent 45%),
    radial-gradient(ellipse at center, rgba(99, 102, 241, 0.12) 0%, transparent 70%),
    var(--bg);
}

/* Header */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: calc(var(--header-h) + var(--safe-top));
  padding: var(--safe-top) 16px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(26, 26, 46, 0.9);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  overflow: visible;
}
.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow: visible;
}
.wallet-sheet {
  position: fixed;
  inset: 0;
  z-index: 600;
  background: rgba(0,0,0,.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.wallet-sheet[hidden] { display: none !important; }
.wallet-sheet-card {
  width: 100%;
  max-width: 480px;
  background: #161622;
  border-radius: 20px;
  padding: 18px 16px 22px;
}
.wallet-sheet-title { font-weight: 800; font-size: 18px; margin-bottom: 12px; text-align: center; }
.wallet-sheet-card button {
  width: 100%;
  border: 0;
  border-radius: 14px;
  padding: 14px;
  margin: 0 0 8px;
  background: #242436;
  color: #fff;
  font-weight: 700;
  font-size: 15px;
}
.wallet-sheet-cancel { background: transparent !important; color: #9ca3af !important; }
.wallet-sheet-status { text-align: center; color: #c4b5fd; min-height: 18px; font-size: 13px; }

.balance-block {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 8px 14px;
}

.balance-icon {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
}
.balance-icon img {
  width: 28px;
  height: 28px;
  display: block;
  border-radius: 50%;
}
.gram-inline {
  width: 16px;
  height: 16px;
  vertical-align: -3px;
  display: inline-block;
  border-radius: 50%;
  margin-left: 2px;
}
.gram-icon-sm {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  vertical-align: middle;
}

.balance-info {
  display: flex;
  flex-direction: column;
}

.balance-label {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1;
}

.balance-value {
  font-size: 15px;
  font-weight: 700;
  color: var(--ton-blue);
  line-height: 1.2;
}

#ton-connect { display:none !important; width:0; height:0; overflow:hidden; }

/* Main */
.main {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 16px 16px calc(var(--nav-h) + var(--safe-bottom) + 16px);
  -webkit-overflow-scrolling: touch;
}

.tab-content {
  display: none;
  animation: fadeIn 0.25s ease;
}

.tab-content.active {
  display: block;
}

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

.section-title {
  margin-bottom: 20px;
}

.section-title h1 {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, #fff 0%, #c4b5fd 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.subtitle {
  color: var(--text-muted);
  font-size: 14px;
  margin-top: 4px;
}

/* Cases Grid */
.cases-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.case-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 16px 12px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  overflow: visible;
  min-height: 200px;
}
.case-cover {
  width: 100%;
  max-width: 176px;
  height: 176px;
  object-fit: contain !important;
  object-position: center center !important;
  border-radius: 14px;
  background: transparent !important;
  display: block;
  flex-shrink: 0;
  margin: 0 auto;
  filter: drop-shadow(0 6px 14px rgba(0,0,0,0.35));
}
.case-card {
  overflow: visible !important;
}
.case-card .case-cover {
  box-sizing: border-box;
  padding: 4px;
}

.case-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.1), transparent);
  opacity: 0;
  transition: opacity 0.2s;
}

.case-card:active {
  transform: scale(0.97);
}

.case-card:hover::before,
.case-card:active::before {
  opacity: 1;
}

.case-card.free {
  border-color: rgba(34, 197, 94, 0.4);
}

.case-card.free::after {
  content: 'FREE';
  position: absolute;
  top: 10px;
  right: 10px;
  background: var(--success);
  color: #000;
  font-size: 10px;
  font-weight: 800;
  padding: 3px 7px;
  border-radius: 8px;
  letter-spacing: 0.5px;
}

.case-img {
  width: 90px;
  height: 90px;
  object-fit: contain;
  filter: drop-shadow(0 8px 16px rgba(139, 92, 246, 0.3));
}

.case-name {
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  line-height: 1.2;
}

.case-price-tag {
  font-size: 13px;
  font-weight: 700;
  color: var(--ton-blue);
  background: rgba(0, 152, 234, 0.15);
  padding: 4px 10px;
  border-radius: 10px;
}

.case-price-tag.free-tag {
  color: var(--success);
  background: rgba(34, 197, 94, 0.15);
}

/* Profile */
.profile-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  margin-bottom: 24px;
  position: relative;
  overflow: hidden;
}

.profile-card::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(139, 92, 246, 0.12) 0%, transparent 60%);
  pointer-events: none;
}

.profile-avatar-wrap {
  position: relative;
  width: 96px;
  height: 96px;
}

.profile-avatar {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--accent);
}

.avatar-ring {
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid transparent;
  background: linear-gradient(135deg, var(--accent), var(--ton-blue)) border-box;
  -webkit-mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  animation: spin 8s linear infinite;
}

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

.profile-info {
  text-align: center;
}

.profile-info h2 {
  font-size: 22px;
  font-weight: 700;
}

.username {
  color: var(--text-muted);
  font-size: 14px;
  margin-top: 2px;
}

.inventory-section {
  margin-top: 8px;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.section-header h3 {
  font-size: 18px;
  font-weight: 700;
}

.inv-count {
  font-size: 13px;
  color: var(--text-muted);
}

.inventory-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.inv-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.inv-item img {
  width: 48px;
  height: 48px;
  object-fit: contain;
}

.inv-item-name {
  font-size: 11px;
  text-align: center;
  color: var(--text-muted);
  line-height: 1.2;
}

.empty-inventory {
  grid-column: 1 / -1;
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
}

.empty-icon {
  font-size: 40px;
  margin-bottom: 10px;
  opacity: 0.6;
}

/* Coming soon */
.coming-soon {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.coming-icon {
  font-size: 56px;
  margin-bottom: 16px;
  opacity: 0.7;
}

.coming-soon h2 {
  font-size: 22px;
  color: var(--text);
  margin-bottom: 8px;
}

/* Bottom Nav */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  height: calc(var(--nav-h) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  display: flex;
  background: rgba(10, 10, 15, 0.92);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-top: 1px solid var(--border);
  z-index: 100;
}

.nav-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.2s;
}

.nav-btn.active {
  color: var(--accent-2);
}

.nav-icon {
  font-size: 22px;
  line-height: 1;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.nav-icon img {
  width: 28px;
  height: 28px;
  object-fit: contain;
  display: block;
}
.nav-btn.active .nav-icon img {
  transform: scale(1.1);
}

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  z-index: 200;
  display: none;
  align-items: flex-end;
  justify-content: center;
}

.modal.open {
  display: flex;
}

.modal-content {
  background: linear-gradient(180deg, #161620 0%, #0f0f16 100%);
  border-radius: 28px 28px 0 0;
  width: 100%;
  max-width: 480px;
  padding: 24px 20px calc(32px + var(--safe-bottom));
  position: relative;
  animation: slideUp 0.3s ease;
  border-top: 1px solid var(--border);
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255,255,255,0.08);
  border: none;
  color: #fff;
  font-size: 22px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.case-preview, .prize-result {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 12px;
}

.case-image-wrap {
  width: 140px;
  height: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.case-image-wrap img {
  max-width: 100%;
  max-height: 100%;
  filter: drop-shadow(0 12px 24px rgba(139, 92, 246, 0.4));
}

.case-desc {
  color: var(--text-muted);
  font-size: 14px;
  max-width: 280px;
}

.case-price {
  font-size: 18px;
  font-weight: 700;
  color: var(--ton-blue);
}

.btn-open, .btn-claim {
  width: 100%;
  max-width: 280px;
  height: 52px;
  border: none;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  margin-top: 8px;
  box-shadow: 0 8px 24px rgba(139, 92, 246, 0.4);
  transition: transform 0.15s, box-shadow 0.15s;
}

.btn-open:active, .btn-claim:active {
  transform: scale(0.97);
}

.btn-open:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none;
}

.cooldown {
  font-size: 14px;
  color: var(--text-muted);
  margin-top: 4px;
}

.prize-result {
  position: relative;
}

.prize-glow {
  position: absolute;
  width: 180px;
  height: 180px;
  background: radial-gradient(circle, rgba(139, 92, 246, 0.4) 0%, transparent 70%);
  top: -20px;
  left: 50%;
  transform: translateX(-50%);
  pointer-events: none;
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 0.6; transform: translateX(-50%) scale(1); }
  50% { opacity: 1; transform: translateX(-50%) scale(1.1); }
}

.prize-result img {
  width: 120px;
  height: 120px;
  object-fit: contain;
  position: relative;
  z-index: 1;
}

/* Utility */
.hidden { display: none !important; }

/* ========== CASE SPINNER ========== */
.spinner-screen {
  position: fixed;
  inset: 0;
  background: linear-gradient(180deg, #1e1b4b 0%, #1a1a2e 100%);
  z-index: 300;
  display: none;
  flex-direction: column;
  max-width: 480px;
  margin: 0 auto;
  left: 0; right: 0;
}
.spinner-screen.open { display: flex; }

.spinner-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 16px 8px;
  padding-top: calc(12px + env(safe-area-inset-top));
}
.spinner-title { text-align: center; }
.spinner-title div:first-child { font-weight: 700; font-size: 17px; }
.spinner-price { font-size: 13px; color: var(--ton-blue); margin-top: 2px; }

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.04);
  color: rgba(255,255,255,0.85);
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.icon-btn:active {
  background: rgba(255,255,255,0.1);
  transform: scale(0.96);
}

.spinner-center {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
}
.spinner-footer {
  padding-bottom: calc(12px + env(safe-area-inset-bottom));
}
.reel-wrap {
  position: relative;
  height: 160px;
  width: 100%;
  margin: 0;
  overflow: hidden;
}
.reel-center-line {
  position: absolute;
  left: 50%;
  top: 0; bottom: 0;
  width: 3px;
  background: linear-gradient(180deg, transparent, #8b5cf6, transparent);
  transform: translateX(-50%);
  z-index: 2;
  box-shadow: 0 0 12px rgba(139,92,246,0.6);
}
.reel-track {
  display: flex;
  gap: 12px;
  padding: 20px 0;
  will-change: transform;
}
.reel-item {
  flex: 0 0 118px;
  height: 120px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(139,92,246,0.25);
  border-radius: 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.reel-img { font-size: 42px; line-height: 1; }
.reel-name {
  font-size: 10px;
  line-height: 1.15;
  color: #d4d4d8;
  text-align: center;
  width: 100%;
  max-width: 100%;
  padding: 0 4px;
  white-space: normal;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  word-break: break-word;
}

.spinner-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  padding: 0 16px;
  margin-bottom: 16px;
}
.action-btn {
  flex: 1;
  max-width: 160px;
  height: 44px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.06);
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}

.spin-btn {
  display: block;
  width: calc(100% - 32px);
  max-width: 100%;
  margin: 0 auto 12px;
  height: 56px;
  border: none;
  border-radius: 18px;
  background: linear-gradient(135deg, #8b5cf6, #a855f7);
  color: #fff;
  font-size: 17px;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
  box-sizing: border-box;
  box-shadow: 0 8px 28px rgba(139,92,246,0.4);
}
.spin-btn:disabled { opacity: 0.5; cursor: not-allowed; box-shadow: none; }

/* ========== WIN SCREEN ========== */
.win-screen {
  position: fixed;
  inset: 0;
  background: linear-gradient(180deg, #5b21b6 0%, #4c1d95 40%, #1e1b4b 100%);
  z-index: 400;
  display: none;
  align-items: center;
  justify-content: center;
  max-width: 480px;
  margin: 0 auto;
  left: 0; right: 0;
}
.win-screen.open { display: flex; }
.win-content {
  text-align: center;
  padding: 24px 20px;
  width: 100%;
}
.win-label {
  font-size: 26px;
  font-weight: 800;
  margin-bottom: 28px;
  color: #fff;
}
.win-img {
  font-size: 90px;
  margin-bottom: 18px;
  filter: drop-shadow(0 8px 32px rgba(0,0,0,0.35));
  animation: popIn 0.45s cubic-bezier(0.2, 1.2, 0.4, 1);
  line-height: 1;
}
.win-img img {
  width: 140px;
  height: 140px;
  object-fit: contain;
}
@keyframes popIn {
  from { transform: scale(0.4); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
.win-name {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 6px;
  text-transform: lowercase;
}
.win-value {
  color: #fbbf24;
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 28px;
}
.win-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 300px;
  margin: 0 auto;
}
.win-btn {
  height: 50px;
  border-radius: 14px;
  border: none;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}
.win-btn-share {
  background: #fff;
  color: #1e1b4b;
}
.win-btn-sell {
  background: rgba(255,255,255,0.15);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.2);
}
.win-btn-continue {
  background: transparent;
  color: rgba(255,255,255,0.7);
}

/* ========== MODALS ========== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 500;
  display: none;
  align-items: flex-end;
  justify-content: center;
  max-width: 480px;
  margin: 0 auto;
  left: 0; right: 0;
}
.modal-overlay.open { display: flex; }
.modal-sheet {
  background: #16161f;
  border-radius: 24px 24px 0 0;
  width: 100%;
  max-height: 75vh;
  overflow-y: auto;
  padding: 20px 16px calc(24px + env(safe-area-inset-bottom));
  border-top: 1px solid rgba(139,92,246,0.25);
  animation: slideUp 0.28s ease;
}
.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}
.modal-head h3 { font-size: 18px; }

.prize-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.prize-row-img { font-size: 32px; width: 44px; text-align: center; }
.prize-row-info { flex: 1; }
.prize-row-name { font-weight: 600; font-size: 14px; }
.prize-row-chance { font-size: 12px; color: #a1a1aa; }
.prize-row-price { font-size: 13px; color: var(--ton-blue); font-weight: 600; }

.settings-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 8px 0;
}
.settings-label { font-weight: 600; margin-bottom: 4px; }
.settings-desc { font-size: 13px; color: #a1a1aa; }

.switch {
  position: relative;
  width: 52px;
  height: 30px;
  flex-shrink: 0;
}
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute;
  inset: 0;
  background: #333;
  border-radius: 30px;
  cursor: pointer;
  transition: 0.2s;
}
.slider:before {
  content: '';
  position: absolute;
  width: 24px; height: 24px;
  left: 3px; top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: 0.2s;
}
.switch input:checked + .slider { background: #8b5cf6; }
.switch input:checked + .slider:before { transform: translateX(22px); }

.case-emoji {
  font-size: 42px;
  margin-bottom: 4px;
}




.case-card {
  padding: 12px 10px 14px;
}
/* ========== GAMES HUB ========== */
.games-list { display: flex; flex-direction: column; gap: 12px; }
.game-card {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 18px 16px;
  cursor: pointer;
  transition: 0.15s;
}
.game-card:active { transform: scale(0.98); }
.game-icon {
  width: 64px;
  height: 64px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.game-icon img {
  width: 64px;
  height: 64px;
  object-fit: contain;
  filter: drop-shadow(0 4px 10px rgba(0,0,0,0.35));
}
.game-name { font-weight: 700; font-size: 17px; }
.game-desc { font-size: 13px; color: var(--text-muted); margin-top: 2px; }

/* ========== GAME SCREENS ========== */
.game-screen {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 350;
  display: none;
  flex-direction: column;
  max-width: 480px;
  margin: 0 auto;
  left: 0; right: 0;
  overflow-y: auto;
  padding-bottom: calc(20px + env(safe-area-inset-bottom));
}
.game-screen.open { display: flex; }
.game-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  padding-top: calc(8px + env(safe-area-inset-top));
  position: sticky;
  top: 0;
  background: var(--bg);
  backdrop-filter: none;
  z-index: 5;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}
.game-top h2 { font-size: 16px; font-weight: 700; }

/* Upgrade */
.upg-section { padding: 12px 16px; }
.upg-label { font-size: 13px; color: var(--text-muted); margin-bottom: 10px; }
.upg-scroll {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 6px;
  -webkit-overflow-scrolling: touch;
}
.upg-item {
  flex: 0 0 100px;
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: 16px;
  padding: 12px 8px;
  text-align: center;
  cursor: pointer;
  transition: 0.15s;
}
.upg-item.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(139,92,246,0.3);
}
.upg-emoji { font-size: 32px; margin-bottom: 4px; }
.upg-name { font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.upg-val { font-size: 11px; color: var(--ton-blue); margin-top: 2px; }
.upg-arrow { text-align: center; font-size: 24px; opacity: 0.6; padding: 4px; }
.upg-info {
  display: flex;
  gap: 12px;
  padding: 12px 16px;
}
.upg-info-item {
  flex: 1;
  background: var(--bg-card);
  border-radius: 14px;
  padding: 12px;
  text-align: center;
  border: 1px solid var(--border);
}
.upg-info-val { font-size: 20px; font-weight: 700; margin-top: 4px; color: var(--accent-2); }
.empty-small { color: var(--text-muted); font-size: 13px; padding: 20px; text-align: center; width: 100%; }

.upg-anim {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.88);
  z-index: 450;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  max-width: 480px;
  margin: 0 auto;
  left: 0; right: 0;
}
.upg-anim.open { display: flex; }
.upg-anim-emoji {
  font-size: 72px;
  animation: pulse 0.8s ease infinite;
  margin-bottom: 16px;
}
.upg-anim-text {
  font-size: 18px;
  font-weight: 600;
  text-align: center;
  padding: 0 24px;
}

/* Mines */
#minesScreen {
  display: none;
  flex-direction: column;
  height: 100%;
  overflow: hidden !important;
  padding-bottom: 0 !important;
}
#minesScreen.open { display: flex; }
.mines-body {
  flex: 1;
  overflow-y: auto;
  padding-bottom: 12px;
  -webkit-overflow-scrolling: touch;
}
.mines-controls { padding: 8px 16px 10px; }
.mines-sizes { display: flex; gap: 8px; margin-bottom: 12px; }
.mines-size-btn {
  flex: 1;
  height: 40px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-muted);
  font-weight: 600;
  cursor: pointer;
}
.mines-size-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.mines-inputs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.mines-inputs label { display: block; font-size: 12px; margin-bottom: 4px; }
.mines-inputs input {
  width: 100%;
  height: 44px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #0f0f15;
  color: #fff;
  padding: 0 12px;
  font-size: 15px;
  box-sizing: border-box;
}
.mines-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.mines-input-wrap .gram-inline {
  position: absolute;
  left: 12px;
  width: 18px;
  height: 18px;
  pointer-events: none;
}
.mines-input-wrap input { padding-left: 38px; }
.mines-stepper {
  display: flex;
  align-items: center;
  gap: 6px;
}
.mines-stepper input {
  flex: 1;
  text-align: center;
}
.mines-step {
  width: 36px;
  height: 44px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #1a1a28;
  color: #fff;
  font-size: 20px;
  font-weight: 700;
  cursor: pointer;
  flex-shrink: 0;
}
.mines-stats {
  display: flex;
  justify-content: space-around;
  padding: 6px 16px 10px;
  text-align: center;
}
.mines-stat .muted { font-size: 12px; }
.mines-stat > div {
  font-size: 18px;
  font-weight: 700;
  color: var(--ton-blue);
  margin-top: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}
.mines-grid {
  display: grid;
  gap: 6px;
  padding: 0 16px 8px;
  max-width: 340px;
  margin: 0 auto;
  width: 100%;
}
.mines-cell {
  aspect-ratio: 1;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  cursor: pointer;
  transition: 0.1s;
  user-select: none;
}
.mines-cell.locked { opacity: 0.55; cursor: default; }
.mines-cell:active:not(.locked) { transform: scale(0.94); }
.mines-cell.gem {
  background: rgba(34,197,94,0.15);
  border-color: rgba(34,197,94,0.4);
}
.mines-cell.mine {
  background: rgba(239,68,68,0.2);
  border-color: rgba(239,68,68,0.5);
}
.mines-footer {
  flex-shrink: 0;
  padding: 12px 16px calc(16px + env(safe-area-inset-bottom, 0px));
  background: linear-gradient(to top, rgba(10,10,18,0.98), rgba(10,10,18,0.85));
  border-top: 1px solid var(--border);
}
.mines-main-btn {
  width: 100%;
  height: 52px;
  border: none;
  border-radius: 16px;
  background: linear-gradient(135deg, #8b5cf6, #6366f1);
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(139, 92, 246, 0.35);
}
.mines-main-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
}
.mines-main-btn.is-cashout {
  background: linear-gradient(135deg, #22c55e, #16a34a);
  box-shadow: 0 8px 24px rgba(34, 197, 94, 0.3);
}
.mines-main-btn.is-lost {
  background: linear-gradient(135deg, #ef4444, #b91c1c);
  box-shadow: 0 8px 24px rgba(239, 68, 68, 0.25);
}
.mines-main-btn.is-done {
  background: linear-gradient(135deg, #8b5cf6, #6366f1);
}
.mines-win-sheet {
  text-align: center;
  padding: 32px 24px 24px;
}
.mines-win-label {
  font-size: 22px;
  font-weight: 800;
  margin-bottom: 16px;
}
.mines-win-icon {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  margin: 0 auto 12px;
  display: block;
  filter: drop-shadow(0 8px 20px rgba(0,152,234,0.4));
}
.mines-win-amount {
  font-size: 36px;
  font-weight: 800;
  color: var(--ton-blue);
  line-height: 1.1;
}
.mines-win-sub {
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 20px;
  margin-top: 4px;
}
#minesWinModal.open { display: flex; }


/* Inventory sell button */
.inv-sell {
  margin-top: 6px;
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 8px;
  border: none;
  background: rgba(139,92,246,0.2);
  color: #c4b5fd;
  cursor: pointer;
  width: 100%;
}


/* Support real images for prizes */
.reel-img img, .win-img img, .prize-row-img img, .inv-item img, .upg-emoji img, .case-emoji img {
  width: 56px;
  height: 56px;
  object-fit: contain;
  border-radius: 12px;
}
.reel-img img { width: 64px; height: 64px; }
.win-img img { width: 110px; height: 110px; }
.prize-row-img img { width: 44px; height: 44px; }
.inv-item img { width: 48px; height: 48px; }
.upg-emoji img { width: 40px; height: 40px; }


/* Upgrade slots like GorillaCase */
.upg-slots {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.upg-slot {
  background: rgba(255,255,255,0.06);
  border: 1.5px dashed rgba(255,255,255,0.2);
  border-radius: 18px;
  min-height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
  cursor: pointer;
  transition: 0.15s;
}
.upg-slot.filled {
  border-style: solid;
  border-color: rgba(167,139,250,0.5);
  background: rgba(139,92,246,0.12);
}
.upg-slot-empty {
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
}
.upg-slot-empty span {
  display: block;
  font-size: 28px;
  margin-bottom: 6px;
  opacity: 0.5;
}
.upg-slot-filled-content {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
}
.upg-slot-img { font-size: 0; width: 72px; height: 72px; flex-shrink: 0; }
.upg-slot-img img { width: 72px; height: 72px; object-fit: contain; }
.upg-slot-info { flex: 1; }
.upg-slot-name { font-weight: 700; font-size: 15px; }
.upg-slot-price { color: #fbbf24; font-size: 13px; margin-top: 2px; }
.upg-chance-block {
  margin: 8px 16px 16px;
  background: rgba(255,255,255,0.06);
  border-radius: 16px;
  padding: 16px;
  text-align: center;
}
.upg-chance-title {
  font-size: 22px;
  font-weight: 800;
  margin-bottom: 4px;
}
.upg-chance-sub {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 12px;
}
.upg-bar {
  height: 12px;
  background: rgba(255,255,255,0.1);
  border-radius: 20px;
  overflow: hidden;
  position: relative;
}
.upg-bar-fill {
  height: 100%;
  border-radius: 20px;
  background: linear-gradient(90deg, #22c55e, #4ade80);
  transition: width 0.3s;
}
.upg-hint {
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
  margin: 8px 16px 16px;
}
.upg-picker {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  z-index: 420;
  display: none;
  align-items: flex-end;
  max-width: 480px;
  margin: 0 auto;
  left: 0; right: 0;
}
.upg-picker.open { display: flex; }
.upg-picker-sheet {
  background: #1e1e2e;
  border-radius: 24px 24px 0 0;
  width: 100%;
  max-height: 70vh;
  overflow-y: auto;
  padding: 20px 16px calc(24px + env(safe-area-inset-bottom));
}
.upg-picker-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 14px;
}
.upg-picker-item {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 14px;
  padding: 12px 8px;
  text-align: center;
  cursor: pointer;
}
.upg-picker-item:active { transform: scale(0.96); }
.upg-picker-item .emoji { font-size: 36px; margin-bottom: 4px; }
.upg-picker-item .emoji img { width: 48px; height: 48px; object-fit: contain; }
.upg-picker-item .price { font-size: 12px; color: #fbbf24; font-weight: 600; }

/* ========== LIVE FEED (event-driven, left insert) ========== */
.live-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 52px;
  max-height: 52px;
  padding: 0 12px;
  background: rgba(0,0,0,0.4);
  border-bottom: 1px solid rgba(167,139,250,0.2);
  overflow: hidden;
  flex-shrink: 0;
}
.live-label {
  flex-shrink: 0;
  font-weight: 800;
  font-size: 11px;
  letter-spacing: 1px;
  color: #fff;
  background: linear-gradient(135deg, #ef4444, #f97316);
  padding: 4px 10px;
  border-radius: 8px;
  z-index: 2;
}
.live-scroll {
  flex: 1;
  height: 44px;
  overflow: hidden;
  position: relative;
  mask-image: linear-gradient(90deg, #000 0%, #000 88%, transparent 100%);
  -webkit-mask-image: linear-gradient(90deg, #000 0%, #000 88%, transparent 100%);
}
.live-track {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 44px;
  width: max-content;
  /* NO continuous animation */
}
.live-item {
  flex: 0 0 40px;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  opacity: 1;
  transform: scale(1);
  transition: opacity 0.35s ease, transform 0.35s ease, margin 0.35s ease;
}
.live-item.enter {
  animation: liveEnter 0.4s cubic-bezier(0.2, 0.9, 0.3, 1) forwards;
}
.live-item.exit {
  opacity: 0;
  transform: scale(0.6);
  margin-right: -48px;
}
.live-item img {
  width: 32px !important;
  height: 32px !important;
  max-width: 32px !important;
  max-height: 32px !important;
  object-fit: contain;
  display: block;
}
.live-item.won {
  border-color: #fbbf24;
  box-shadow: 0 0 10px rgba(251,191,36,0.5);
}
@keyframes liveEnter {
  0% { opacity: 0; transform: scale(0.4) translateX(-12px); }
  60% { opacity: 1; transform: scale(1.12) translateX(0); }
  100% { opacity: 1; transform: scale(1) translateX(0); }
}

.inv-img img, .prize-row-img img, .reel-img img, .win-img img, .upg-picker-item .emoji img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.upg-slot-img {
  width: 72px !important;
  height: 72px !important;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.upg-slot-img img {
  width: 72px !important;
  height: 72px !important;
  max-width: 72px !important;
  max-height: 72px !important;
  object-fit: contain !important;
}
.inv-img { width: 48px; height: 48px; margin: 0 auto 4px; }
.reel-img { width: 64px; height: 64px; display: flex; align-items: center; justify-content: center; }
.reel-img img { width: 56px; height: 56px; }
.win-img img { width: 120px; height: 120px; }
.prize-row-img { width: 48px; height: 48px; display: flex; align-items: center; justify-content: center; }
.prize-row-img img { width: 44px; height: 44px; }

/* Safety: prevent LIVE images from blowing up layout */
.live-bar * { max-height: 44px; }
.live-item, .live-item * { max-width: 40px; max-height: 40px; }
img { max-width: 100%; }
.inv-img img { max-width: 64px; max-height: 64px; }
/* Hide LIVE on Games/Profile tabs */
body.hide-live .live-bar { display: none !important; }

/* Item detail modal */
.item-detail-sheet {
  text-align: center;
  padding: 28px 20px 32px;
  max-width: 360px;
  margin: auto;
  position: relative;
}
.item-detail-close {
  position: absolute;
  top: 12px;
  right: 14px;
  background: rgba(255,255,255,0.08);
  border: none;
  color: #fff;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 20px;
  cursor: pointer;
}
.item-detail-img {
  width: 120px;
  height: 120px;
  margin: 8px auto 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.item-detail-img img {
  width: 110px !important;
  height: 110px !important;
  object-fit: contain;
}
.item-detail-name {
  font-size: 22px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 4px;
  text-transform: lowercase;
}
.item-detail-sub {
  font-size: 13px;
  color: #a1a1aa;
  margin-bottom: 24px;
}
.item-detail-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.item-btn {
  width: 100%;
  padding: 14px 16px;
  border-radius: 14px;
  border: none;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
.item-btn-upgrade {
  background: #3b82f6;
  color: #fff;
}
.item-btn-sell {
  background: rgba(255,255,255,0.1);
  color: #fff;
}
.item-btn-withdraw {
  background: rgba(255,255,255,0.06);
  color: #a1a1aa;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  position: relative;
}
.item-btn-withdraw:not(:disabled) {
  background: linear-gradient(135deg, #10b981, #059669);
  color: #fff;
}
.item-btn-withdraw:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}
.withdraw-lock {
  font-size: 13px;
  opacity: 0.9;
}
.inv-item {
  cursor: pointer;
  transition: transform 0.15s;
}
.inv-item:active { transform: scale(0.96); }

/* ===== Social / 5 tabs ===== */
.bottom-nav.five .nav-btn { gap: 2px; font-size: 10px; }
.bottom-nav.five .nav-icon { width: 28px; height: 28px; }
.bottom-nav.five .nav-icon img { width: 28px; height: 28px; }
.bottom-nav.five .nav-label { font-size: 10px; letter-spacing: -0.02em; }

.soc-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 14px;
  margin-bottom: 12px;
}
.soc-note {
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  margin-bottom: 12px;
  line-height: 1.35;
}
.cd-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 12px 8px;
  margin-bottom: 12px;
}
.cd-cell { text-align: center; }
.cd-cell b { display: block; font-size: 22px; font-weight: 800; }
.cd-cell span { font-size: 11px; color: var(--text-muted); }

.prize-pills {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}
.prize-pills.compact { justify-content: space-around; }
.prize-pill { text-align: center; width: 88px; }
.prize-pill-img {
  width: 64px; height: 64px;
  margin: 0 auto 6px;
  display: flex; align-items: center; justify-content: center;
}
.prize-pill-img img { width: 58px; height: 58px; object-fit: contain; }
.prize-pill-qty {
  background: rgba(255,255,255,0.08);
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 700;
}

.ga-meta {
  display: flex;
  justify-content: space-around;
  margin: 12px 0;
  text-align: center;
}
.ga-meta b { display: block; font-size: 20px; }
.ga-meta span { font-size: 12px; color: var(--text-muted); }

.soc-btn {
  width: 100%;
  height: 46px;
  border: none;
  border-radius: 14px;
  background: linear-gradient(135deg, #8b5cf6, #6366f1);
  color: #fff;
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
}
.soc-btn.slim { height: 40px; margin-top: 8px; font-size: 14px; }
.soc-btn.big { height: 50px; margin-top: 8px; }
.soc-btn.ghost, .soc-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.board-card { padding: 10px 12px 8px; }
.board-head, .board-row, .you-sticky, .you-row {
  display: grid;
  grid-template-columns: 32px 1fr auto;
  align-items: center;
  gap: 8px;
}
.board-head {
  color: var(--text-muted);
  font-size: 12px;
  padding: 4px 4px 8px;
}
.board-row {
  padding: 8px 4px;
  border-top: 1px solid rgba(255,255,255,0.05);
}
.board-row.is-me { background: rgba(139,92,246,0.12); border-radius: 12px; border-top: none; }
.board-place { font-weight: 700; color: var(--text-muted); }
.board-user { display: flex; align-items: center; gap: 8px; min-width: 0; }
.board-ava {
  width: 34px; height: 34px; border-radius: 50%;
  background: #7c3aed; display: flex; align-items: center; justify-content: center;
  font-weight: 700; overflow: hidden; flex-shrink: 0;
}
.board-ava img { width: 100%; height: 100%; object-fit: cover; }
.board-name { font-weight: 600; font-size: 14px; }
.board-wager { font-weight: 700; color: #fbbf24; font-size: 13px; white-space: nowrap; }
.board-prize-mini { width: 22px; height: 22px; margin-top: 2px; }
.board-prize-mini img { width: 22px; height: 22px; object-fit: contain; }

.you-sticky,
.you-row {
  position: static;
  background: rgba(139, 92, 246, 0.16);
  border: 1px solid rgba(139,92,246,0.35);
  border-radius: 14px;
  padding: 10px 8px;
  margin-top: 8px;
  z-index: 5;
}

.ga-detail { padding: 12px 16px 24px; }
.ga-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.ga-prize { text-align: center; }
.ga-prize-img {
  width: 72px; height: 72px; margin: 0 auto 6px;
  display: flex; align-items: center; justify-content: center;
}
.ga-prize-img img { width: 64px; height: 64px; object-fit: contain; }
.ga-prize-val {
  background: rgba(255,255,255,0.08);
  border-radius: 999px;
  padding: 4px 6px;
  font-size: 12px;
  font-weight: 700;
}
.cond {
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255,255,255,0.04);
  margin-bottom: 8px;
  font-size: 14px;
}
.cond.ok { color: #4ade80; background: rgba(34,197,94,0.1); }
.ga-miss { text-align: center; color: #fbbf24; font-size: 13px; margin: 8px 0 12px; }

.ref-block {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 14px;
  margin: 0 0 16px;
}
.ref-title { font-weight: 800; font-size: 16px; }
.ref-sub { color: var(--text-muted); font-size: 12px; margin: 4px 0 10px; line-height: 1.35; }
.ref-link-row { display: flex; gap: 8px; }
.ref-input {
  flex: 1;
  height: 40px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #0f0f15;
  color: #fff;
  padding: 0 10px;
  font-size: 11px;
  min-width: 0;
}
.ref-mini {
  border: none;
  border-radius: 12px;
  background: rgba(139,92,246,0.25);
  color: #fff;
  padding: 0 12px;
  font-weight: 700;
  font-size: 12px;
  cursor: pointer;
}
.ref-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  text-align: center;
  margin: 12px 0;
}
.ref-stats b { display: block; font-size: 16px; }
.ref-stats span { font-size: 11px; color: var(--text-muted); }

.kc-toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--nav-h) + 24px);
  transform: translateX(-50%) translateY(20px);
  background: #22183a;
  border: 1px solid rgba(139,92,246,0.4);
  color: #fff;
  padding: 10px 16px;
  border-radius: 12px;
  opacity: 0;
  pointer-events: none;
  transition: 0.2s;
  z-index: 800;
  font-size: 13px;
  font-weight: 600;
}
.kc-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

#giveawayScreen { z-index: 360; }
#giveawayScreen.open { display: flex; }

/* Upgrade multi + arrow */
.upg-multi-imgs {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  justify-content: center;
  max-width: 120px;
}
.upg-mini {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  overflow: hidden;
  background: rgba(255,255,255,0.06);
  display: flex;
  align-items: center;
  justify-content: center;
}
.upg-mini img { width: 24px; height: 24px; object-fit: contain; }
.upg-picker-item.selected {
  outline: 2px solid #8b5cf6;
  background: rgba(139,92,246,0.18);
}
.upg-picker-item .name {
  font-size: 11px;
  color: #ddd;
  text-align: center;
  max-width: 72px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.upg-bar.track {
  position: relative;
  height: 14px;
  border-radius: 999px;
  background: rgba(255,255,255,0.08);
  overflow: visible;
}
.upg-bar.track .upg-bar-fill {
  height: 100%;
  border-radius: 999px 0 0 999px;
}
.upg-arrow {
  position: absolute;
  top: 100%;
  left: 0;
  width: 0;
  height: 0;
  margin-top: 4px;
  border-left: 7px solid transparent;
  border-right: 7px solid transparent;
  border-bottom: 10px solid #fff;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.4));
  z-index: 2;
}
#upgSrcCount { color: var(--text-muted); font-weight: 600; }

/* ===== Upgrade UI v2 (Gorilla-like) ===== */
.upg-subtitle {
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  padding: 0 16px 12px;
  margin: 0;
}
.upg-block {
  padding: 0 16px 14px;
}
.upg-block .upg-label {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 10px;
}
.upg-hscroll {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 4px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.upg-hscroll::-webkit-scrollbar { display: none; }

.upg-card {
  flex: 0 0 auto;
  width: 92px;
  min-height: 110px;
  border-radius: 16px;
  background: rgba(255,255,255,0.05);
  border: 1.5px dashed rgba(255,255,255,0.18);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 6px;
  cursor: pointer;
}
.upg-card.add {
  color: var(--text-muted);
}
.upg-card-plus {
  font-size: 28px;
  line-height: 1;
  opacity: 0.55;
}
.upg-card-cap {
  font-size: 11px;
  text-align: center;
  line-height: 1.2;
}
.upg-card.gift {
  border-style: solid;
  border-color: rgba(139,92,246,0.35);
  background: rgba(139,92,246,0.12);
}
.upg-card.gift.big {
  width: 110px;
  min-height: 124px;
}
.upg-card-img {
  width: 64px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.upg-card-img img {
  width: 60px !important;
  height: 60px !important;
  object-fit: contain;
}
.upg-card-price {
  font-size: 12px;
  font-weight: 700;
  color: #fbbf24;
}

.upg-chance-block {
  margin: 4px 16px 12px;
  background: rgba(255,255,255,0.05);
  border-radius: 18px;
  padding: 16px 16px 12px;
  text-align: center;
}
.upg-chance-title {
  font-size: 24px;
  font-weight: 800;
  margin-bottom: 2px;
}
.upg-chance-sub {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 14px;
}
.upg-bar-wrap {
  position: relative;
  padding-bottom: 18px;
}
.upg-bar.track {
  height: 14px;
  border-radius: 999px;
  background: rgba(255,255,255,0.1);
  overflow: hidden;
  position: relative;
}
.upg-bar.track .upg-bar-fill {
  height: 100%;
  border-radius: 999px 0 0 999px;
  background: linear-gradient(90deg, #16a34a, #4ade80);
}
.upg-arrow {
  position: absolute;
  top: 14px;
  left: 0;
  width: 0;
  height: 0;
  margin-left: -7px;
  border-left: 7px solid transparent;
  border-right: 7px solid transparent;
  border-bottom: 11px solid #e5e7eb;
  filter: drop-shadow(0 1px 3px rgba(0,0,0,0.45));
  z-index: 3;
  pointer-events: none;
}
.upg-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 10px;
  margin-bottom: 0;
}
.upg-footer {
  padding: 8px 16px calc(16px + env(safe-area-inset-bottom));
  margin-top: auto;
}
.upg-go-btn {
  width: 100%;
  height: 54px;
  border: none;
  border-radius: 16px;
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: #fff;
  font-size: 17px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(37,99,235,0.35);
}
.upg-go-btn:disabled {
  opacity: 0.45;
  box-shadow: none;
  cursor: not-allowed;
}

.upg-picker-item .emoji {
  width: 56px;
  height: 56px;
  margin: 0 auto 6px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.upg-picker-item .emoji img {
  width: 52px !important;
  height: 52px !important;
  object-fit: contain;
  display: block;
}
.upg-picker-item .name {
  font-size: 11px;
  color: #e5e7eb;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-bottom: 2px;
}

/* Picker done button centered */
.upg-picker-sheet .spin-btn,
.upg-picker-sheet .picker-done-btn {
  display: block !important;
  width: calc(100% - 32px) !important;
  margin: 16px auto 8px !important;
  text-align: center;
}
.spinner-footer .spin-btn {
  display: block !important;
  width: calc(100% - 32px) !important;
  margin: 0 auto 12px !important;
}

.mines-prize-preview {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 16px 12px;
  padding: 10px 12px;
  background: rgba(139,92,246,0.12);
  border: 1px solid rgba(139,92,246,0.28);
  border-radius: 14px;
}
.mines-prev-img {
  width: 48px; height: 48px;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.mines-prev-img img { width: 46px; height: 46px; object-fit: contain; }
.mines-prev-name { font-weight: 700; font-size: 14px; }
.mines-prev-sub { font-size: 12px; color: #fbbf24; margin-top: 2px; }
.mines-win-nft { width: 120px; height: 120px; margin: 0 auto; display: flex; align-items: center; justify-content: center; }
.mines-win-nft img { width: 110px; height: 110px; object-fit: contain; }
.mines-win-name { font-weight: 700; font-size: 16px; margin: 8px 0 4px; }


.random-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 6px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: #fff;
  background: linear-gradient(135deg, #a855f7, #ec4899);
  box-shadow: 0 4px 10px rgba(168,85,247,0.35);
}
.random-badge.mini {
  margin-top: 4px;
  padding: 2px 6px;
  font-size: 9px;
}
.reel-item .random-badge { margin-top: 2px; }
.prize-row-info .random-badge { margin-top: 4px; }

.case-card.sure {
  border: 1px solid rgba(16, 185, 129, 0.55);
  background: linear-gradient(180deg, rgba(16,185,129,0.12), var(--bg-card));
  box-shadow: 0 0 0 1px rgba(16,185,129,0.12), 0 10px 24px rgba(16,185,129,0.12);
}
.sure-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.2px;
  color: #052e16;
  background: linear-gradient(135deg, #34d399, #a3e635);
}
.case-price-tag.sure-tag {
  color: #6ee7b7;
  background: rgba(16,185,129,0.18);
}
#spinnerSureBadge { margin-top: 4px; }
.limit-badge {
  margin-top: 6px;
  font-size: 10px;
  font-weight: 700;
  color: #e5e7eb;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 999px;
  padding: 3px 8px;
}
.promo-row {
  width: 100%;
  margin: 0 0 10px;
}
.promo-row input {
  width: 100%;
  height: 44px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #0f0f15;
  color: #fff;
  padding: 0 12px;
  box-sizing: border-box;
  font-size: 15px;
}
.win-content .random-badge { margin: 8px auto 0; }
.item-detail-sheet .random-badge { margin: 8px auto 0; }

/* ========== SLOTS ========== */
.slots-body { padding: 8px 14px 12px; flex: 1; display: flex; flex-direction: column; }
.slots-machine {
  position: relative;
  height: 318px;
  border-radius: 22px;
  overflow: hidden;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.06);
  margin-bottom: 14px;
}
.slots-cols {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  height: 100%;
  gap: 8px;
  padding: 8px;
}
.slots-col {
  position: relative;
  overflow: hidden;
  border-radius: 16px;
  background: rgba(255,255,255,0.03);
}
.slots-track {
  position: absolute;
  left: 0; right: 0; top: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  will-change: transform;
}
.slots-item {
  width: 100%;
  height: 94px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.slots-item img { width: 78px; height: 78px; object-fit: contain; filter: drop-shadow(0 6px 12px rgba(0,0,0,0.35)); }
.slots-center-line {
  position: absolute;
  left: 10px; right: 10px;
  top: 50%;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(168,85,247,0.85), transparent);
  z-index: 4;
  pointer-events: none;
  transform: translateY(-1px);
}
.slots-bets {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}
.slots-bet {
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.04);
  color: #fff;
  border-radius: 14px;
  padding: 10px 4px;
  font-weight: 800;
  font-size: 13px;
  text-align: center;
}
.slots-bet.active {
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  border-color: transparent;
}
.slots-bet.sure {
  box-shadow: inset 0 0 0 1px rgba(52,211,153,0.5);
}
.slots-bet.sure.active {
  background: linear-gradient(135deg, #10b981, #34d399);
}
.slots-bet .mini { display: block; font-size: 9px; font-weight: 700; margin-top: 3px; opacity: 0.85; }
.slots-actions { display: flex; gap: 10px; }
.slots-actions .action-btn { flex: 1; }
.slots-footer {
  padding: 10px 16px calc(12px + env(safe-area-inset-bottom));
}
.slots-prizes-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  padding: 8px 4px 16px;
  max-height: 58vh;
  overflow-y: auto;
}
.slots-prize-card {
  background: rgba(255,255,255,0.04);
  border-radius: 14px;
  padding: 10px 6px 8px;
  text-align: center;
}
.slots-prize-card img { width: 52px; height: 52px; object-fit: contain; }
.slots-prize-name { font-size: 11px; margin-top: 6px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.slots-prize-val { font-size: 11px; color: #60a5fa; font-weight: 700; margin-top: 2px; }

.reels-stack {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 0 0 6px;
}
.reels-stack.count-2 .reel-wrap { height: 132px; }
.reels-stack.count-2 .reel-item { height: 108px; flex: 0 0 108px; gap: 4px; }
.reels-stack.count-2 .reel-img img { width: 50px; height: 50px; }
.reels-stack.count-2 .reel-name { font-size: 10px; }
.reels-stack.count-3 .reel-wrap { height: 114px; }
.reels-stack.count-3 .reel-item { height: 96px; flex: 0 0 102px; gap: 3px; }
.reels-stack.count-3 .reel-img img { width: 42px; height: 42px; }
.reels-stack.count-3 .reel-name { font-size: 9px; line-height: 1.12; }
.case-count-row {
  display: flex;
  justify-content: center;
  gap: 8px;
  padding: 0 16px 12px;
}
.case-count-btn {
  min-width: 64px;
  height: 36px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.05);
  color: #fff;
  font-weight: 800;
}
.case-count-btn.active {
  background: linear-gradient(135deg, #8b5cf6, #6366f1);
  border-color: transparent;
}
.win-multi {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  margin: 8px 0 4px;
}
.win-multi-card {
  width: 96px;
  text-align: center;
}
.win-multi-card img { width: 64px; height: 64px; object-fit: contain; }
.win-multi-name { font-size: 12px; font-weight: 700; margin-top: 4px; }
.win-multi-val { font-size: 11px; color: #93c5fd; }

.header-right { display:flex; align-items:center; gap:8px; }
.dep-btn {
  border:0; background:#7c3aed; color:#fff; font-weight:700; font-size:12px;
  border-radius:10px; padding:8px 10px; white-space:nowrap;
}
.daily-card {
  background:#161625; border:1px solid #2a2a40; border-radius:18px;
  padding:18px; width:min(360px,92vw);
}
.daily-card h3 { margin:0 0 6px; }
.daily-card p { margin:0 0 14px; color:#9ca3af; font-size:13px; }
.daily-task {
  display:block; width:100%; text-align:left; margin:0 0 8px;
  background:#1f1f32; color:#fff; border:1px solid #2f2f48;
  border-radius:12px; padding:12px; font-weight:600;
}
.daily-task.ok { border-color:#22c55e; color:#86efac; }
.daily-go {
  width:100%; margin-top:8px; border:0; border-radius:12px;
  padding:12px; background:#7c3aed; color:#fff; font-weight:800;
}
.daily-go:disabled { opacity:.4; }
.pvp-root { padding:8px 16px 24px; }
.pvp-wheel-wrap { position:relative; width:280px; height:280px; margin:8px auto 12px; }
.pvp-pin { position:absolute; left:50%; top:-6px; transform:translateX(-50%); color:#fff; z-index:3; font-size:18px; }
.pvp-wheel {
  width:280px; height:280px; border-radius:50%;
  position:relative; box-shadow:0 0 0 8px #1a1a24, 0 12px 40px #0008;
}
.pvp-core {
  position:absolute; inset:28%; background:#0b0b12; border-radius:50%;
  display:flex; align-items:center; justify-content:center;
  font-weight:800; font-size:28px;
}
.pvp-dot {
  position:absolute; width:32px; height:32px; border-radius:50%;
  transform:translate(-50%,-50%); overflow:hidden; border:2px solid #0b0b12;
  display:flex; align-items:center; justify-content:center; font-size:12px; font-weight:700;
}
.pvp-dot img { width:100%; height:100%; object-fit:cover; }
.pvp-bank { text-align:center; font-weight:700; margin:0 0 10px; }
.pvp-list { background:#141422; border-radius:14px; padding:8px; margin-bottom:12px; }
.pvp-row { display:flex; align-items:center; gap:10px; padding:8px; }
.pvp-ava { width:36px; height:36px; border-radius:50%; overflow:hidden; display:flex; align-items:center; justify-content:center; font-weight:700; }
.pvp-ava img { width:100%; height:100%; object-fit:cover; }
.pvp-name { font-weight:700; }
.pvp-ch { font-size:12px; color:#9ca3af; }
.pvp-amt { margin-left:auto; font-weight:700; }
.pvp-empty { text-align:center; color:#9ca3af; padding:16px; }
.pvp-chips { display:flex; gap:8px; }
.pvp-chip {
  flex:1; border:0; background:#1f1f32; color:#fff; border-radius:12px;
  padding:10px 0; font-weight:700;
}
.pvp-go {
  flex:1; margin-top:0; border:0; border-radius:14px;
  padding:14px; background:#3b82f6; color:#fff; font-weight:800; font-size:16px;
}
.pvp-custom { display:flex; gap:8px; margin-top:10px; }
.pvp-custom input {
  width:90px; border:0; border-radius:14px; background:#1f1f32; color:#fff;
  padding:14px 10px; font-weight:700; text-align:center;
}
.pvp-title{display:flex;align-items:center;gap:8px;margin:0;font-size:18px}
.pvp-title-ico{width:28px;height:28px;object-fit:contain}

.dep-body { padding: 8px 16px 24px; }
.dep-tabs { display:flex; gap:8px; margin-bottom:18px; }
.dep-tab { flex:1; border:0; background:#1c1c2a; color:#9ca3af; border-radius:12px; padding:10px 6px; font-weight:700; font-size:12px; }
.dep-tab.on { background:#7c3aed; color:#fff; }
.dep-wallet { display:block; margin:0 auto 16px; background:#222233; color:#c4b5fd; border:1px solid #3b3358; border-radius:20px; padding:8px 14px; font-weight:700; }
.dep-amount-wrap {
  display:flex; align-items:center; justify-content:center; gap:10px;
  margin:12px 0 10px; padding:10px 12px;
  background:#16162a; border:1px solid rgba(167,139,250,.35); border-radius:16px;
}
.dep-amount {
  min-width:88px; text-align:center;
  font-size:28px; font-weight:800; line-height:1.1; color:#fff;
  background:transparent !important; border:0; appearance:none;
}
.dep-unit img { width:22px; height:22px; }
.dep-minus,.dep-plus { width:36px;height:36px;border-radius:50%;border:0;background:#2a2a40;color:#fff;font-size:22px; }
.dep-pad {
  display:grid; grid-template-columns:repeat(3,1fr); gap:8px;
  margin:0 0 14px;
}
.dep-pad button {
  border:0; border-radius:12px; padding:12px 0;
  background:#1c1c2e; color:#fff; font-weight:800; font-size:18px;
}
.dep-pad-del { color:#c4b5fd !important; }
.dep-hint { text-align:center; color:#9ca3af; font-size:13px; margin-bottom:18px; }
.dep-chips { display:flex; gap:8px; margin-bottom:16px; }
.dep-chips button { flex:1; border:0; background:#1c1c2a; color:#fff; border-radius:12px; padding:12px 0; font-weight:700; }
.dep-pay { width:100%; border:0; border-radius:14px; padding:14px; background:#7c3aed; color:#fff; font-weight:800; font-size:16px; }
.dep-stars { margin-top:8px; background:#f59e0b; color:#111; }
.dep-soon { text-align:center; color:#9ca3af; padding:40px 0; font-weight:700; }

.dep-label { font-size:12px; color:#9ca3af; margin:10px 0 6px; font-weight:600; }
.dep-wallets { display:flex; gap:8px; margin:0 0 12px; }
.dep-wallets button { flex:1; border:0; background:#1c1c2a; color:#fff; border-radius:12px; padding:10px 4px; font-size:11px; font-weight:700; }
.dep-check { width:100%; margin-top:8px; border:0; border-radius:14px; padding:12px; background:#1c1c2a; color:#fff; font-weight:700; }
.dep-status { text-align:center; color:#c4b5fd; font-size:13px; margin-top:12px; min-height:18px; }


#tc-widget-root { z-index: 2147483000; }
.wallet-sheet[hidden] { display: none !important; pointer-events: none !important; }


body.tc-open { overflow: hidden; }
body.tc-open #depositScreen { pointer-events: auto; }
#depositScreen.open { z-index: 420; }



html, body, #app { position:fixed !important; inset:0 !important; width:100% !important; height:100% !important; overflow:hidden !important; overscroll-behavior:none !important; }
#mainContent, .main { overflow-y:auto; overscroll-behavior:contain; -webkit-overflow-scrolling:touch; flex:1; min-height:0; }
.game-screen { overscroll-behavior:contain; }
input, textarea { color-scheme: dark; background:#16162a !important; color:#fff !important; -webkit-text-fill-color:#fff !important; caret-color:#fff; }
