/* public/style.css */
@keyframes pulse-btn {
  0%, 100% {
    box-shadow: 0 0 #e5ba1b80;
  }

  50% {
    box-shadow: 0 0 0 14px #e5ba1b00;
  }
}

@keyframes modal-in {
  from {
    opacity: 0;
    transform: scale(.8)translateY(30px);
  }

  to {
    opacity: 1;
    transform: scale(1)translateY(0);
  }
}

@keyframes spin-glow {
  0%, 100% {
    box-shadow: 0 0 20px #e5ba1b4d;
  }

  50% {
    box-shadow: 0 0 40px #e5ba1bb3;
  }
}

@keyframes title-float {
  0%, 100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-6px);
  }
}

* {
  box-sizing: border-box;
}

html, body {
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
}

body {
  display: flex;
  overflow-x: hidden;
  background-color: #1a1a1a;
  background-image: radial-gradient(at 50% 0%, #2e2e2e 0%, #1a1a1a 70%);
  flex-direction: column;
  min-height: 100vh;
  font-family: Arial, sans-serif;
}

header {
  color: #e5ba1b;
  text-align: center;
  letter-spacing: 2px;
  background-color: #222;
  border-bottom: 2px solid #e5ba1b33;
  flex-shrink: 0;
  padding: 18px 20px;
  font-family: Protest Revolution, sans-serif;
  font-size: clamp(1.2rem, 4vw, 1.6rem);
}

header p {
  margin: 0;
  padding: 0;
}

main {
  display: flex;
  flex-direction: column;
  flex: 1;
  justify-content: flex-start;
  align-items:  center;
  gap: clamp(24px, 8vw, 40px);
  width: 100%;
  padding: clamp(20px, 5vh, 40px) clamp(16px, 4vw, 32px);
}

main h1 {
  color: #e5ba1b;
  text-align: center;
  animation: title-float 3s ease-in-out infinite;
  text-shadow: 0 0 30px #e5ba1b4d;
  width: 100%;
  margin: 0;
  font-family: Protest Revolution, sans-serif;
  font-size: clamp(24px, 6vw, 42px);
  line-height: 1.2;
}

.wheel-wrapper {
  position: relative;
  aspect-ratio: 1;
  display: flex;
  justify-content: center;
  align-items:  center;
  width: min(85vw, 380px);
  max-width: 100%;
  margin: 0 auto;
}

.wheel {
  position: relative;
  will-change: transform;
  background: conic-gradient(#e5ba1b 0deg 36deg, #f0f0f0 36deg 72deg, #e5ba1b 72deg 108deg, #f0f0f0 108deg 144deg, #e5ba1b 144deg 180deg, #f0f0f0 180deg 216deg, #e5ba1b 216deg 252deg, #f0f0f0 252deg 288deg, #e5ba1b 288deg 324deg, #f0f0f0 324deg 360deg);
  border: clamp(3px, 1vw, 6px) solid #444;
  border-radius: 50%;
  width: 100%;
  height: 100%;
  transition: transform 4s cubic-bezier(.17,.67,.12,.99);
  box-shadow: 0 0 0 clamp(4px, 1vw, 8px) #333, 0 0 0 clamp(5px, 1.5vw, 10px) #555, 0 clamp(6px, 2vw, 12px) clamp(25px, 8vw, 50px) #0009;
}

.wheel:after {
  content: "";
  position: absolute;
  aspect-ratio: 1;
  z-index: 10;
  background: radial-gradient(circle, #555 0%, #222 100%);
  border: clamp(2px, .5vw, 4px) solid #777;
  border-radius: 50%;
  width: 14%;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.wheel:before {
  content: "";
  position: absolute;
  z-index: 1;
  pointer-events: none;
  background: repeating-conic-gradient(#0000 0deg 35.5deg, #00000040 35.5deg 36deg);
  border-radius: 50%;
  inset: 0;
}

.segment {
  position: absolute;
  transform-origin: left center;
  transform: translateY(-50%) rotate(calc(var(--i) * 36deg));
  display: flex;
  z-index: 2;
  pointer-events: none;
  justify-content: flex-start;
  align-items:  center;
  width: 50%;
  height: clamp(24px, 4vw, 40px);
  top: 50%;
  left: 50%;
}

.segment:before {
  content: var(--content);
  color: #222;
  text-transform: uppercase;
  letter-spacing: .5px;
  white-space: nowrap;
  text-shadow: 0 1px 2px #ffffff80;
  padding-left: clamp(45px, 12vw, 60px);
  font-size: clamp(.6rem, 1.5vw, .85rem);
  font-weight: bold;
}

.arrow {
  position: absolute;
  z-index: 20;
  filter: drop-shadow(-3px 0 6px #0009);
  pointer-events: none;
  border-top: clamp(16px, 4vw, 24px) solid #0000;
  border-bottom: clamp(16px, 4vw, 24px) solid #0000;
  border-right: clamp(32px, 8vw, 48px) solid #e5ba1b;
  width: 0;
  height: 0;
  top: 50%;
  right: clamp(-28px, -8vw, -40px);
  transform: translateY(-50%);
}

.start-wheel {
  display: flex;
  justify-content: center;
  width: 100%;
  margin-top: auto;
  padding-bottom: clamp(12px, 3vh, 24px);
}

.start-wheel button {
  cursor: pointer;
  color: #1a1a1a;
  letter-spacing: .5px;
  animation: pulse-btn 2s ease-in-out infinite;
  text-transform: uppercase;
  background: linear-gradient(135deg, #f0cc30, #c89e10);
  border: none;
  border-radius: 5em;
  width: clamp(200px, 70vw, 280px);
  height: clamp(48px, 12vw, 64px);
  transition: transform .15s, opacity .2s, box-shadow .2s;
  font-family: inherit;
  font-size: clamp(1rem, 3vw, 1.3rem);
  font-weight: bold;
  box-shadow: 0 clamp(3px, 1vw, 6px) clamp(15px, 4vw, 25px) #e5ba1b66;
}

.start-wheel button:hover:not(:disabled) {
  transform: scale(1.08);
  box-shadow: 0 clamp(4px, 1.5vw, 8px) clamp(20px, 5vw, 35px) #e5ba1b99;
}

.start-wheel button:active:not(:disabled) {
  transform: scale(.95);
}

.start-wheel button:disabled {
  opacity: .5;
  cursor: not-allowed;
  animation: spin-glow 1.5s ease-in-out infinite;
}

#confetti-canvas {
  position: fixed;
  pointer-events: none;
  z-index: 105;
  display: block;
  inset: 0;
}

.modal {
  position: fixed;
  backdrop-filter: blur(4px);
  z-index: 100;
  display: flex;
  opacity: 0;
  pointer-events: none;
  background: #000000d9;
  justify-content: center;
  align-items:  center;
  transition: opacity .35s;
  inset: 0;
}

.modal.visible {
  opacity: 1;
  pointer-events: auto;
}

.modal.visible .modal-content {
  animation: modal-in .4s cubic-bezier(.22, 1, .36, 1) forwards;
}

.modal-content {
  text-align: center;
  opacity: 0;
  transform-origin: center;
  background: #fff;
  border-top: clamp(4px, 1vw, 6px) solid #e5ba1b;
  border-radius: clamp(16px, 4vw, 24px);
  width: 90vw;
  max-width: min(90vw, 450px);
  padding: clamp(32px, 8vw, 56px);
  box-shadow: 0 20px 60px #000000b3;
}

.modal-content h2 {
  color: #e5ba1b;
  letter-spacing: 1px;
  margin: 0 0 8px;
  font-family: Protest Revolution, sans-serif;
  font-size: clamp(1.8rem, 5vw, 2.4rem);
}

.modal-content .modal-subtitle {
  color: #888;
  margin: 0 0 16px;
  font-size: clamp(.9rem, 2vw, 1.1rem);
  font-weight: 500;
}

.modal-content #winner-text {
  color: #1a1a1a;
  letter-spacing: .5px;
  margin: 12px 0 24px;
  font-size: clamp(1.4rem, 4vw, 2rem);
  font-weight: bold;
  line-height: 1.4;
}

#qrcode {
  display: flex;
  justify-content: center;
  align-items:  center;
  min-height: 150px;
  margin: 20px 0;
}

#qrcode canvas, #qrcode img {
  max-width: 100%;
  height: auto;
}

.modal-content > p {
  color: #666;
  margin: 8px 0 24px;
  font-size: clamp(.75rem, 1.5vw, .9rem);
}

.modal-content button {
  cursor: pointer;
  color: #1a1a1a;
  text-transform: uppercase;
  letter-spacing: .5px;
  background: linear-gradient(135deg, #f0cc30, #c89e10);
  border: none;
  border-radius: 5em;
  width: clamp(140px, 50vw, 200px);
  height: clamp(44px, 10vw, 56px);
  transition: transform .15s, box-shadow .2s;
  font-family: inherit;
  font-size: clamp(.9rem, 2.5vw, 1.1rem);
  font-weight: bold;
  box-shadow: 0 clamp(3px, 1vw, 5px) clamp(12px, 3vw, 20px) #e5ba1b59;
}

.modal-content button:hover {
  transform: scale(1.08);
  box-shadow: 0 clamp(4px, 1.5vw, 6px) clamp(15px, 4vw, 25px) #e5ba1b80;
}

.modal-content button:active {
  transform: scale(.95);
}

@media (max-width: 480px) {
  main {
    gap: 20px;
    padding: 16px 12px;
  }

  main h1 {
    margin-top: 8px;
  }

  .wheel-wrapper {
    width: min(90vw, 340px);
  }

  .modal {
    padding: 12px;
  }

  .modal-content {
    border-radius: 16px;
    padding: 24px 20px;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }

  .wheel {
    transition: none;
  }
}
