:root {
  --background: #000000;
  --foreground: #ffffff;
  --primary: #8b5cf6;
  --secondary: #ec4899;
  --accent: #06b6d4;
  --warning: #f59e0b;
}

* {
  scroll-behavior: smooth;
}

body {
  background: #000000;
  color: var(--foreground);
  overflow-x: hidden;
  position: relative;
}

body::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background:
    radial-gradient(circle at 20% 50%, rgba(139, 92, 246, 0.15) 0%, transparent 50%),
    radial-gradient(circle at 80% 80%, rgba(236, 72, 153, 0.15) 0%, transparent 50%),
    radial-gradient(circle at 40% 20%, rgba(6, 182, 212, 0.1) 0%, transparent 50%);
  animation: gradientShift 15s ease infinite;
  pointer-events: none;
  z-index: 0;
}

@keyframes gradientShift {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.8; transform: scale(1.1); }
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translate3d(0, 20px, 0); }
  to { opacity: 1; transform: translate3d(0, 0, 0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideInRight {
  from { opacity: 0; transform: translate3d(30px, 0, 0); }
  to { opacity: 1; transform: translate3d(0, 0, 0); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.8; }
}

@keyframes shimmer {
  0% { background-position: -1000px 0; }
  100% { background-position: 1000px 0; }
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

@keyframes glow {
  0%, 100% { box-shadow: 0 0 20px rgba(99, 102, 241, 0.3); }
  50% { box-shadow: 0 0 40px rgba(99, 102, 241, 0.5); }
}

.animate-fadeInUp { animation: fadeInUp 0.6s ease-out forwards; }
.animate-fadeIn { animation: fadeIn 0.8s ease-out forwards; }
.animate-slideInRight { animation: slideInRight 0.5s ease-out forwards; }
.animate-pulse-slow { animation: pulse 3s ease-in-out infinite; }
.animate-shimmer { animation: shimmer 2s linear infinite; }
.animate-float { animation: float 3s ease-in-out infinite; }
.animate-glow { animation: glow 2s ease-in-out infinite; }

.stagger-1 { animation-delay: 0.1s; opacity: 0; }
.stagger-2 { animation-delay: 0.2s; opacity: 0; }
.stagger-3 { animation-delay: 0.3s; opacity: 0; }
.stagger-4 { animation-delay: 0.4s; opacity: 0; }
.stagger-5 { animation-delay: 0.5s; opacity: 0; }
.stagger-6 { animation-delay: 0.6s; opacity: 0; }
.stagger-7 { animation-delay: 0.7s; opacity: 0; }
.stagger-8 { animation-delay: 0.8s; opacity: 0; }
.stagger-9 { animation-delay: 0.9s; opacity: 0; }
.stagger-10 { animation-delay: 1s; opacity: 0; }

.gradient-text {
  background: linear-gradient(135deg, #8b5cf6 0%, #ec4899 50%, #06b6d4 100%);
  background-size: 200% 200%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: gradientFlow 8s ease infinite;
}

@keyframes gradientFlow {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

.glass {
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37), inset 0 1px 0 0 rgba(255, 255, 255, 0.05);
}

.glass-strong {
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(30px) saturate(180%);
  -webkit-backdrop-filter: blur(30px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.4), inset 0 1px 0 0 rgba(255, 255, 255, 0.1);
}

.transition-smooth { transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1); }
.will-animate { will-change: transform, opacity; }

.modern-card {
  position: relative;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}
.modern-card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 2px;
  background: linear-gradient(135deg, #8b5cf6, #ec4899, #06b6d4);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0;
  transition: opacity 0.4s;
}
.modern-card:hover::before { opacity: 1; }
.modern-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 20px 60px rgba(139, 92, 246, 0.3), 0 0 80px rgba(236, 72, 153, 0.2);
}

.neon-glow {
  box-shadow: 0 0 20px rgba(139, 92, 246, 0.5), 0 0 40px rgba(236, 72, 153, 0.3), 0 0 60px rgba(6, 182, 212, 0.2);
}

@keyframes rotateBorder {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.animated-border { position: relative; overflow: hidden; }
.animated-border::after {
  content: "";
  position: absolute;
  inset: -2px;
  background: conic-gradient(from 0deg, #8b5cf6, #ec4899, #06b6d4, #8b5cf6);
  border-radius: inherit;
  animation: rotateBorder 4s linear infinite;
  z-index: -1;
}

.tile-animated {
  left: calc(var(--tile-col) * (56px + 6px));
  top: calc(var(--tile-row) * (56px + 6px));
  transition: left 150ms ease-out, top 150ms ease-out;
}

@media (min-width: 640px) {
  .tile-animated {
    left: calc(var(--tile-col) * (64px + 8px));
    top: calc(var(--tile-row) * (64px + 8px));
  }
}

@media (min-width: 1024px) {
  .tile-animated {
    left: calc(var(--tile-col) * (80px + 12px));
    top: calc(var(--tile-row) * (80px + 12px));
  }
}

@keyframes tile-appear {
  0% { transform: scale(0); opacity: 0; }
  50% { transform: scale(1.1); }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes tile-merge {
  0% { transform: scale(1); }
  50% { transform: scale(1.2); }
  100% { transform: scale(1); }
}

.animate-tile-appear { animation: tile-appear 0.2s ease-out forwards; }
.animate-tile-merge { animation: tile-merge 0.2s ease-out; }

.touch-target { min-height: 44px; min-width: 44px; }

.btn-primary {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 1rem 2rem;
  font-weight: 700;
  color: white;
  background: linear-gradient(135deg, #8b5cf6 0%, #ec4899 50%, #06b6d4 100%);
  background-size: 200% 200%;
  border-radius: 1rem;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 20px 40px rgba(139, 92, 246, 0.4); background-position: 100% 50%; }
.btn-primary:active { transform: translateY(0); }

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 1rem 2rem;
  font-weight: 700;
  color: white;
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 1rem;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.btn-secondary:hover { background: rgba(255, 255, 255, 0.1); transform: translateY(-2px); }

.game-card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 1.5rem;
  overflow: hidden;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}
.game-card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 2px;
  background: linear-gradient(135deg, #8b5cf6, #ec4899, #06b6d4);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0;
  transition: opacity 0.4s;
}
.game-card:hover::before, .game-card:focus-within::before { opacity: 1; }
.game-card:hover, .game-card:focus-within { transform: translateY(-8px); box-shadow: 0 25px 50px rgba(139, 92, 246, 0.25); }
@media (hover: none) {
  .game-card:hover { transform: none; }
  .game-card:active { transform: scale(0.98); }
}

.gradient-border { position: relative; background: rgba(0, 0, 0, 0.8); }
.gradient-border::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(135deg, #8b5cf6, #ec4899, #06b6d4);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
}

.nav-header { position: fixed; top: 0; left: 0; right: 0; z-index: 100; background: transparent; }

.mobile-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 100;
  background: rgba(0, 0, 0, 0.95);
  backdrop-filter: blur(20px);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding: 0.75rem 1rem;
  padding-bottom: calc(0.75rem + env(safe-area-inset-bottom));
}

.casino-claim-btn {
  background: linear-gradient(135deg, #f59e0b 0%, #ef4444 50%, #ec4899 100%);
  background-size: 200% 200%;
  animation: casinoGradient 3s ease infinite;
  box-shadow: 0 0 20px rgba(245, 158, 11, 0.35), 0 4px 15px rgba(0,0,0,0.3);
}

.casino-claim-btn:hover {
  box-shadow: 0 0 32px rgba(245, 158, 11, 0.55), 0 4px 20px rgba(0,0,0,0.4);
  transform: translateY(-1px);
}

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

@keyframes casinoGradient {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

.game-container {
  position: relative;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 1.5rem;
  padding: 1.5rem;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
}
@media (max-width: 640px) {
  .game-container { padding: 1rem; border-radius: 1rem; }
}

.touch-control {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 60px;
  height: 60px;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 1rem;
  color: white;
  font-size: 1.5rem;
  transition: all 0.15s;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
.touch-control:active { background: rgba(139, 92, 246, 0.5); transform: scale(0.95); }

.stat-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1rem 1.5rem;
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 1rem;
}

.fab {
  position: fixed;
  bottom: calc(1.5rem + env(safe-area-inset-bottom));
  right: 1.5rem;
  width: 56px; height: 56px;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #8b5cf6, #ec4899);
  border-radius: 50%;
  color: white;
  box-shadow: 0 8px 30px rgba(139, 92, 246, 0.5);
  z-index: 90;
  transition: all 0.3s;
}
.fab:active { transform: scale(0.95); }

@keyframes pulse-ring {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(139, 92, 246, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 10px rgba(139, 92, 246, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(139, 92, 246, 0); }
}
.animate-pulse-ring { animation: pulse-ring 2s infinite; }

@keyframes slideInUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}
.animate-slideInUp { animation: slideInUp 0.5s ease-out forwards; }

@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.9); }
  to { opacity: 1; transform: scale(1); }
}
.animate-scaleIn { animation: scaleIn 0.3s ease-out forwards; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: rgba(255, 255, 255, 0.05); }
::-webkit-scrollbar-thumb { background: rgba(139, 92, 246, 0.5); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(139, 92, 246, 0.7); }

@media (max-width: 768px) {
  ::-webkit-scrollbar { display: none; }
  * { -ms-overflow-style: none; scrollbar-width: none; }
}

.safe-area-bottom { padding-bottom: env(safe-area-inset-bottom); }
.safe-area-top { padding-top: env(safe-area-inset-top); }

.focus-ring:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.5); }

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