/* === LUCKY ACE SPIN - Casino Theme === */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;600;700;800;900&display=swap');

:root {
  --gold: #FFD700;
  --gold-dark: #B8960C;
  --purple: #6B2FA0;
  --purple-dark: #3D1B5E;
  --purple-light: #9B59B6;
  --neon-pink: #FF2D95;
  --neon-blue: #00D4FF;
  --bg-dark: #0D0221;
  --bg-card: #1A0A3E;
  --bg-card-light: #2B1355;
  --text: #FFFFFF;
  --text-dim: #A89CC8;
  --success: #2ECC71;
  --danger: #E74C3C;
}

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

body {
  font-family: 'Poppins', sans-serif;
  background: var(--bg-dark);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  background-image:
    radial-gradient(ellipse at 20% 50%, rgba(107,47,160,0.3) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(255,45,149,0.15) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 80%, rgba(0,212,255,0.1) 0%, transparent 50%);
}

#app {
  max-width: 430px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding-bottom: 80px;
}

/* === TOP BAR === */
.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: rgba(26,10,62,0.9);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255,215,0,0.2);
}

.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--purple), var(--neon-pink));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 18px;
  border: 2px solid var(--gold);
}

.user-details {
  display: flex;
  flex-direction: column;
}

.username {
  font-weight: 700;
  font-size: 14px;
}

.streak-badge {
  font-size: 11px;
  color: var(--gold);
  font-weight: 600;
}

.currency-bar {
  display: flex;
  gap: 12px;
}

.coin-display, .spin-display {
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(255,215,0,0.1);
  padding: 6px 12px;
  border-radius: 20px;
  border: 1px solid rgba(255,215,0,0.3);
  font-weight: 700;
  font-size: 14px;
}

.coin-icon, .spin-icon {
  font-size: 16px;
}

/* === STREAK BANNER === */
.streak-banner {
  background: linear-gradient(90deg, var(--purple-dark), var(--neon-pink), var(--purple-dark));
  padding: 10px 16px;
  text-align: center;
  animation: shimmer 3s infinite;
}

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

.streak-content {
  font-weight: 700;
  font-size: 13px;
}

.streak-fire {
  font-size: 16px;
}

/* === WHEEL === */
.wheel-container {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 30px 0 20px;
  flex: 1;
}

.wheel-glow {
  position: absolute;
  width: 340px;
  height: 340px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,215,0,0.3) 0%, transparent 70%);
  animation: pulse-glow 2s ease-in-out infinite;
}

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

#wheelCanvas {
  position: relative;
  z-index: 2;
  filter: drop-shadow(0 0 20px rgba(255,215,0,0.4));
  transition: filter 0.3s;
}

#wheelCanvas.spinning {
  filter: drop-shadow(0 0 40px rgba(255,215,0,0.8));
}

.wheel-pointer {
  position: absolute;
  top: 22px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 3;
  width: 0;
  height: 0;
  border-left: 16px solid transparent;
  border-right: 16px solid transparent;
  border-top: 30px solid var(--gold);
  filter: drop-shadow(0 2px 6px rgba(0,0,0,0.5));
}

/* === SPIN BUTTON === */
.spin-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 0 auto 12px;
  padding: 14px 60px;
  border: none;
  border-radius: 50px;
  background: linear-gradient(135deg, var(--gold), #FFA500, var(--gold));
  background-size: 200% 200%;
  color: var(--bg-dark);
  font-family: 'Poppins', sans-serif;
  cursor: pointer;
  box-shadow:
    0 4px 15px rgba(255,215,0,0.4),
    inset 0 1px 0 rgba(255,255,255,0.3);
  animation: btn-shimmer 3s ease-in-out infinite;
  transition: transform 0.15s, box-shadow 0.15s;
}

.spin-btn:active {
  transform: scale(0.95);
  box-shadow: 0 2px 8px rgba(255,215,0,0.3);
}

.spin-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  animation: none;
}

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

.spin-btn-text {
  font-size: 22px;
  font-weight: 900;
  letter-spacing: 2px;
}

.spin-btn-sub {
  font-size: 11px;
  font-weight: 600;
  opacity: 0.8;
}

