* {
  margin: 0;
  padding: 0;
}
body {
  background: #eaeaea url("bgtet.png") center/cover no-repeat fixed;
  color: #fff;
  font-size: 23.5px;
  font-family: "Exo 2", sans-serif;
  height: 100vh;
  margin: 0;
  padding: 0;
  /* padding-bottom nhường chỗ cho bottom-bar (~56px) */
  padding-bottom: 56px;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  /* overflow:clip thay overflow:hidden — không tạo stacking context mới,
     nên position:fixed bên trong vẫn hoạt động đúng trên mọi máy */
  overflow: clip;
  overflow-x: clip;
}
#wrapper {
  margin: 0 auto;
  width: 540px;
  position: relative;
  /* translateY dương nhẹ → wheel hơi xuống dưới để cân bằng khoảng trống */
  transform: translateY(10px);
}
#txt {
  color: #2c3e50;
  text-align: center;
  margin-top: 30px;
  font-size: 31px;
  font-weight: bold;
  display: none;
}

/* =============================================
   POPUP - CHAMPAGNE LUXURY + LIGHT WAVE EFFECT
   ============================================= */

/* Overlay: tối mờ với ripple sáng từ trung tâm */
#popup-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 10, 5, 0.82);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 100000;
  overflow: hidden;
}

#popup-overlay.show {
  display: flex;
  animation: overlayReveal 0.5s ease forwards;
}

/* Sóng ánh sáng lan tỏa từ trung tâm – pseudo element */
#popup-overlay::before,
#popup-overlay::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  opacity: 0;
}

/* Sóng 1 – vàng ấm */
#popup-overlay::before {
  width: 0;
  height: 0;
  background: radial-gradient(circle, rgba(212,175,55,0.18) 0%, transparent 70%);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  animation: none;
}

#popup-overlay.show::before {
  animation: lightWave1 1.6s cubic-bezier(0.2, 0.8, 0.4, 1) 0.1s forwards;
}

/* Sóng 2 – trắng champagne */
#popup-overlay::after {
  width: 0;
  height: 0;
  background: radial-gradient(circle, rgba(245,230,180,0.12) 0%, transparent 65%);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

#popup-overlay.show::after {
  animation: lightWave2 2s cubic-bezier(0.2, 0.8, 0.4, 1) 0.35s forwards;
}

/* Popup box – nền tối sang trọng */
#popup {
  position: relative;
  background: linear-gradient(160deg, #1C1508 0%, #2A1D0A 40%, #1A120A 100%);
  border-radius: 24px;
  padding: 44px 40px 36px;
  text-align: center;
  min-width: 320px;
  max-width: 400px;
  overflow: hidden;

  /* Viền vàng mỏng tinh tế */
  border: 1px solid rgba(212, 175, 55, 0.45);
  box-shadow:
    0 0 0 1px rgba(245, 215, 120, 0.12),
    0 30px 80px rgba(0, 0, 0, 0.7),
    inset 0 1px 0 rgba(255, 235, 150, 0.15),
    inset 0 -1px 0 rgba(0, 0, 0, 0.4);

  animation: popupEntrance 0.55s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  transform-origin: center bottom;
}

/* Highlight ánh sáng mờ ở góc trên trái popup */
#popup::before {
  content: '';
  position: absolute;
  top: -60px;
  left: -60px;
  width: 200px;
  height: 200px;
  background: radial-gradient(circle, rgba(255, 235, 150, 0.07) 0%, transparent 70%);
  pointer-events: none;
  border-radius: 50%;
}

/* Shimmer quét ngang popup sau khi xuất hiện */
#popup::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 60%;
  height: 100%;
  background: linear-gradient(
    105deg,
    transparent 20%,
    rgba(255, 235, 150, 0.06) 45%,
    rgba(255, 245, 200, 0.12) 50%,
    rgba(255, 235, 150, 0.06) 55%,
    transparent 80%
  );
  pointer-events: none;
  animation: shimmerSweep 2.4s ease 0.7s forwards;
}

/* --- Nội dung popup --- */

