:root {
  --primary-blue: #1565C0;
  --dark-red: #C62828;
  --medium-blue: #1E88E5;
  --light-blue: #42A5F5;
  
  /* Light Theme Colors */
  --bg-main: #FFFFFF;
  --bg-secondary: #F8FAFC;
  --text-main: #1E293B;
  --text-muted: #64748B;
  
  /* Light Glassmorphism */
  --glass-bg: rgba(255, 255, 255, 0.85);
  --glass-border: rgba(21, 101, 192, 0.15);
  --gold-accent: #D4AF37; /* Darker gold for light theme */
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Cairo', sans-serif;
  background-color: var(--bg-main);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  position: relative;
}

/* Background Particles (Lightened) */
.bg-particles {
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  background: radial-gradient(circle at 50% 0%, rgba(21, 101, 192, 0.05) 0%, var(--bg-main) 70%);
  z-index: -1;
  pointer-events: none;
}

/* Glassmorphism Classes */
.glass-card {
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.05);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border: none;
  border-radius: 12px;
  font-family: inherit;
  font-weight: 700;
  font-size: 1.1rem;
  cursor: pointer;
  transition: all 0.3s ease;
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--medium-blue), var(--primary-blue));
  color: white;
  box-shadow: 0 4px 15px rgba(21, 101, 192, 0.2);
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(21, 101, 192, 0.4);
}

.btn-lg {
  width: 100%;
  padding: 15px;
  font-size: 1.2rem;
}

.btn-secondary {
  background: rgba(21, 101, 192, 0.05);
  color: var(--primary-blue);
  border: 1px solid rgba(21, 101, 192, 0.2);
}
.btn-secondary:hover {
  background: rgba(21, 101, 192, 0.1);
}

/* Header */
.game-header {
  padding: 20px;
  display: flex;
  justify-content: center;
  position: relative;
  z-index: 10;
}
.header-inner {
  width: 100%;
  max-width: 800px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.header-logo {
  max-height: 50px;
}
.leaderboard-btn {
  background: var(--bg-secondary);
  border: 1px solid var(--glass-border);
  color: var(--primary-blue);
  padding: 8px 16px;
  border-radius: 20px;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
  transition: 0.3s;
}
.leaderboard-btn:hover {
  background: rgba(21, 101, 192, 0.1);
}

/* Main */
.game-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px;
  max-width: 1000px;
  margin: 0 auto;
  width: 100%;
  z-index: 10;
}

/* Hero */
.hero-section {
  text-align: center;
  margin-bottom: 40px;
  animation: fadeIn 1s ease;
}
.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(198, 40, 40, 0.1);
  color: var(--dark-red);
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 700;
  margin-bottom: 15px;
  border: 1px solid rgba(198, 40, 40, 0.2);
}
.badge-dot {
  width: 8px; height: 8px;
  background: var(--dark-red);
  border-radius: 50%;
  animation: pulse 2s infinite;
}
.hero-title {
  font-size: 2.2rem;
  font-weight: 900;
  margin-bottom: 10px;
  line-height: 1.4;
  color: var(--primary-blue);
}
.hero-subtitle {
  color: var(--text-muted);
  font-size: 1.1rem;
}

/* Step Card (Registration) */
.step-section {
  width: 100%;
  max-width: 480px;
  animation: slideUp 0.5s ease;
}
.step-card {
  padding: 30px;
}
.step-header {
  display: flex;
  align-items: center;
  gap: 15px;
  margin-bottom: 25px;
}
.step-number {
  width: 40px; height: 40px;
  background: var(--primary-blue);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 1.2rem;
  color: white;
  box-shadow: 0 4px 10px rgba(21, 101, 192, 0.2);
}
.step-title {
  font-size: 1.4rem;
  color: var(--text-main);
}

