:root {
  --bg-gradient: radial-gradient(circle at 50% 10%, #1e1b4b 0%, #0f172a 45%, #030712 100%);
  --gold-primary: #f59e0b;
  --gold-light: #fde68a;
  --gold-dark: #b45309;
  --gold-glow: rgba(245, 158, 11, 0.45);
  --cyan-accent: #06b6d4;
  --card-bg: rgba(15, 23, 42, 0.75);
  --card-border: rgba(245, 158, 11, 0.25);
  --text-primary: #f8fafc;
  --text-muted: #94a3b8;
  --font-family: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

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

body {
  font-family: var(--font-family);
  background: var(--bg-gradient);
  background-attachment: fixed;
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  position: relative;
}

/* Background animated stars / ambient glow */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: 
    radial-gradient(circle at 20% 30%, rgba(99, 102, 241, 0.15) 0%, transparent 40%),
    radial-gradient(circle at 80% 70%, rgba(245, 158, 11, 0.12) 0%, transparent 45%);
  pointer-events: none;
  z-index: 0;
}

.container {
  max-width: 1340px;
  margin: 0 auto;
  padding: 0 20px;
  width: 100%;
  position: relative;
  z-index: 1;
}

/* NAVBAR */
.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.logo-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-icon {
  font-size: 32px;
  filter: drop-shadow(0 0 10px var(--gold-glow));
  animation: floatIcon 3s ease-in-out infinite;
}

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

.logo-text h1 {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 0.5px;
  background: linear-gradient(135deg, #fff, var(--gold-light), var(--gold-primary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.live-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #f87171;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 20px;
  text-transform: uppercase;
}

.live-dot {
  width: 6px;
  height: 6px;
  background: #ef4444;
  border-radius: 50%;
  box-shadow: 0 0 8px #ef4444;
  animation: pulseDot 1.5s infinite;
}

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

.nav-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.icon-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--text-primary);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  transition: all 0.2s ease;
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.16);
  transform: scale(1.05);
}

.admin-nav-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid var(--gold-primary);
  color: var(--gold-light);
  text-decoration: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  transition: all 0.2s ease;
}

.admin-nav-link:hover {
  background: var(--gold-primary);
  color: #000;
  box-shadow: 0 0 15px var(--gold-glow);
}

/* MARQUEE WINNERS TICKER */
.ticker-bar {
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(245, 158, 11, 0.2);
  border-radius: 30px;
  margin: 15px 0 25px 0;
  padding: 8px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  overflow: hidden;
  box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.5);
}

.ticker-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  color: var(--gold-light);
  white-space: nowrap;
  background: rgba(245, 158, 11, 0.15);
  padding: 4px 10px;
  border-radius: 14px;
}

.ticker-content {
  overflow: hidden;
  white-space: nowrap;
  flex: 1;
}

.ticker-track {
  display: inline-flex;
  gap: 30px;
  animation: scrollTicker 28s linear infinite;
}

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

.ticker-item span.winner-name {
  color: var(--gold-light);
  font-weight: 600;
}

.ticker-item span.prize-name {
  color: #38bdf8;
  font-weight: 600;
}

@keyframes scrollTicker {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

/* MAIN HERO WHEEL LAYOUT */
.hero-layout {
  display: grid;
  grid-template-columns: minmax(280px, 340px) auto minmax(280px, 340px);
  align-items: center;
  justify-content: center;
  gap: 28px;
  margin: 20px 0 40px 0;
}

@media (max-width: 1100px) {
  .hero-layout {
    grid-template-columns: 1fr;
    justify-items: center;
    gap: 30px;
  }
}

/* SIDE PANEL CARDS */
.side-panel {
  display: flex;
  flex-direction: column;
  gap: 20px;
  width: 100%;
}

.glass-card {
  background: var(--card-bg);
  backdrop-filter: blur(12px);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

.glass-card h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--gold-light);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* USER INFO PROFILE CARD */
.user-profile {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
}

.avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: linear-gradient(135deg, #f59e0b, #ec4899);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.4);
}

.user-meta {
  flex: 1;
}

.user-name-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.user-name {
  font-weight: 700;
  font-size: 16px;
  color: #fff;
}

.edit-name-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 12px;
  transition: color 0.2s;
}

.edit-name-btn:hover {
  color: var(--gold-light);
}

.user-id-sub {
  font-size: 11px;
  color: var(--text-muted);
}

/* SPIN COUNTER BIG BADGE */
.spin-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 16px;
}

.stat-box {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 12px;
  text-align: center;
}

.stat-box.highlight {
  border-color: rgba(245, 158, 11, 0.5);
  background: linear-gradient(180deg, rgba(245, 158, 11, 0.15) 0%, rgba(0, 0, 0, 0.3) 100%);
}