/* Nhãn nhỏ phía trên số */
.popup-content .result-label {
  display: block;
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: 3.5px;
  text-transform: uppercase;
  color: rgba(212, 175, 55, 0.6);
  margin-bottom: 10px;
  animation: fadeUp 0.5s ease 0.4s both;
}

/* Số kết quả lớn */
.popup-content .result-number {
  font-size: 104px;
  font-weight: 900;
  line-height: 1;
  margin-bottom: 6px;
  letter-spacing: -2px;

  /* Gradient vàng champagne */
  background: linear-gradient(
    175deg,
    #FFF8DC 0%,
    #F5D060 25%,
    #D4A820 50%,
    #F5D060 75%,
    #FFF8DC 100%
  );
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(0 2px 12px rgba(212, 175, 55, 0.5));

  animation: numberPop 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) 0.3s both;
}

/* Tên phần thưởng */
.popup-content .result-icon {
  font-size: 19.5px;
  color: rgba(245, 230, 180, 0.55);
  margin-bottom: 28px;
  font-weight: 400;
  letter-spacing: 1.5px;
  animation: fadeUp 0.5s ease 0.5s both;
}

/* Đường kẻ trang trí */
.popup-divider {
  width: 60px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(212,175,55,0.5), transparent);
  margin: 0 auto 24px;
  animation: fadeUp 0.5s ease 0.55s both;
}

/* Nút đóng */
#close-popup {
  position: relative;
  background: linear-gradient(135deg, #C8960C 0%, #F5D060 40%, #D4A820 60%, #C8960C 100%);
  color: #1A1000;
  border: none;
  padding: 13px 44px;
  border-radius: 30px;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  cursor: pointer;
  overflow: hidden;

  box-shadow:
    0 4px 20px rgba(200, 150, 12, 0.5),
    inset 0 1px 0 rgba(255, 255, 220, 0.4),
    inset 0 -1px 0 rgba(0,0,0,0.15);

  transition: transform 0.2s ease, box-shadow 0.2s ease;
  animation: fadeUp 0.5s ease 0.65s both;
}

#close-popup::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 50%;
  height: 100%;
  background: linear-gradient(105deg, transparent 30%, rgba(255,255,200,0.35) 50%, transparent 70%);
  transition: left 0.4s ease;
}

#close-popup:hover {
  transform: translateY(-3px);
  box-shadow:
    0 8px 30px rgba(200, 150, 12, 0.65),
    inset 0 1px 0 rgba(255, 255, 220, 0.5);
}

#close-popup:hover::after {
  left: 150%;
}

#close-popup:active {
  transform: translateY(-1px);
  box-shadow: 0 3px 12px rgba(200, 150, 12, 0.4);
}

/* =============================================
   KEYFRAME ANIMATIONS
   ============================================= */

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

@keyframes lightWave1 {
  0%   { width: 0;      height: 0;      opacity: 0.9; }
  100% { width: 180vmax; height: 180vmax; opacity: 0; }
}

@keyframes lightWave2 {
  0%   { width: 0;      height: 0;      opacity: 0.7; }
  100% { width: 140vmax; height: 140vmax; opacity: 0; }
}

