/* ========================================================
   🎡 VÒNG QUAY MAY MẮN (LUCKY WHEEL) - TIỆM TRÀ MƠ ƯỚC
   Vòng quay hình tròn xoay với đèn led, kim gõ cơ học,
   8 ô quà tặng chuẩn tiệm trà sữa, âm thanh tick-click & confetti!
   ======================================================== */

.luckywheel-modal {
  position: fixed;
  inset: 0;
  background: rgba(30, 15, 8, 0.85);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10005;
  padding: 10px;
  overflow-y: auto;
  box-sizing: border-box;
}

.luckywheel-modal[hidden] {
  display: none !important;
}

.luckywheel-card {
  background: linear-gradient(165deg, #fffbf2 0%, #fff1df 100%);
  border: 3.5px solid #b45309;
  border-radius: 28px;
  box-shadow: 0 16px 45px rgba(0, 0, 0, 0.5), inset 0 2px 0 rgba(255, 255, 255, 0.9);
  max-width: min(440px, 98vw);
  width: 100%;
  max-height: calc(100vh - 20px);
  max-height: calc(100dvh - 20px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px 18px 20px;
  box-sizing: border-box;
  font-family: inherit;
  color: #451a03;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  animation: wheelCardPop 0.28s cubic-bezier(0.18, 0.89, 0.32, 1.25);
}

@keyframes wheelCardPop {
  from { transform: scale(0.9); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* Header */
.lw-header {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px dashed #fcd34d;
  padding-bottom: 10px;
  margin-bottom: 12px;
}

.lw-title-box {
  display: flex;
  align-items: center;
  gap: 10px;
}

.lw-title-icon {
  font-size: 1.85rem;
  line-height: 1;
  filter: drop-shadow(0 2px 6px rgba(245, 158, 11, 0.4));
  animation: lwIconPulse 2s ease-in-out infinite;
}

@keyframes lwIconPulse {
  0%, 100% { transform: scale(1) rotate(0deg); }
  50% { transform: scale(1.1) rotate(8deg); }
}

.lw-title-text h3 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 900;
  color: #78350f;
  letter-spacing: -0.3px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.lw-title-text p {
  margin: 2px 0 0;
  font-size: 0.78rem;
  font-weight: 600;
  color: #b45309;
}

.lw-close-btn {
  background: #fee2e2;
  border: 1.5px solid #f87171;
  color: #b91c1c;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 1.1rem;
  font-weight: 900;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.lw-close-btn:hover {
  background: #fca5a5;
  transform: scale(1.08);
}

/* Status / Ticket Banner */
.lw-ticket-bar {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #fff;
  border: 1.5px solid #fde68a;
  border-radius: 16px;
  padding: 8px 14px;
  margin-bottom: 12px;
  box-shadow: 0 2px 8px rgba(180, 83, 9, 0.08);
  font-size: 0.85rem;
}

.lw-ticket-stat {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  color: #92400e;
}

.lw-ticket-badge {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #fff;
  padding: 3px 9px;
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: 800;
  box-shadow: 0 2px 5px rgba(217, 119, 6, 0.3);
}

.lw-free-badge {
  background: linear-gradient(135deg, #10b981, #059669);
  color: #fff;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 0.78rem;
  font-weight: 800;
  animation: freeGlow 1.5s ease-in-out infinite alternate;
}

@keyframes freeGlow {
  from { box-shadow: 0 0 4px #10b981; }
  to { box-shadow: 0 0 12px #34d399; }
}

/* Wheel Container & Circular Frame */
.lw-stage {
  position: relative;
  width: 320px;
  height: 320px;
  margin: 6px auto 14px;
  display: flex;
  align-items: center;
  justify-content: center;
}

@media (max-width: 380px) {
  .lw-stage {
    width: 280px;
    height: 280px;
  }
}

/* Khung viền đèn LED vàng kim bao quanh bánh xe */
.lw-wheel-outer-ring {
  position: absolute;
  inset: -10px;
  border-radius: 50%;
  background: conic-gradient(
    #b45309 0deg,
    #f59e0b 45deg,
    #fef08a 90deg,
    #f59e0b 135deg,
    #b45309 180deg,
    #f59e0b 225deg,
    #fef08a 270deg,
    #f59e0b 315deg,
    #b45309 360deg
  );
  box-shadow: 0 8px 25px rgba(180, 83, 9, 0.4), inset 0 2px 4px rgba(255, 255, 255, 0.6);
  padding: 8px;
  box-sizing: border-box;
}

/* Các bóng đèn LED viền tròn */
.lw-led-lights {
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: 50%;
}

.lw-led-bulb {
  position: absolute;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 6px #fff, 0 0 12px #fbbf24;
  transform: translate(-50%, -50%);
  animation: ledBlink 0.6s infinite alternate;
}

.lw-led-bulb:nth-child(even) {
  background: #fde047;
  animation-delay: 0.3s;
}

@keyframes ledBlink {
  0% { opacity: 0.45; transform: translate(-50%, -50%) scale(0.85); }
  100% { opacity: 1; transform: translate(-50%, -50%) scale(1.15); box-shadow: 0 0 8px #fff, 0 0 16px #f59e0b; }
}

/* Canvas Bánh Xe */
.lw-canvas-wrap {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  overflow: hidden;
  box-shadow: inset 0 0 16px rgba(0, 0, 0, 0.35);
  background: #fff;
}

#lwWheelCanvas {
  width: 100%;
  height: 100%;
  display: block;
  border-radius: 50%;
  cursor: grab;
}

/* Kim chỉ (Flapper / Ticker) ở góc 12h */
.lw-ticker {
  position: absolute;
  top: -15px;
  left: 50%;
  transform: translateX(-50%);
  width: 32px;
  height: 42px;
  z-index: 10;
  pointer-events: none;
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.45));
  transform-origin: 50% 10px;
  transition: transform 0.05s ease-out;
}

.lw-ticker-pin {
  width: 16px;
  height: 16px;
  background: radial-gradient(circle at 35% 35%, #fef08a, #d97706);
  border: 2px solid #78350f;
  border-radius: 50%;
  margin: 0 auto;
}

.lw-ticker-arrow {
  width: 0;
  height: 0;
  border-left: 12px solid transparent;
  border-right: 12px solid transparent;
  border-top: 26px solid #e11d48;
  margin: -4px auto 0;
  position: relative;
}

.lw-ticker-arrow::after {
  content: '';
  position: absolute;
  top: -24px;
  left: -8px;
  width: 0;
  height: 0;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-top: 18px solid #fb7185;
}

/* Hiệu ứng rung lắc kim chỉ */
.lw-ticker.recoil {
  transform: translateX(-50%) rotate(-18deg);
}

/* Nút bấm ở Tâm Bánh Xe (Center Hub) */
.lw-center-hub {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fef08a 0%, #f59e0b 60%, #b45309 100%);
  border: 3.5px solid #fff;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.4), inset 0 2px 4px rgba(255, 255, 255, 0.8);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 8;
  transition: all 0.15s cubic-bezier(0.18, 0.89, 0.32, 1.25);
  user-select: none;
  -webkit-user-select: none;
}

.lw-center-hub:hover:not(:disabled) {
  transform: translate(-50%, -50%) scale(1.08);
  box-shadow: 0 8px 24px rgba(245, 158, 11, 0.6), inset 0 2px 6px rgba(255, 255, 255, 0.9);
}

.lw-center-hub:active:not(:disabled) {
  transform: translate(-50%, -50%) scale(0.94);
}

.lw-center-hub:disabled {
  filter: grayscale(0.4) opacity(0.8);
  cursor: not-allowed;
}

.lw-hub-txt {
  font-size: 0.95rem;
  font-weight: 900;
  color: #78350f;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8);
  line-height: 1;
}

.lw-hub-sub {
  font-size: 0.62rem;
  font-weight: 800;
  color: #92400e;
  margin-top: 2px;
}

/* Nút hành động chính dưới chân modal */
.lw-actions {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
}

.lw-spin-btn {
  width: 100%;
  padding: 12px 18px;
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 50%, #b45309 100%);
  color: #fff;
  border: 2px solid #fef08a;
  border-radius: 18px;
  font-size: 1.05rem;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(217, 119, 6, 0.4), inset 0 1px 2px rgba(255, 255, 255, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.15s ease;
  position: relative;
  overflow: hidden;
}

.lw-spin-btn:hover:not(:disabled) {
  background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 50%, #d97706 100%);
  transform: translateY(-2px);
  box-shadow: 0 8px 22px rgba(217, 119, 6, 0.5);
}

.lw-spin-btn:active:not(:disabled) {
  transform: translateY(1px);
}

.lw-spin-btn:disabled {
  background: #d1d5db;
  border-color: #e5e7eb;
  color: #6b7280;
  box-shadow: none;
  cursor: not-allowed;
}

.lw-spin-btn-free {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%) !important;
  border-color: #a7f3d0 !important;
  box-shadow: 0 6px 18px rgba(16, 185, 129, 0.45) !important;
}

.lw-spin-btn-free:hover:not(:disabled) {
  background: linear-gradient(135deg, #34d399 0%, #10b981 100%) !important;
}

.lw-buy-ticket-row {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}

.lw-buy-btn {
  flex: 1;
  background: #fef3c7;
  border: 1.5px solid #f59e0b;
  color: #92400e;
  border-radius: 12px;
  padding: 8px 10px;
  font-size: 0.8rem;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  transition: all 0.15s ease;
}

.lw-buy-btn:hover {
  background: #fde68a;
  transform: translateY(-1px);
}

.lw-hint {
  font-size: 0.75rem;
  color: #a16207;
  text-align: center;
  margin-top: 6px;
}

/* Modal Popup Kết Quả Trúng Thưởng (Result Overlay) */
.lw-result-overlay {
  position: absolute;
  inset: 0;
  background: rgba(26, 11, 4, 0.88);
  border-radius: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 20;
  animation: resultFadeIn 0.3s ease;
  text-align: center;
}

@keyframes resultFadeIn {
  from { opacity: 0; transform: scale(0.9); }
  to { opacity: 1; transform: scale(1); }
}

.lw-result-sparkles {
  font-size: 2.4rem;
  margin-bottom: 4px;
  animation: bounce 0.6s infinite alternate;
}

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

.lw-result-title {
  font-size: 1.25rem;
  font-weight: 900;
  color: #fef08a;
  text-shadow: 0 2px 8px rgba(245, 158, 11, 0.8);
  margin: 0 0 6px 0;
}

.lw-result-card {
  background: #fff;
  border: 2.5px solid #f59e0b;
  border-radius: 18px;
  padding: 16px 20px;
  margin: 10px 0 16px;
  width: 85%;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.lw-result-icon {
  font-size: 2.8rem;
  line-height: 1;
  margin-bottom: 6px;
}

.lw-result-name {
  font-size: 1.15rem;
  font-weight: 900;
  color: #78350f;
  margin-bottom: 4px;
}

.lw-result-desc {
  font-size: 0.82rem;
  font-weight: 600;
  color: #b45309;
  line-height: 1.4;
}

.lw-claim-btn {
  background: linear-gradient(135deg, #10b981, #059669);
  color: #fff;
  border: 2px solid #a7f3d0;
  border-radius: 16px;
  padding: 10px 28px;
  font-size: 1.05rem;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.4);
  transition: all 0.15s ease;
}

.lw-claim-btn:hover {
  transform: scale(1.05);
  background: linear-gradient(135deg, #34d399, #10b981);
}

/* Red Dot thông báo lượt quay miễn phí trên nút Header */
.pbtn.wheel-btn {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
}

body.selling .h-btns-grid #wheelBtn {
  display: none !important;
}

.wheel-btn {
  position: relative !important;
}

.wheel-badge-dot {
  position: absolute;
  top: 0px;
  right: 0px;
  width: 7px;
  height: 7px;
  background: #ef4444;
  border: 1.5px solid #fff;
  border-radius: 50%;
  box-shadow: 0 0 5px #ef4444;
  animation: badgeBlink 1.2s infinite;
}

@keyframes badgeBlink {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.35; transform: scale(1.2); }
}

/* Pháo hoa giấy Confetti rơi khi trúng quà */
.lw-confetti-particle {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  pointer-events: none;
  z-index: 25;
  animation: confettiFall 1.8s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

@keyframes confettiFall {
  0% {
    opacity: 1;
    transform: translate(0, 0) rotate(0deg) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(var(--tx), var(--ty)) rotate(var(--rot)) scale(0.4);
  }
}
