* {
  box-sizing: border-box;
  user-select: none;
}

body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(135deg, #1a0a1a 0%, #2d1a2d 50%, #3d1a3d 100%);
  color: #fff;
  display: flex;
  justify-content: center;
}

#wheel {
  filter: drop-shadow(0 10px 25px rgba(0,0,0,0.6));
}

.app {
  width: 420px;
  text-align: center;
  padding-top: 20px;
  max-width: 95%;
  margin: 0 auto;
}

.title {
  font-size: 32px;
  margin-bottom: 15px;
  color: #ff69b4;
  text-shadow: 2px 2px 8px rgba(0,0,0,0.8), 0 0 10px rgba(255,105,180,0.5);
  font-weight: bold;
}

.cupid-decoration {
  position: absolute;
  top: 0;
  left: 0;
  width: 130px;
  z-index: 2;
  pointer-events: none;
  filter: drop-shadow(0 6px 12px rgba(0,0,0,0.6));
}

.wheel-stage {
  position: relative;
  width: 550px;
  height: 500px;
  margin: 30px auto 0;
}

.wheel-container {
  position: relative;
  overflow: visible;
  width: 100%;
  height: 100%;
  padding: 20px;
  background: rgba(255, 105, 180, 0.08);
  border: 3px solid rgba(255, 105, 180, 0.3);
  border-radius: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 40px rgba(255, 105, 180, 0.15), inset 0 0 20px rgba(255, 255, 255, 0.05);
}

.wheel-wrapper {
  position: relative;
  width: 400px; /* Adjusted size for single wheel */
  height: 400px;
  z-index: 8;
}

#wheel {
  width: 100%;
  height: 100%;
  transition: transform 4s cubic-bezier(0.15, 0.85, 0.25, 1);
  border-radius: 50%;
  z-index: 5;
}

.arrow {
  position: absolute;
  top: -35px;
  left: 50%;
  width: 80px;
  transform: translateX(-50%);
  z-index: 10;
}

#spinBtn {
  margin-top: 18px;
  padding: 14px 40px;
  font-size: 22px;
  font-weight: 900;
  border-radius: 40px;
  border: none;
  cursor: pointer;
  color: #fff;
  background: linear-gradient(135deg, #ff1493, #ff0080);
  box-shadow: 0 4px 20px rgba(255, 20, 147, 0.6), inset 0 1px 0 rgba(255,255,255,0.3);
  text-shadow: 1px 1px 3px rgba(0,0,0,0.4);
}

#spinBtn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.result {
  margin-top: 18px;
  font-size: 20px;
  font-weight: 800;
  color: #ffb6d9;
  text-shadow: 1px 1px 4px rgba(0,0,0,0.6), 0 0 8px rgba(255,105,180,0.4);
}

.hidden {
  display: none;
}

@keyframes shake {
  0%   { transform: translateX(-50%) rotate(0deg); }
  25%  { transform: translateX(-50%) rotate(-4deg); }
  50%  { transform: translateX(-50%) rotate(4deg); }
  75%  { transform: translateX(-50%) rotate(-2deg); }
  100% { transform: translateX(-50%) rotate(0deg); }
}

.arrow.spin {
  animation: shake 0.2s ease-in-out infinite;
}

/* =========================
   JACKPOT EFFECT
========================= */
@keyframes jackpotGlow {
  0%   { box-shadow: 0 0 0 rgba(255,215,0,0); }
  50%  { box-shadow: 0 0 120px rgba(255,215,0,1); }
  100% { box-shadow: 0 0 0 rgba(255,215,0,0); }
}

.jackpot {
  animation: jackpotGlow 1.2s ease-out 3;
  color: gold;
}
/* =========================
   WHEEL TRANSITION EFFECTS
========================= */
#wheel {
  transition: transform 0.6s ease, opacity 0.6s ease;
  transform-origin: center center;
}

.wheel-fade-out {
  transform: scale(1.25);
  opacity: 0;
}

.wheel-fade-in {
  transform: scale(0.9);
  opacity: 0;
}

.wheel-visible {
  transform: scale(1);
  opacity: 1;
}

.wheel-special {
  filter: drop-shadow(0 0 18px rgba(138,43,226,0.9));
  animation: specialPulse 1.4s ease-in-out infinite;
}

@keyframes specialPulse {
  0%   { filter: drop-shadow(0 0 10px rgba(138,43,226,0.6)); }
  50%  { filter: drop-shadow(0 0 30px rgba(138,43,226,1)); }
  100% { filter: drop-shadow(0 0 10px rgba(138,43,226,0.6)); }
}