@keyframes popupEntrance {
  0%   { opacity: 0; transform: scale(0.7) translateY(30px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes numberPop {
  0%   { opacity: 0; transform: scale(0.5); filter: drop-shadow(0 0 30px rgba(212,175,55,0.9)); }
  60%  { transform: scale(1.08); }
  100% { opacity: 1; transform: scale(1); filter: drop-shadow(0 2px 12px rgba(212,175,55,0.5)); }
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes rippleExpand {
  0%   { width: 0;       height: 0;       opacity: 1; }
  100% { width: 160vmax; height: 160vmax; opacity: 0; }
}

@keyframes shimmerSweep {
  0%   { left: -100%; opacity: 1; }
  100% { left: 200%;  opacity: 1; }
}

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

/* ══════════════════════════════════════════════
   KỲ LÂN × HỔ LỬA — Wheel Border System
   Kỳ lân: mây vàng + đồng tiền + scrollwork
   Hổ lửa: vằn cam + vuốt + amber gems
   Kết hợp: viền SVG inject bởi JS, không dùng CSS border
   ══════════════════════════════════════════════ */

#wheel-border-wrap {
  position: relative;
  width: 540px;
  height: 540px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
}

/* ══ Lớp ngoài cùng: LỬAFIRE — cam đỏ rực, rất đậm ══ */
#wheel-border-wrap::before {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  background: conic-gradient(
    #ff2200 0deg,   #ff6600 8deg,   #ffcc00 16deg,
    #ff4400 24deg,  #ff8800 32deg,  #ffd700 40deg,
    #ff2200 48deg,  #ff6600 56deg,  #ffcc00 64deg,
    #ff4400 72deg,  #ff8800 80deg,  #ffd700 88deg,
    #ff2200 96deg,  #ff6600 104deg, #ffcc00 112deg,
    #ff4400 120deg, #ff8800 128deg, #ffd700 136deg,
    #ff2200 144deg, #ff6600 152deg, #ffcc00 160deg,
    #ff4400 168deg, #ff8800 176deg, #ffd700 184deg,
    #ff2200 192deg, #ff6600 200deg, #ffcc00 208deg,
    #ff4400 216deg, #ff8800 224deg, #ffd700 232deg,
    #ff2200 240deg, #ff6600 248deg, #ffcc00 256deg,
    #ff4400 264deg, #ff8800 272deg, #ffd700 280deg,
    #ff2200 288deg, #ff6600 296deg, #ffcc00 304deg,
    #ff4400 312deg, #ff8800 320deg, #ffd700 328deg,
    #ff2200 336deg, #ff6600 344deg, #ffcc00 352deg,
    #ff2200 360deg
  );
  animation: spinBorderKT 4s linear infinite, firePulse 1.4s ease-in-out infinite;
  z-index: -1;
  /* Glow mạnh ra ngoài */
  filter: blur(0px);
  box-shadow:
    0 0 0 3px #ff4400,
    0 0 20px #ff6600,
    0 0 40px rgba(255,100,0,0.8),
    0 0 70px rgba(255,60,0,0.5);
}

/* ══ Lớp trong: VÀNG KIM loại, xoay ngược, cực sáng ══ */
#wheel-border-wrap::after {
  content: '';
  position: absolute;
  inset: 6px;
  border-radius: 50%;
  background: conic-gradient(
    #fffde0 0deg,  #ffd700 10deg, #ffaa00 20deg,
    #c8800a 30deg, #ffd700 40deg, #fff8a0 50deg,
    #ffcc00 60deg, #c8960c 70deg, #ffd700 80deg,
    #fffde0 90deg, #ffd700 100deg,#ffaa00 110deg,
    #c8800a 120deg,#ffd700 130deg,#fff8a0 140deg,
    #ffcc00 150deg,#c8960c 160deg,#ffd700 170deg,
    #fffde0 180deg,#ffd700 190deg,#ffaa00 200deg,
    #c8800a 210deg,#ffd700 220deg,#fff8a0 230deg,
    #ffcc00 240deg,#c8960c 250deg,#ffd700 260deg,
    #fffde0 270deg,#ffd700 280deg,#ffaa00 290deg,
    #c8800a 300deg,#ffd700 310deg,#fff8a0 320deg,
    #ffcc00 330deg,#c8960c 340deg,#ffd700 350deg,
    #fffde0 360deg
  );
  animation: spinBorderKT 4s linear infinite reverse;
  z-index: -1;
}

@keyframes spinBorderKT {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* ══ SVG BORDER — inject bởi JS ══ */
#border-svg {
  position: absolute; top: 0; left: 0;
  z-index: 10002; pointer-events: none;
}

/* ══ BORDER DOT — legacy, ẩn đi (dùng SVG thay) ══ */
.border-dot { display: none; }