.stat-value {
  font-size: 26px;
  font-weight: 800;
  color: var(--gold-light);
  line-height: 1.1;
  text-shadow: 0 0 10px var(--gold-glow);
}

.stat-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 600;
  margin-top: 4px;
}

.btn-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #fff;
  padding: 10px 16px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.3);
  transform: translateY(-1px);
}

.btn-gold {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  border: none;
  color: #000;
  font-weight: 700;
  box-shadow: 0 4px 15px var(--gold-glow);
}

.btn-gold:hover {
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
  box-shadow: 0 6px 20px rgba(245, 158, 11, 0.6);
}

/* PRIZE LIST PREVIEW */
.prize-list-preview {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 280px;
  overflow-y: auto;
  padding-right: 4px;
}

.prize-list-preview::-webkit-scrollbar {
  width: 4px;
}
.prize-list-preview::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
}

.prize-item-mini {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.05);
  padding: 8px 12px;
  border-radius: 8px;
}

.prize-item-mini .left {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
}

.prize-badge {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 12px;
  font-weight: 600;
}

.prize-badge.stock {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.prize-badge.out {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.prize-badge.spins {
  background: rgba(168, 85, 247, 0.2);
  color: #c084fc;
  border: 1px solid rgba(168, 85, 247, 0.3);
}

/* WHEEL CONTAINER & POINTER */
.wheel-section {
  display: flex;
  justify-content: center;
  align-items: center;
}

.wheel-wrapper {
  position: relative;
  width: var(--wheel-size, 480px);
  height: var(--wheel-size, 480px);
  max-width: 95vw;
  max-height: 95vw;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: width 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), height 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@media (max-width: 576px) {
  .wheel-wrapper {
    width: min(350px, 92vw) !important;
    height: min(350px, 92vw) !important;
  }
}

#wheelCanvas {
  width: 100%;
  height: 100%;
  display: block;
  filter: drop-shadow(0 0 25px rgba(245, 158, 11, 0.3));
}

/* 3D LUXURY POINTER PIN (Top at 12 o'clock) */
.wheel-pointer {
  position: absolute;
  top: -14px;
  left: 50%;
  transform: translateX(-50%);
  width: 36px;
  height: 52px;
  z-index: 10;
  pointer-events: none;
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.8));
}

.wheel-pointer svg {
  width: 100%;
  height: 100%;
  display: block;
}

/* CENTER SPIN BUTTON */
.spin-center-btn {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 82px;
  height: 82px;
  border-radius: 50%;
  background: radial-gradient(circle, #fde047 0%, #f59e0b 60%, #b45309 100%);
  border: 4px solid #fff;
  color: #78350f;
  font-weight: 900;
  font-size: 15px;
  letter-spacing: 0.5px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 0 20px rgba(245, 158, 11, 0.8), inset 0 2px 4px rgba(255, 255, 255, 0.8);
  transition: transform 0.15s ease, box-shadow 0.2s ease;
  z-index: 5;
  user-select: none;
}

.spin-center-btn span.sub {
  font-size: 9px;
  color: #92400e;
  font-weight: 700;
  margin-top: -2px;
}

.spin-center-btn:hover {
  transform: translate(-50%, -50%) scale(1.08);
  box-shadow: 0 0 30px rgba(245, 158, 11, 1), inset 0 2px 6px rgba(255, 255, 255, 1);
}

.spin-center-btn:active {
  transform: translate(-50%, -50%) scale(0.96);
}

.spin-center-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  filter: grayscale(0.5);
  animation: none;
}

/* PULSE RING AROUND SPIN BUTTON */
.pulse-ring {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 84px;
  height: 84px;
  border-radius: 50%;
  border: 2px solid rgba(245, 158, 11, 0.7);
  animation: pulseRingAnim 2s infinite cubic-bezier(0.215, 0.61, 0.355, 1);
  pointer-events: none;
  z-index: 4;
}

@keyframes pulseRingAnim {
  0% { transform: translate(-50%, -50%) scale(0.95); opacity: 0.8; }
  100% { transform: translate(-50%, -50%) scale(1.55); opacity: 0; }
}

/* FOOTER */
.footer {
  margin-top: auto;
  padding: 24px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
}

/* MODALS */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: all 0.25s ease;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal-card {
  background: #0f172a;
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: 20px;
  padding: 28px;
  width: 100%;
  max-width: 480px;
  position: relative;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8), 0 0 30px rgba(245, 158, 11, 0.2);
  transform: translateY(20px) scale(0.95);
  transition: transform 0.25s ease;
}

.modal-overlay.active .modal-card {
  transform: translateY(0) scale(1);
}

.modal-close-btn {
  position: absolute;
  top: 16px;
  right: 16px;
  background: rgba(255, 255, 255, 0.08);
  border: none;
  color: #94a3b8;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  transition: all 0.2s;
}