.wheel-jackpot {
  filter: drop-shadow(0 0 30px rgba(255,215,0,1));
  animation: jackpotPulse 1.8s ease-in-out infinite;
}

@keyframes jackpotPulse {
  0%   { filter: drop-shadow(0 0 18px rgba(255,215,0,0.7)); }
  50%  { filter: drop-shadow(0 0 55px rgba(255,215,0,1)); }
  100% { filter: drop-shadow(0 0 18px rgba(255,215,0,0.7)); }
}

.wheel-wrapper {
  position: relative;
  transition: opacity 0.35s ease, transform 0.35s ease;
}

.wheel-wrapper::after {
  content: "";
  position: absolute;
  inset: -40px;
  background: radial-gradient(circle, rgba(255,215,0,0.15), transparent 65%);
  z-index: -1;
}

.wheel-fade-out {
  opacity: 0;
  transform: scale(0.92);
}

.wheel-fade-in {
  opacity: 1;
  transform: scale(1);
}

@keyframes tierPop {
  0%   { transform: scale(0.85); }
  60%  { transform: scale(1.08); }
  100% { transform: scale(1); }
}

.wheel-pop {
  animation: tierPop 0.45s ease-out;
}

.howto-btn {
  margin-top: 10px;
  background: transparent;
  border: 2px solid #ff69b4;
  color: #ffb6d9;
  font-size: 17px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  text-shadow: 1px 1px 3px rgba(0,0,0,0.5);
  padding: 8px 16px;
  border-radius: 20px;
  transition: all 0.3s ease;
}

.howto-btn:hover {
  background: rgba(255,105,180,0.2);
  border-color: #ff1493;
  color: #ff69b4;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99;

  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.modal.show {
  opacity: 1;
  pointer-events: auto;
}


.modal-content {
  width: 90%;
  max-width: 360px;
  background: linear-gradient(135deg, #1a0a1a 0%, #2d1a2d 100%);
  border: 2px solid #ff69b4;
  border-radius: 14px;
  padding: 20px;
  color: #fff;
  animation: pop 0.25s ease;
  box-shadow: 0 10px 40px rgba(255,105,180,0.3);
}

.modal-content h2 {
  margin-top: 0;
  color: #ff1493;
}

.modal-content ol {
  padding-left: 20px;
  font-size: 14px;
  line-height: 1.6;
}

.tip {
  margin-top: 12px;
  color: #ffb6d9;
  font-size: 13px;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.4);
}

.close-btn {
  margin-top: 16px;
  width: 100%;
  padding: 12px;
  border-radius: 30px;
  border: none;
  font-weight: bold;
  color: #fff;
  background: linear-gradient(135deg, #ff1493, #ff0080);
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(255, 20, 147, 0.5);
  text-shadow: 1px 1px 3px rgba(0,0,0,0.4);
}

@keyframes pop {
  from { transform: scale(0.9); opacity: 0 }
  to   { transform: scale(1); opacity: 1 }
}

.action-buttons {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px; /* ระยะห่างระหว่างปุ่ม */
  margin-top: 16px;
}

/* =========================
   RESPONSIVE MOBILE DESIGN
========================= */

/* Extra Small Devices (320px - 374px) */
@media (max-width: 374px) {
  .app {
    width: 95%;
    padding-top: 15px;
  }

  .title {
    font-size: 24px;
    margin-bottom: 12px;
  }

  .cupid-decoration {
    width: 90px;
    top: 0;
    left: 0;
  }

  .wheel-stage {
    width: 95%;
    height: auto;
    aspect-ratio: 1.1;
    margin: 20px auto 0;
  }

  .wheel-container {
    width: 100%;
    height: 100%;
    padding: 15px;
  }

  .wheel-wrapper {
    width: 280px;
    height: 280px;
  }

  .arrow {
    width: 50px;
    top: -25px;
  }

  #spinBtn {
    padding: 11px 28px;
    font-size: 16px;
    margin-top: 14px;
  }

  .howto-btn {
    font-size: 14px;
    padding: 6px 12px;
    margin-top: 8px;
  }

  .result {
    font-size: 16px;
    margin-top: 14px;
  }

  .modal-content {
    padding: 16px;
  }

  .modal-content h2 {
    font-size: 18px;
  }

  .modal-content ol {
    font-size: 12px;
  }

  .tip {
    font-size: 11px;
  }

  .close-btn {
    padding: 10px;
    font-size: 14px;
  }
}

/* Small Mobile (375px - 480px) */
@media (min-width: 375px) and (max-width: 480px) {
  .app {
    width: 95%;
    padding-top: 16px;
  }

  .title {
    font-size: 26px;
    margin-bottom: 12px;
  }

  .cupid-decoration {
    width: 110px;
    top: 0;
    left: 0;
  }

  .wheel-stage {
    width: 95%;
    height: auto;
    aspect-ratio: 1.1;
    margin: 20px auto 0;
  }

  .wheel-container {
    width: 100%;
    height: 100%;
    padding: 16px;
    border-radius: 25px;
  }

  .wheel-wrapper {
    width: 320px;
    height: 320px;
  }

  .arrow {
    width: 60px;
    top: -28px;
  }

  #spinBtn {
    padding: 12px 32px;
    font-size: 18px;
    margin-top: 15px;
  }

  .howto-btn {
    font-size: 15px;
    padding: 7px 14px;
    margin-top: 9px;
  }

  .result {
    font-size: 17px;
    margin-top: 15px;
  }

  .action-buttons {
    gap: 9px;
    margin-top: 14px;
  }

  .modal-content {
    padding: 18px;
  }

  .modal-content h2 {
    font-size: 20px;
  }

  .modal-content ol {
    font-size: 13px;
  }

  .tip {
    font-size: 12px;
  }

  .close-btn {
    padding: 11px;
    font-size: 15px;
  }
}