/* ══ WHEEL — viền sáng chói + glow vàng cam ══ */
#wheel {
  box-shadow:
    0 0 0 2px #ff2200,
    0 0 0 5px #ffd700,
    0 0 0 8px #ff6600,
    0 0 0 11px rgba(255,215,0,0.5),
    0 0 30px rgba(255,150,0,0.9),
    0 0 60px rgba(255,215,0,0.6),
    0 0 100px rgba(255,100,0,0.35),
    rgba(0,0,0,0.5) 0px 12px 35px;
}

/* ══ HOVER GLOW trên toàn viền khi không quay ══ */
#wheel-border-wrap:hover #border-svg {
  filter: drop-shadow(0 0 8px rgba(255,180,0,0.6));
}

/* ══ FIRE PULSE animation trên viền ngoài ══ */
@keyframes firePulse {
  0%,100% { opacity: 1;    filter: blur(0px); }
  50%      { opacity: 0.88; filter: blur(0.5px); }
}
/* Không override ở đây nữa — đã set trong ::before block ở trên */

#wheel {
  width: 500px;
  height: 500px;
  border-radius: 50%;
  position: relative;
  overflow: hidden;
  border: none;
  box-shadow:
    0 0 0 3px #c8960c,
    0 0 0 5px #ffd700,
    0 0 20px rgba(200, 150, 12, 0.6),
    rgba(0, 0, 0, 0.3) 0px 8px 20px;
  transform: rotate(0deg);
  flex-shrink: 0;
}

#wheel:before {
  content: '';
  position: absolute;
  border: 3px solid rgba(255, 215, 0, 0.4);
  width: 488px;
  height: 488px;
  border-radius: 50%;
  z-index: 1000;
  top: 3px;
  left: 3px;
  box-shadow: inset 0 0 15px rgba(255, 215, 0, 0.2);
}
#inner-wheel {
  width: 100%;
  height: 100%;
  transition: all 6s cubic-bezier(0, .99, .44, .99);
  /* Tạo stacking context riêng để z-index:-1 của canvas
     không thoát ra ngoài wheel */
  isolation: isolate;
}
#wheel .sec {
  position: absolute;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 255px 108px 0;
  border-color: #19c transparent;
  transform-origin: 108px 254px;
  left: 142px;
  top: -4px;
  opacity: 1;
}
#wheel .sec:nth-child(1) { transform: rotate(45deg);  border-color: #006090 transparent; }
#wheel .sec:nth-child(2) { transform: rotate(90deg);  border-color: #0030cc transparent; }
#wheel .sec:nth-child(3) { transform: rotate(135deg); border-color: #660099 transparent; }
#wheel .sec:nth-child(4) { transform: rotate(180deg); border-color: #995500 transparent; }
#wheel .sec:nth-child(5) { transform: rotate(225deg); border-color: #990000 transparent; }
#wheel .sec:nth-child(6) { transform: rotate(270deg); border-color: #aa0066 transparent; }
#wheel .sec:nth-child(7) { transform: rotate(315deg); border-color: #006622 transparent; }
#wheel .sec:nth-child(8) { transform: rotate(360deg); border-color: #883300 transparent; }

/* ══ CANVAS OVERLAYS (JS inject) ══ */
/* Gradient canvas nằm DƯỚI .sec (z-index:-1) để không che .number */
#wheel-gradient-canvas {
  position: absolute; top: 0; left: 0;
  width: 500px; height: 500px;
  border-radius: 50%;
  pointer-events: none;
  z-index: -1;   /* dưới các .sec triangle */
  opacity: 1;
}
/* Sparkle canvas nằm TRÊN .sec nhưng DƯỚI #spin button */
#wheel-sparkle-canvas {
  position: absolute; top: 0; left: 0;
  width: 500px; height: 500px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 999;   /* trên .sec, dưới #spin (z-index:1000) */
  opacity: 0.75;  /* nhẹ hơn để không làm mờ số */
}
#wheel .sec .number {
  position: absolute;
  top: -210px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000001;
  white-space: nowrap;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── Dark chip (phương án C) ── */