/* Form */
.form-group {
  margin-bottom: 20px;
}
.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-main);
}
.input-wrapper {
  position: relative;
}
.input-icon {
  position: absolute;
  right: 15px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.2rem;
  opacity: 0.5;
  color: var(--text-main);
}
.input-wrapper input {
  width: 100%;
  background: var(--bg-main);
  border: 1px solid #CBD5E1;
  border-radius: 12px;
  padding: 15px 45px 15px 15px; /* RTL fix: larger padding on the right where the icon is */
  color: var(--text-main);
  font-family: inherit;
  font-size: 1rem;
  transition: 0.3s;
}
.input-wrapper input:focus {
  outline: none;
  border-color: var(--primary-blue);
  box-shadow: 0 0 0 3px rgba(21, 101, 192, 0.1);
}
.form-note {
  text-align: center;
  margin-top: 15px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Welcome UI (Step 2) */
.user-welcome {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 20px;
  background: var(--bg-secondary);
  padding: 15px;
  border-radius: 15px;
  border: 1px solid var(--glass-border);
}
.remaining-spins {
  margin-right: auto;
  background: rgba(21, 101, 192, 0.1);
  color: var(--primary-blue);
  padding: 5px 10px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 700;
}

/* Wheel Assembly */
.wheel-assembly {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 30px 0;
}

.wheel-pointer-wrap {
  position: absolute;
  top: -20px;
  z-index: 20;
  filter: drop-shadow(0 4px 6px rgba(0,0,0,0.3));
}
.wheel-pointer-arrow {
  width: 40px;
  height: 50px;
  background: var(--dark-red);
  clip-path: polygon(50% 100%, 0 0, 100% 0);
  position: relative;
}
.wheel-pointer-arrow::after {
  content: '';
  position: absolute;
  top: 0; left: 5px; right: 5px; height: 35px;
  background: rgba(255,255,255,0.2);
  clip-path: polygon(50% 100%, 0 0, 100% 0);
}

.wheel-canvas-wrap {
  position: relative;
  width: 320px;
  height: 320px;
  border-radius: 50%;
  box-shadow: 0 0 0 10px var(--bg-secondary),
              0 10px 30px rgba(0,0,0,0.15),
              inset 0 0 20px rgba(0,0,0,0.1);
  background: #FFF;
  overflow: hidden;
}
@media (min-width: 480px) {
  .wheel-canvas-wrap { width: 380px; height: 380px; }
}

#wheelCanvas {
  width: 100%;
  height: 100%;
  display: block;
}