/* === RESULT OVERLAY === */
.result-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.8);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fade-in 0.3s;
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.result-card {
  background: linear-gradient(135deg, var(--bg-card), var(--purple-dark));
  border: 2px solid var(--gold);
  border-radius: 24px;
  padding: 32px 40px;
  text-align: center;
  animation: pop-in 0.4s cubic-bezier(0.18, 1.25, 0.4, 1);
  max-width: 300px;
  width: 90%;
}

@keyframes pop-in {
  from { transform: scale(0.5); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.result-emoji {
  font-size: 64px;
  margin-bottom: 12px;
}

.result-title {
  font-size: 24px;
  font-weight: 900;
  color: var(--gold);
  margin-bottom: 8px;
}

.result-desc {
  font-size: 14px;
  color: var(--text-dim);
  margin-bottom: 20px;
}

.result-btn {
  padding: 12px 40px;
  border: none;
  border-radius: 30px;
  background: linear-gradient(135deg, var(--gold), #FFA500);
  color: var(--bg-dark);
  font-family: 'Poppins', sans-serif;
  font-weight: 800;
  font-size: 16px;
  cursor: pointer;
  transition: transform 0.15s;
}

.result-btn:active {
  transform: scale(0.95);
}

/* === AD BANNER === */
.ad-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 0 16px 12px;
  padding: 10px 16px;
  background: var(--bg-card);
  border: 1px solid rgba(0,212,255,0.3);
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
}

.ad-btn {
  padding: 6px 16px;
  border: none;
  border-radius: 20px;
  background: var(--neon-blue);
  color: var(--bg-dark);
  font-family: 'Poppins', sans-serif;
  font-weight: 700;
  font-size: 12px;
  cursor: pointer;
}

/* === BOTTOM NAV === */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-around;
  background: rgba(26,10,62,0.95);
  backdrop-filter: blur(10px);
  border-top: 1px solid rgba(255,215,0,0.2);
  padding: 8px 0 max(8px, env(safe-area-inset-bottom));
  z-index: 50;
  max-width: 430px;
  margin: 0 auto;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-decoration: none;
  color: var(--text-dim);
  font-size: 10px;
  font-weight: 600;
  gap: 2px;
  cursor: pointer;
  transition: color 0.2s;
}

.nav-item.active {
  color: var(--gold);
}

.nav-icon {
  font-size: 22px;
}

/* === SHOP PAGE === */
.page-header {
  text-align: center;
  padding: 20px 16px 10px;
}

.page-title {
  font-size: 24px;
  font-weight: 900;
  background: linear-gradient(135deg, var(--gold), #FFA500);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.page-subtitle {
  font-size: 12px;
  color: var(--text-dim);
}

.shop-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
}

.shop-card {
  background: var(--bg-card);
  border: 1px solid rgba(255,215,0,0.2);
  border-radius: 16px;
  padding: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: transform 0.15s, border-color 0.2s;
}

.shop-card:active {
  transform: scale(0.98);
}

.shop-card.popular {
  border-color: var(--gold);
  background: linear-gradient(135deg, var(--bg-card), rgba(255,215,0,0.1));
}

.shop-card-left {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.shop-card-title {
  font-size: 18px;
  font-weight: 800;
}

.shop-card-desc {
  font-size: 12px;
  color: var(--text-dim);
}

.shop-card-badge {
  font-size: 10px;
  color: var(--neon-pink);
  font-weight: 700;
}

.shop-card-price {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  background: linear-gradient(135deg, var(--gold), #FFA500);
  border-radius: 25px;
  color: var(--bg-dark);
  font-weight: 800;
  font-size: 14px;
  cursor: pointer;
  border: none;
  font-family: 'Poppins', sans-serif;
}

.shop-section-title {
  font-size: 16px;
  font-weight: 800;
  padding: 8px 16px 0;
  color: var(--purple-light);
}

.skin-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 12px 16px;
}

.skin-card {
  background: var(--bg-card);
  border: 1px solid rgba(155,89,182,0.3);
  border-radius: 16px;
  padding: 16px;
  text-align: center;
  cursor: pointer;
  transition: transform 0.15s, border-color 0.2s;
}

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

.skin-card.owned {
  border-color: var(--success);
}

.skin-card.equipped {
  border-color: var(--gold);
  background: rgba(255,215,0,0.08);
}

.skin-preview {
  font-size: 48px;
  margin-bottom: 8px;
}

.skin-name {
  font-size: 13px;
  font-weight: 700;
}

.skin-cost {
  font-size: 11px;
  color: var(--gold);
  font-weight: 600;
}

/* === LEADERBOARD === */
.leaderboard-list {
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.lb-row {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-card);
  border-radius: 14px;
  padding: 14px 16px;
  border: 1px solid rgba(155,89,182,0.2);
}

.lb-row.top-3 {
  border-color: var(--gold);
  background: linear-gradient(135deg, var(--bg-card), rgba(255,215,0,0.08));
}

.lb-rank {
  font-size: 18px;
  font-weight: 900;
  min-width: 32px;
  text-align: center;
}

.lb-row.top-3 .lb-rank {
  color: var(--gold);
}

.lb-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--purple), var(--neon-pink));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 14px;
}