.sc-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  background: rgba(0,0,0,0.38);
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 10px;
  padding: 5px 9px 4px;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.sc-ico {
  font-size: 22px;
  line-height: 1;
  filter: drop-shadow(0 1px 3px rgba(0,0,0,.4));
}
.sc-num {
  font-size: 15px;
  font-weight: 900;
  color: #FFD700;
  text-shadow: 0 0 8px rgba(255,215,0,.7), 0 1px 2px rgba(0,0,0,.6);
  letter-spacing: 0.5px;
  line-height: 1;
  font-family: "Poppins", "Exo 2", sans-serif;
}
.sc-lbl {
  font-size: 8px;
  font-weight: 700;
  color: rgba(255,215,0,0.65);
  letter-spacing: 1.2px;
  text-transform: uppercase;
  line-height: 1;
}

/* ── ⭐ 1 sao — hồng-tím rực ── */
.sc-chip-rare1 {
  background: rgba(20,0,30,0.55);
  border: 1.5px solid rgba(255,120,200,0.6);
  box-shadow: 0 0 12px rgba(255,80,180,.5), 0 0 24px rgba(200,0,255,.3);
  animation: chipRare1Pulse 1.8s ease-in-out infinite;
}
@keyframes chipRare1Pulse {
  0%,100% { box-shadow: 0 0 10px rgba(255,80,180,.5), 0 0 22px rgba(200,0,255,.25); }
  50%     { box-shadow: 0 0 18px rgba(255,80,180,.85), 0 0 36px rgba(220,0,255,.55); }
}
.sc-ico-rare {
  font-size: 24px;
  filter: drop-shadow(0 0 6px #ff66dd) drop-shadow(0 0 14px #cc00ff);
  animation: starRare1 1.6s ease-in-out infinite;
}
@keyframes starRare1 {
  0%,100% { filter: drop-shadow(0 0 5px #ff66dd) drop-shadow(0 0 12px #cc00ff); }
  50%     { filter: drop-shadow(0 0 10px #ff99ee) drop-shadow(0 0 22px #dd44ff); }
}
.sc-num-rare {
  font-size: 13px;
  color: #ff99ee;
  text-shadow: 0 0 10px #ff66dd, 0 0 20px #cc00ff;
}
.sc-lbl-rare {
  color: rgba(255,160,230,0.8);
  font-size: 7.5px;
}

/* ── ⭐⭐ 2 sao — vàng-cam neon Jackpot ── */
.sc-chip-rare2 {
  background: rgba(20,10,0,0.6);
  border: 1.5px solid rgba(255,200,0,0.7);
  box-shadow: 0 0 14px rgba(255,180,0,.6), 0 0 28px rgba(255,100,0,.35);
  animation: chipRare2Pulse 1.5s ease-in-out infinite;
}
@keyframes chipRare2Pulse {
  0%,100% { box-shadow: 0 0 12px rgba(255,180,0,.6), 0 0 24px rgba(255,100,0,.3); }
  50%     { box-shadow: 0 0 22px rgba(255,220,0,.95), 0 0 42px rgba(255,120,0,.6); }
}
.sc-ico-rare2 {
  font-size: 20px;
  filter: drop-shadow(0 0 6px #ffcc00) drop-shadow(0 0 14px #ff8800);
  animation: starRare2 1.4s ease-in-out infinite;
}
@keyframes starRare2 {
  0%,100% { filter: drop-shadow(0 0 5px #ffcc00) drop-shadow(0 0 12px #ff8800); }
  50%     { filter: drop-shadow(0 0 12px #ffee44) drop-shadow(0 0 26px #ffaa00); }
}
.sc-num-rare2 {
  font-size: 11px;
  color: #FFE566;
  text-shadow: 0 0 10px #ffcc00, 0 0 22px #ff8800;
  background: linear-gradient(90deg, #ff6600, #ffcc00, #ff6600);
  background-size: 200% 100%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: jpTextFlow 2s linear infinite;
}
@keyframes jpTextFlow { 0%{background-position:0%} 100%{background-position:200%} }
.sc-lbl-rare2 {
  color: rgba(255,220,80,0.85);
  font-size: 7.5px;
  text-shadow: 0 0 6px rgba(255,180,0,.6);
}
#spin {
  width: 100px;
  height: 100px;
  position: absolute;
  top: 50%;
  left: 50%;
  margin: -50px 0 0 -50px;
  border-radius: 50%;
  box-shadow: rgba(0, 0, 0, 0.1) 0px 3px 0px;
  z-index: 1000;
  background: #fff;
  cursor: pointer;
  font-family: "Exo 2", sans-serif;
  user-select: none;
}
#spin:after {
  content: 'SPIN';
  text-align: center;
  line-height: 100px;
  color: #ccc;
  text-shadow: 0 2px 0 #fff, 0 -2px 0 rgba(0, 0, 0, 0.3);
  position: relative;
  z-index: 100000;
  width: 100px;
  height: 100px;
  display: block;
  font-size: 26px;
  font-weight: bold;
}
#spin:before {
  content: '';
  position: absolute;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 0 25px 35px 25px;
  border-color: transparent transparent #fff transparent;
  top: -18px;
  left: 25px;
  z-index: 100002;
}
#pointer {
  position: absolute;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 30px 20px 0 20px;
  border-color: #e74c3c transparent transparent transparent;
  top: -12px;
  left: 50%;
  margin-left: -20px;
  z-index: 10000;
  filter: drop-shadow(0 3px 5px rgba(0,0,0,0.3));
}
#inner-spin {
  width: 80px;
  height: 80px;
  position: absolute;
  top: 50%;
  left: 50%;
  margin: -40px 0 0 -40px;
  border-radius: 50%;
  z-index: 999;
  box-shadow: rgba(255, 255, 255, 1) 0px -2px 0px inset, rgba(255, 255, 255, 1) 0px 2px 0px inset, rgba(0, 0, 0, 0.4) 0px 0px 5px;
  background: radial-gradient(ellipse at center, rgba(255, 255, 255, 1) 0%, rgba(234, 234, 234, 1) 100%);
}
#spin:active #inner-spin {
  box-shadow: rgba(0, 0, 0, 0.4) 0px 0px 5px inset;
}
#spin:active:after {
  font-size: 23.5px;
}
#shine {
  width: 500px;
  height: 500px;
  position: absolute;
  top: 0;
  left: 0;
  background: radial-gradient(ellipse at center, rgba(255, 255, 255, 1) 0%, rgba(255, 255, 255, 0.99) 1%, rgba(255, 255, 255, 0.91) 9%, rgba(255, 255, 255, 0) 100%);
  opacity: 0.1;
}
@keyframes hh {
  0%, 100% {
    transform: rotate(0deg);
  }
  50% {
    transform: rotate(7deg);
  }
}
.spin {
  animation: hh 0.1s;
}

/* ===========================
   ✅ RESPONSIVE FIX (MOBILE)
   Paste at END of your CSS
=========================== */

:root {
  --wheel-base: 500;                 /* wheel gốc 500px */
  --wheel-size: min(90vw, 420px);    /* wheel sẽ co theo màn hình */
  --wheel-scale: calc(var(--wheel-size) / (var(--wheel-base) * 1px));
}

@media (max-width: 600px) {
  body {
    height: 100dvh;               /* dvh thay vh — tránh lỗi trên mobile khi keyboard/bar xuất hiện */
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 12px;
    padding-top: calc(12px + env(safe-area-inset-top));
    /* padding-bottom nhường chỗ cho bottom-bar + safe area */
    padding-bottom: calc(72px + env(safe-area-inset-bottom));
    box-sizing: border-box;
    overflow: clip;
  }

  /* wrapper không cố định 532px nữa, bỏ transform translateY âm trên desktop */
  #wrapper {
    width: 100% !important;
    max-width: 480px;
    margin: 0 auto;
    height: calc(var(--wheel-size) + 40px);
    position: relative;
    /* Không translateY trên mobile để tránh bị che */
    transform: none;
  }

  /* Scale cả bánh xe để giữ nguyên hình tam giác .sec */
  #wheel,
  #shine {
    width: 500px;
    height: 500px;
    transform-origin: top left;
    transform: scale(var(--wheel-scale));
  }

  /* Pointer mobile — không cần override, pointer nằm trong wheel-border-wrap
     và được scale cùng wrapper */

  /* Popup fit màn hình */
  #popup {
    width: calc(100vw - 32px);
    max-width: 360px;
    min-width: auto;
    padding: 32px 24px 28px;
    border-radius: 20px;
  }

  .popup-content .result-number {
    font-size: 78px;
  }

  .popup-content .result-icon {
    font-size: 17px;
    margin-bottom: 20px;
  }

  #close-popup {
    width: 100%;
    padding: 13px 16px;
    font-size: 17px;
  }

  #txt {
    font-size: 23.5px;
    margin-top: 16px;
  }
}
/* background merged into main body rule above */
body::-webkit-scrollbar {
    display: none;
}
/* ══ POINTER — ẩn hoàn toàn, dùng mũi tên trên #spin thay thế ══ */
#pointer { display: none !important; }