/* Medium Mobile (481px - 600px) */
@media (min-width: 481px) and (max-width: 600px) {
  .app {
    width: 90%;
    padding-top: 18px;
  }

  .title {
    font-size: 28px;
    margin-bottom: 13px;
  }

  .cupid-decoration {
    width: 125px;
    top: 0;
    left: 0;
  }

  .wheel-stage {
    width: 90%;
    height: auto;
    aspect-ratio: 1.1;
    margin: 22px auto 0;
  }

  .wheel-container {
    width: 100%;
    height: 100%;
    padding: 18px;
    border-radius: 27px;
  }

  .wheel-wrapper {
    width: 350px;
    height: 350px;
  }

  .arrow {
    width: 70px;
    top: -30px;
  }

  #spinBtn {
    padding: 13px 35px;
    font-size: 20px;
    margin-top: 16px;
  }

  .howto-btn {
    font-size: 16px;
    padding: 8px 16px;
    margin-top: 10px;
  }

  .result {
    font-size: 19px;
    margin-top: 16px;
  }

  .action-buttons {
    gap: 10px;
    margin-top: 15px;
  }
}

/* Large Mobile / Small Tablet (601px - 768px) */
@media (min-width: 601px) and (max-width: 768px) {
  .app {
    width: 85%;
    padding-top: 20px;
  }

  .title {
    font-size: 30px;
    margin-bottom: 14px;
  }

  .cupid-decoration {
    width: 135px;
    top: 0;
    left: 0;
  }

  .wheel-stage {
    width: 90%;
    max-width: 500px;
    height: auto;
    aspect-ratio: 1.1;
    margin: 25px auto 0;
  }

  .wheel-container {
    width: 100%;
    height: 100%;
    padding: 20px;
    border-radius: 28px;
  }

  .wheel-wrapper {
    width: 380px;
    height: 380px;
  }

  .arrow {
    width: 75px;
    top: -32px;
  }

  #spinBtn {
    padding: 14px 38px;
    font-size: 21px;
    margin-top: 17px;
  }

  .howto-btn {
    font-size: 17px;
    padding: 9px 18px;
    margin-top: 11px;
  }

  .result {
    font-size: 20px;
    margin-top: 17px;
  }

  .action-buttons {
    gap: 11px;
    margin-top: 16px;
  }
}

/* Tablet / Large Devices (769px and above) */
@media (min-width: 769px) {
  body {
    align-items: center;
  }

  .app {
    width: 420px;
    padding-top: 20px;
  }

  .title {
    font-size: 32px;
    margin-bottom: 15px;
  }

  .cupid-decoration {
    width: 140px;
    top: 0;
    left: 0;
  }

  .wheel-stage {
    width: 550px;
    height: 500px;
    margin: 30px auto 0;
  }

  .wheel-container {
    width: 100%;
    height: 100%;
    padding: 20px;
    border-radius: 30px;
  }

  .wheel-wrapper {
    width: 400px;
    height: 400px;
  }

  .arrow {
    width: 80px;
    top: -35px;
  }

  #spinBtn {
    padding: 14px 40px;
    font-size: 22px;
    margin-top: 18px;
  }

  .howto-btn {
    font-size: 17px;
    padding: 8px 16px;
    margin-top: 10px;
  }

  .result {
    font-size: 20px;
    margin-top: 18px;
  }

  .action-buttons {
    gap: 10px;
    margin-top: 16px;
  }

  .modal-content {
    max-width: 360px;
  }
}