.lb-info {
  flex: 1;
}

.lb-name {
  font-weight: 700;
  font-size: 14px;
}

.lb-spins {
  font-size: 11px;
  color: var(--text-dim);
}

.lb-coins {
  font-weight: 800;
  color: var(--gold);
  font-size: 14px;
}

.lb-tabs {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
}

.lb-tab {
  flex: 1;
  padding: 10px;
  border: 1px solid rgba(155,89,182,0.3);
  border-radius: 12px;
  background: var(--bg-card);
  color: var(--text-dim);
  font-family: 'Poppins', sans-serif;
  font-weight: 700;
  font-size: 13px;
  text-align: center;
  cursor: pointer;
}

.lb-tab.active {
  border-color: var(--gold);
  color: var(--gold);
  background: rgba(255,215,0,0.08);
}

/* === REFERRAL MODAL === */
.referral-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.8);
  z-index: 100;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: fade-in 0.3s;
}

.referral-sheet {
  background: var(--bg-card);
  border-top-left-radius: 24px;
  border-top-right-radius: 24px;
  padding: 24px;
  width: 100%;
  max-width: 430px;
  animation: slide-up 0.4s cubic-bezier(0.18,1.25,0.4,1);
}

@keyframes slide-up {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.referral-title {
  font-size: 20px;
  font-weight: 900;
  text-align: center;
  margin-bottom: 8px;
}

.referral-desc {
  font-size: 13px;
  color: var(--text-dim);
  text-align: center;
  margin-bottom: 20px;
}

.referral-link-box {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.referral-link {
  flex: 1;
  padding: 12px;
  background: var(--bg-dark);
  border: 1px solid rgba(155,89,182,0.3);
  border-radius: 12px;
  color: var(--text);
  font-family: 'Poppins', sans-serif;
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.copy-btn {
  padding: 12px 20px;
  border: none;
  border-radius: 12px;
  background: var(--gold);
  color: var(--bg-dark);
  font-family: 'Poppins', sans-serif;
  font-weight: 800;
  font-size: 13px;
  cursor: pointer;
}

.referral-stats {
  display: flex;
  justify-content: space-around;
  margin-bottom: 16px;
}

.ref-stat {
  text-align: center;
}

.ref-stat-num {
  font-size: 24px;
  font-weight: 900;
  color: var(--gold);
}

.ref-stat-label {
  font-size: 11px;
  color: var(--text-dim);
}

.close-sheet-btn {
  width: 100%;
  padding: 14px;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 14px;
  background: transparent;
  color: var(--text);
  font-family: 'Poppins', sans-serif;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
}

/* === TOAST === */
.toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-card);
  border: 1px solid var(--gold);
  border-radius: 12px;
  padding: 10px 24px;
  font-weight: 700;
  font-size: 13px;
  z-index: 200;
  animation: toast-in 0.3s, toast-out 0.3s 2s forwards;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateX(-50%) translateY(-20px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

@keyframes toast-out {
  from { opacity: 1; }
  to { opacity: 0; }
}

/* === CONFETTI PARTICLES === */
.confetti-particle {
  position: fixed;
  z-index: 150;
  pointer-events: none;
  font-size: 20px;
  animation: confetti-fall 1.5s ease-out forwards;
}

@keyframes confetti-fall {
  0% {
    opacity: 1;
    transform: translateY(0) rotate(0deg) scale(1);
  }
  100% {
    opacity: 0;
    transform: translateY(400px) rotate(720deg) scale(0.3);
  }
}