/* ===== NÚT SPIN - Bạc metallic nâng cấp ===== */
#spin {
  background: radial-gradient(ellipse at 35% 35%, #ffffff 0%, #d8dde6 40%, #b0b8c8 100%);
  box-shadow:
    0 4px 15px rgba(0,0,0,0.25),
    inset 0 2px 4px rgba(255,255,255,0.9),
    inset 0 -2px 4px rgba(0,0,0,0.15),
    0 0 0 3px rgba(180,190,210,0.5);
  border: 1.5px solid rgba(150,160,180,0.4);
}

#spin:after {
  color: #5a6070;
  text-shadow: 0 1px 0 rgba(255,255,255,0.8), 0 -1px 0 rgba(0,0,0,0.15);
  font-size: 21px;
  letter-spacing: 2px;
}

#inner-spin {
  background: radial-gradient(ellipse at 40% 30%, #ffffff 0%, #c8cdd8 60%, #a8b0c0 100%);
  box-shadow:
    inset 0 2px 4px rgba(255,255,255,0.8),
    inset 0 -2px 3px rgba(0,0,0,0.2),
    0 0 8px rgba(0,0,0,0.15);
}

/* ===== MŨI TÊN TRÊN NÚT SPIN — đẹp, nổi bật ===== */
#spin {
  overflow: visible;
}

