* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #000;
  font-family: Arial, sans-serif;
}

body {
  position: relative;
}

.app {
  position: relative;
  width: 100vw;
  height: 100dvh;
  overflow: hidden;
  background: #0417aa;
}

.background {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  pointer-events: none;
  user-select: none;
}

.header {
  position: absolute;
  top: 2.4vh;
  left: 50%;
  width: min(66vw, 340px);
  max-width: 340px;
  transform: translateX(-50%);
  pointer-events: none;
  user-select: none;
}

.wheel-stage {
  position: absolute;
  left: 50%;
  bottom: max(15.5vh, 238px);
  transform: translateX(-50%);
  width: min(80vw, 460px);
  aspect-ratio: 1 / 1;
}

.wheel-wrapper {
  position: relative;
  width: 100%;
  height: 100%;
  transition: transform 5s cubic-bezier(0.17, 0.67, 0.12, 0.99);
  will-change: transform;
}

.wheel-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  transform: scale(1.2);
  transform-origin: center;
  pointer-events: none;
  user-select: none;
}

.prize-arrow {
  position: absolute;
  top: calc(-12% - 50px);
  left: 50%;
  width: min(12.8vw, 70px);
  transform: translateX(-50%);
  pointer-events: none;
  user-select: none;
  z-index: 3;
  filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.35));
}

.spin-button {
  position: absolute;
  inset: 50% auto auto 50%;
  width: min(20vw, 102px);
  height: min(20vw, 102px);
  transform: translate(-50%, -50%);
  border: none;
  background: transparent;
  cursor: pointer;
  border-radius: 50%;
  padding: 0;
  z-index: 4;
}

.spin-button img {
  display: block;
  width: 100%;
  height: 100%;
}

.spin-button:disabled {
  cursor: default;
}

.spin-button:disabled img {
  opacity: 1;
}

.result {
  position: absolute;
  left: 50%;
  bottom: max(3.5vh, 20px);
  transform: translateX(-50%);
  min-width: min(84vw, 460px);
  max-width: min(92vw, 500px);
  padding: 18px 20px 20px;
  border-radius: 24px;
  background:
    radial-gradient(120% 140% at 50% 0%, rgba(255, 255, 255, 0.22), rgba(255, 255, 255, 0) 55%),
    linear-gradient(160deg, rgba(5, 10, 28, 0.76), rgba(5, 10, 28, 0.94));
  border: 1px solid rgba(255, 255, 255, 0.24);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.36);
  color: #fff;
  text-align: center;
  opacity: 0;
  transition: opacity 0.3s ease, transform 0.3s ease;
  z-index: 5;
  pointer-events: none;
}

.result.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.result-prefix {
  display: block;
  margin-bottom: 8px;
  font-size: 14px;
  letter-spacing: 2.8px;
  font-weight: 700;
  text-transform: uppercase;
  opacity: 0.88;
}

.result-text {
  display: block;
  font-size: 34px;
  font-weight: 800;
  line-height: 1.05;
  text-transform: uppercase;
  text-wrap: balance;
  text-shadow: 0 4px 10px rgba(0, 0, 0, 0.28);
}

.fullscreen-button {
  position: fixed;
  left: calc(16px + env(safe-area-inset-left, 0px));
  bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  z-index: 20;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(5, 10, 28, 0.2);
  color: rgba(255, 255, 255, 0.38);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  backdrop-filter: blur(8px);
  opacity: 0.2;
}

.fullscreen-icon {
  width: 12px;
  height: 12px;
}

.result--prize {
  box-shadow:
    0 18px 50px rgba(0, 0, 0, 0.36),
    0 0 0 1px rgba(255, 198, 71, 0.16) inset,
    0 0 42px rgba(255, 198, 71, 0.18);
}

.result--retry {
  box-shadow:
    0 18px 50px rgba(0, 0, 0, 0.36),
    0 0 0 1px rgba(116, 214, 255, 0.16) inset,
    0 0 42px rgba(116, 214, 255, 0.16);
}

.confetti-canvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100dvh;
  pointer-events: none;
  z-index: 40;
}

.debug-panel {
  position: fixed;
  top: calc(18px + env(safe-area-inset-top, 0px));
  left: calc(18px + env(safe-area-inset-left, 0px));
  z-index: 45;
  min-width: 220px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(5, 10, 28, 0.76);
  color: #fff;
  backdrop-filter: blur(10px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.debug-panel.show {
  opacity: 1;
}

.debug-title {
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
}

.debug-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  font-size: 13px;
  line-height: 1.45;
}

.debug-row span {
  opacity: 0.72;
}

.debug-row strong {
  font-weight: 700;
}
