* {
  box-sizing: border-box;
  user-select: none;
}

body {
  margin: 0;
  min-height: 100vh;

  /* พื้นหลังรูป + overlay */
  background:
    linear-gradient(
      180deg,
      rgba(0,0,0,0.55) 0%,
      rgba(0,0,0,0.75) 60%,
      rgba(0,0,0,0.9) 100%
    ),
    url("assets/background.png") center / cover no-repeat fixed;

  font-family: system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  color: #fff;

  display: flex;
  justify-content: center;
}


.app {
  width: 420px;
  text-align: center;
  padding-top: 20px;
}

.title {
  font-size: 26px;
  margin-bottom: 25px;
}

.wheel-wrapper {
  position: relative;
  width: 300px;
  height: 300px;
  margin: 0 auto;
}

#wheel {
  width: 100%;
  height: 100%;
  transition: transform 4s cubic-bezier(0.15, 0.85, 0.25, 1);
}

.arrow {
  position: absolute;
  top: -18px;
  left: 50%;
  width: 42px;
  transform: translateX(-50%);
  z-index: 10;
}

#spinBtn {
  margin-top: 18px;
  padding: 12px 36px;
  font-size: 20px;
  font-weight: 900;
  border-radius: 40px;
  border: none;
  cursor: pointer;
  background: linear-gradient(135deg, #ffb703, #fb8500);
}

#spinBtn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.result {
  margin-top: 18px;
  font-size: 18px;
  font-weight: 800;
}

.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;
}

/* =========================
   UPGRADE EFFECT
========================= */
@keyframes upgradeFlash {
  0%   { box-shadow: 0 0 0 rgba(138,43,226,0); }
  50%  { box-shadow: 0 0 60px rgba(138,43,226,1); }
  100% { box-shadow: 0 0 0 rgba(138,43,226,0); }
}

.upgrade {
  animation: upgradeFlash 1s ease-out 2;
}

/* =========================
   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-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: none;
  color: #ffcc66;
  font-size: 17px;
  cursor: pointer;
  text-decoration: underline;
}

.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: #111;
  border-radius: 14px;
  padding: 20px;
  color: #fff;
  animation: pop 0.25s ease;
}

.modal-content h2 {
  margin-top: 0;
  color: #ffcc66;
}

.modal-content ol {
  padding-left: 20px;
  font-size: 14px;
  line-height: 1.6;
}

.tip {
  margin-top: 12px;
  color: #ffd700;
  font-size: 13px;
}

.close-btn {
  margin-top: 16px;
  width: 100%;
  padding: 12px;
  border-radius: 30px;
  border: none;
  font-weight: bold;
  background: linear-gradient(135deg,#ffb703,#fb8500);
  cursor: pointer;
}

@keyframes pop {
  from { transform: scale(0.9); opacity: 0 }
  to   { transform: scale(1); opacity: 1 }
}