.modal-close-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}

/* WINNER POPUP SPECIAL CARD */
.win-modal-header {
  text-align: center;
  margin-bottom: 20px;
}

.win-icon {
  font-size: 56px;
  filter: drop-shadow(0 0 15px var(--gold-glow));
  animation: bounce 1s infinite alternate;
}

@keyframes bounce {
  from { transform: translateY(0) scale(1); }
  to { transform: translateY(-8px) scale(1.08); }
}

.win-modal-header h2 {
  font-size: 24px;
  font-weight: 800;
  color: var(--gold-light);
  margin-top: 8px;
}

.win-prize-badge {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--gold-light);
  letter-spacing: 1.5px;
  margin-top: 8px;
}

.win-prize-title {
  font-size: 24px;
  font-weight: 900;
  color: #fff;
  margin-top: 4px;
  text-shadow: 0 0 20px rgba(245, 158, 11, 0.6);
  letter-spacing: 0.5px;
}

/* WIN SNAPSHOT VERIFY CARD (FOR SCREENSHOT PROOF) */
.win-verify-box {
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(245, 158, 11, 0.35);
  border-radius: 12px;
  padding: 12px 16px;
  margin: 14px 0;
  text-align: left;
}

.verify-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 5px 0;
  font-size: 13px;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.08);
}

.verify-row:last-child {
  border-bottom: none;
}

.verify-label {
  color: var(--text-muted);
  font-weight: 600;
}

.verify-val {
  color: #fff;
  font-weight: 700;
}

.verify-val.font-mono {
  font-family: monospace;
  color: var(--gold-light);
  font-size: 14px;
}

/* NOTICE BOX: VUI LONG CHUP LAI MAN HINH */
.win-instruction-box {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.15) 0%, rgba(245, 158, 11, 0.15) 100%);
  border: 1.5px dashed #f59e0b;
  border-radius: 12px;
  padding: 12px 14px;
  margin: 14px 0 16px 0;
  text-align: center;
  animation: pulseNotice 2s infinite ease-in-out;
}

@keyframes pulseNotice {
  0%, 100% { border-color: #f59e0b; box-shadow: 0 0 10px rgba(245, 158, 11, 0.2); }
  50% { border-color: #ef4444; box-shadow: 0 0 16px rgba(239, 68, 68, 0.35); }
}

.instruction-title {
  font-size: 14px;
  font-weight: 800;
  color: #fde047;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.instruction-desc {
  font-size: 12px;
  color: #e2e8f0;
  line-height: 1.5;
}

/* TELEGRAM ADMIN BUTTON */
.win-actions-box {
  margin: 16px 0 10px 0;
}

.btn-telegram {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 14px 20px;
  background: linear-gradient(135deg, #0088cc 0%, #229ED9 50%, #0077b5 100%);
  color: #ffffff;
  font-size: 15px;
  font-weight: 800;
  text-decoration: none;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(34, 158, 217, 0.45);
  transition: all 0.25s ease;
  border: 1px solid rgba(255, 255, 255, 0.2);
  cursor: pointer;
  letter-spacing: 0.3px;
}

.btn-telegram:hover {
  background: linear-gradient(135deg, #229ED9 0%, #38bdf8 100%);
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(34, 158, 217, 0.7);
  color: #fff;
}

.btn-telegram:active {
  transform: translateY(0);
}

.btn-telegram svg {
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.btn-telegram:hover svg {
  transform: scale(1.15) rotate(-5deg);
}

.code-note {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 10px;
  line-height: 1.4;
}

/* FORM STYLES */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.form-input {
  width: 100%;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 10px;
  padding: 10px 14px;
  color: #fff;
  font-family: inherit;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}

.form-input:focus {
  border-color: var(--gold-primary);
  box-shadow: 0 0 10px var(--gold-glow);
}

/* REWARDS LIST TABLE IN MODAL */
.my-rewards-list {
  max-height: 340px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 16px 0;
  padding-right: 4px;
}

.reward-card-item {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.reward-info .title {
  font-weight: 700;
  font-size: 14px;
  color: #fff;
}

.reward-info .code {
  font-family: monospace;
  font-size: 12px;
  color: #38bdf8;
  margin-top: 2px;
}

.reward-info .time {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.reward-actions button {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
}

.reward-actions button:hover {
  background: var(--gold-primary);
  color: #000;
}

/* TOAST NOTIFICATION */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(50px);
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid var(--gold-primary);
  color: #fff;
  padding: 12px 24px;
  border-radius: 30px;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6), 0 0 15px var(--gold-glow);
  z-index: 2000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.toast.show {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

/* CONFETTI CANVAS */
#confettiCanvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 1500;
}