#spin:before {
  content: '';
  position: absolute;
  /* Đặt ngay phía trên nút SPIN, chạm vào mép trên */
  bottom: calc(100% - 2px);
  left: 50%;
  transform: translateX(-50%);

  /* Tam giác nhọn lớn hơn, rõ hơn */
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 0 18px 30px 18px;
  border-color: transparent transparent #e63946 transparent;

  background: none;
  clip-path: none;
  border-radius: 0;
  box-shadow: none;
  z-index: 100002;

  /* Viền trắng giả bằng filter drop-shadow */
  filter:
    drop-shadow(0 -1px 0px #fff)
    drop-shadow(-1px 0 0px #fff)
    drop-shadow(1px 0 0px #fff)
    drop-shadow(0 3px 8px rgba(230,57,70,.9))
    drop-shadow(0 0 16px rgba(230,57,70,.6));

  animation: arrowGlow 1.4s ease-in-out infinite;
}

@keyframes arrowGlow {
  0%,100% {
    filter:
      drop-shadow(0 -1px 0px #fff)
      drop-shadow(-1px 0 0px #fff)
      drop-shadow(1px 0 0px #fff)
      drop-shadow(0 3px 8px rgba(230,57,70,.9))
      drop-shadow(0 0 16px rgba(230,57,70,.6));
  }
  50% {
    filter:
      drop-shadow(0 -1px 0px #fff)
      drop-shadow(-1px 0 0px #fff)
      drop-shadow(1px 0 0px #fff)
      drop-shadow(0 3px 14px rgba(255,80,90,1))
      drop-shadow(0 0 28px rgba(230,57,70,.9));
  }
}