.spin-center-btn {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 80px; height: 80px;
  border-radius: 50%;
  border: 4px solid #fff;
  background: radial-gradient(circle, var(--dark-red) 0%, #8e0000 100%);
  color: white;
  font-family: inherit;
  font-weight: 900;
  font-size: 1.2rem;
  cursor: pointer;
  box-shadow: 0 5px 15px rgba(0,0,0,0.3), inset 0 2px 5px rgba(255,255,255,0.5);
  z-index: 10;
  transition: 0.3s;
}
.spin-center-btn:not(:disabled):hover {
  transform: translate(-50%, -50%) scale(1.05);
  box-shadow: 0 5px 20px rgba(198, 40, 40, 0.4), inset 0 2px 5px rgba(255,255,255,0.5);
}
.spin-center-btn:disabled {
  background: #999;
  cursor: not-allowed;
  opacity: 0.8;
}
.spin-btn-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.spin-btn-icon { font-size: 1.5rem; line-height: 1; }

.wheel-stand {
  margin-top: -10px;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.stand-column {
  width: 40px;
  height: 60px;
  background: linear-gradient(to right, #ccc, #eee, #ccc);
  border-radius: 5px;
}
.stand-base {
  width: 120px;
  height: 20px;
  background: linear-gradient(to bottom, #999, #666);
  border-radius: 10px;
  box-shadow: 0 10px 20px rgba(0,0,0,0.2);
}

/* Modals */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: 0.3s ease;
}
.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}
.modal-card {
  width: 90%;
  max-width: 400px;
  padding: 40px 30px;
  text-align: center;
  transform: scale(0.8) translateY(20px);
  transition: 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  background: #FFF;
  border: 1px solid #E2E8F0;
}
.modal-overlay.active .modal-card {
  transform: scale(1) translateY(0);
}
.modal-icon {
  font-size: 4rem;
  margin-bottom: 20px;
  animation: bounce 2s infinite;
}
.modal-title {
  font-size: 2rem;
  margin-bottom: 10px;
  color: var(--primary-blue);
}
.modal-prize {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 15px;
}
.modal-message {
  color: var(--text-muted);
  margin-bottom: 30px;
  line-height: 1.5;
}

/* Social Buttons */
.share-label {
  font-size: 0.9rem; margin-bottom: 15px; color: var(--text-muted); font-weight: 600;
}
.share-btns-row {
  display: flex; gap: 10px; margin-bottom: 25px;
}
.btn-facebook {
  background: #1877F2; flex: 1; font-size: 1rem; color: white;
}
.btn-facebook:hover { background: #166fe5; color: white; }

.btn-instagram {
  background: linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%);
  flex: 1; font-size: 1rem; color: white;
}
.btn-instagram:hover { color: white; opacity: 0.9;}

/* IG Share Modal specific */
.ig-modal {
  max-width: 500px;
}
.share-card-preview {
  width: 100%;
  border-radius: 10px;
  overflow: hidden;
  margin: 20px 0;
  border: 1px solid var(--glass-border);
  box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}
.share-card-preview canvas {
  width: 100%;
  height: auto;
  display: block;
}
.ig-instructions {
  text-align: right;
  background: var(--bg-secondary);
  padding: 15px 30px;
  border-radius: 10px;
  margin-bottom: 20px;
  font-size: 0.95rem;
  line-height: 1.6;
  border: 1px solid #E2E8F0;
  color: var(--text-main);
}
.ig-instructions li { margin-bottom: 5px; }

/* Mini Leaderboard */
.mini-leaderboard {
  width: 100%; max-width: 480px;
  margin-top: 40px;
  background: var(--bg-main);
  border: 1px solid #E2E8F0;
  border-radius: 15px;
  overflow: hidden;
  box-shadow: 0 4px 15px rgba(0,0,0,0.02);
}
.leaderboard-header {
  padding: 15px 20px;
  border-bottom: 1px solid #E2E8F0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-secondary);
}
.lb-title { font-size: 1.1rem; font-weight: 700; color: var(--primary-blue);}
.live-indicator {
  display: flex; align-items: center; gap: 6px; font-size: 0.8rem; color: var(--text-muted);
}
.live-dot {
  width: 6px; height: 6px; background: #4caf50; border-radius: 50%;
  animation: pulse 2s infinite;
}
.lb-list {
  max-height: 250px; overflow-y: auto; padding: 10px;
}
.lb-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 15px;
  border-bottom: 1px solid #F1F5F9;
  animation: fadeIn 0.5s ease;
}
.lb-item:last-child { border-bottom: none; }
.lb-user-info { display: flex; align-items: center; gap: 10px; }
.lb-avatar {
  width: 35px; height: 35px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: white; font-weight: bold; font-size: 1.2rem;
}
.lb-name { font-weight: 600; font-size: 0.95rem; color: var(--text-main);}
.lb-time { font-size: 0.75rem; color: var(--text-muted); }
.lb-prize-badge {
  background: var(--bg-secondary);
  padding: 4px 10px; border-radius: 12px;
  font-size: 0.85rem; font-weight: 700;
  display: flex; align-items: center; gap: 5px;
}
.lb-view-all {
  display: block; text-align: center; padding: 12px;
  background: var(--bg-secondary); color: var(--primary-blue); text-decoration: none;
  font-size: 0.9rem; transition: 0.3s; font-weight: 600;
}
.lb-view-all:hover { background: #E2E8F0; }

/* Confetti */
.confetti-container {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  pointer-events: none; z-index: 999;
}

/* Toast */
.toast {
  position: fixed; top: 20px; left: 50%; transform: translateX(-50%) translateY(-100px);
  background: white; color: #333; padding: 12px 24px; border-radius: 8px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.1); font-weight: 600; z-index: 2000;
  transition: 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.toast.show { transform: translateX(-50%) translateY(0); }
.toast.success { border-bottom: 3px solid #4caf50; }
.toast.error { border-bottom: 3px solid #f44336; }

/* Animations */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes pulse { 0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(198,40,40, 0.7); } 70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(198,40,40, 0); } 100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(198,40,40, 0); } }
@keyframes bounce { 0%, 20%, 50%, 80%, 100% { transform: translateY(0); } 40% { transform: translateY(-20px); } 60% { transform: translateY(-10px); } }

/* Custom Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #CBD5E1; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #94A3B8; }

/* Footer */
.game-footer {
  text-align: center; padding: 20px; color: var(--text-muted); font-size: 0.9rem;
}
.game-footer a { color: var(--primary-blue); text-decoration: none; font-weight: 600;}
