:root {
  --page-bg: #07110d;
  --page-bg-2: #0b1710;
  --gold: #f1ce1e;
  --gold-bright: #ffe86a;
  --gold-dark: #9a7110;
  --olive: #405247;
  --olive-deep: #28382f;
  --cream: #c7bd72;
  --ink: #07110d;
  --text: #fffbe4;
  --muted: #cfceb9;
  --wheel-size: min(92vw, 500px);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

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

body {
  position: relative;
  overflow-x: hidden;
  color: var(--text);
  font-family: "Segoe UI", Tahoma, Arial, sans-serif;
  background:
    radial-gradient(circle at 50% 34%, rgba(221, 198, 33, 0.14), transparent 34%),
    radial-gradient(circle at 12% 18%, rgba(151, 174, 88, 0.08), transparent 24%),
    linear-gradient(180deg, #050b08 0%, var(--page-bg) 47%, #09150f 100%);
}

body::before,
body::after {
  content: "";
  position: fixed;
  pointer-events: none;
  z-index: 0;
}

body::before {
  inset: 0;
  opacity: 0.19;
  background:
    linear-gradient(28deg, transparent 42%, rgba(255,255,255,.028) 43%, rgba(255,255,255,.028) 49%, transparent 50%),
    linear-gradient(-28deg, transparent 42%, rgba(255,255,255,.02) 43%, rgba(255,255,255,.02) 49%, transparent 50%);
  background-size: 190px 190px;
}

body::after {
  inset: auto 0 0;
  height: 34vh;
  background: linear-gradient(180deg, transparent, rgba(0,0,0,.34));
}

.app-shell {
  position: relative;
  z-index: 2;
  width: min(100%, 540px);
  min-height: 100vh;
  margin: 0 auto;
  padding: max(18px, env(safe-area-inset-top)) 10px calc(24px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
}

.wheel-title {
  position: relative;
  z-index: 6;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 8px 0 18px;
  color: var(--gold);
  text-align: center;
  filter: drop-shadow(0 0 12px rgba(240, 205, 30, .35));
}

.wheel-title h1 {
  margin: 0;
  font-size: clamp(28px, 7vw, 38px);
  font-weight: 900;
  letter-spacing: -.6px;
}

.title-star {
  font-size: clamp(24px, 6vw, 34px);
  color: var(--gold-bright);
  animation: starPulse 2.4s ease-in-out infinite;
}

.title-star:last-child {
  animation-delay: .7s;
}

@keyframes starPulse {
  0%, 100% { transform: scale(.96); opacity: .75; }
  50% { transform: scale(1.12); opacity: 1; }
}

.wheel-zone {
  position: relative;
  width: 100%;
  display: grid;
  place-items: center;
  padding: 25px 0 72px;
}

.ambient-ring {
  position: absolute;
  top: 42%;
  left: 50%;
  width: calc(var(--wheel-size) + 54px);
  height: calc(var(--wheel-size) + 54px);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.ambient-ring-one {
  border: 2px solid rgba(241, 206, 30, .20);
  box-shadow:
    0 0 28px rgba(241, 206, 30, .23),
    inset 0 0 28px rgba(241, 206, 30, .12);
  animation: ringBreath 3s ease-in-out infinite;
}

.ambient-ring-two {
  width: calc(var(--wheel-size) + 78px);
  height: calc(var(--wheel-size) + 78px);
  border: 1px dashed rgba(255, 229, 93, .15);
  animation: ringRotate 22s linear infinite;
}

@keyframes ringBreath {
  0%, 100% { opacity: .55; transform: translate(-50%, -50%) scale(.985); }
  50% { opacity: 1; transform: translate(-50%, -50%) scale(1.015); }
}

@keyframes ringRotate {
  to { transform: translate(-50%, -50%) rotate(360deg); }
}

.pointer {
  position: absolute;
  z-index: 20;
  top: 2px;
  left: 50%;
  width: 72px;
  height: 99px;
  transform: translateX(-50%);
  clip-path: polygon(50% 100%, 7% 31%, 17% 9%, 34% 0, 66% 0, 83% 9%, 93% 31%);
  background: linear-gradient(90deg, #101813 0%, #010302 50%, #1c281f 100%);
  border-radius: 44% 44% 18% 18%;
  filter:
    drop-shadow(0 8px 3px rgba(0,0,0,.66))
    drop-shadow(0 0 10px rgba(240, 205, 30, .32));
  transform-origin: 50% 23%;
}

.pointer::before {
  content: "";
  position: absolute;
  inset: 4px 7px 16px;
  clip-path: inherit;
  border: 2px solid rgba(255, 230, 96, .32);
}

.pointer-shine {
  position: absolute;
  top: 12px;
  left: 24px;
  width: 16px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(120deg, rgba(255,255,255,.26), transparent 65%);
  transform: rotate(-18deg);
}

.pointer.tick {
  animation: pointerTick .12s ease-out;
}

@keyframes pointerTick {
  0% { transform: translateX(-50%) rotate(0deg); }
  45% { transform: translateX(-50%) rotate(-5deg); }
  100% { transform: translateX(-50%) rotate(0deg); }
}

.wheel-frame {
  position: relative;
  width: var(--wheel-size);
  aspect-ratio: 1;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 50% 50%, #1d281f 0 61%, transparent 61.5%),
    repeating-conic-gradient(from 0deg, #f6d71c 0 2deg, #202b23 2deg 15deg),
    radial-gradient(circle, #0a0f0c 0 66%, #e8c50f 66.5% 68.2%, #111913 68.5% 74%, #e1bd0c 74.5% 76%, #08100b 76.5% 100%);
  padding: 34px;
  box-shadow:
    0 24px 46px rgba(0,0,0,.68),
    0 0 26px rgba(242, 205, 24, .31),
    inset 0 0 0 5px rgba(255, 227, 72, .13),
    inset 0 0 24px rgba(0,0,0,.72);
}

.wheel-frame::before,
.wheel-frame::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
}

.wheel-frame::before {
  inset: 16px;
  border: 3px solid #080b09;
  box-shadow:
    0 0 0 3px rgba(235, 201, 31, .55),
    inset 0 0 18px rgba(0,0,0,.9);
}

.wheel-frame::after {
  inset: 27px;
  border: 1px solid rgba(255, 236, 126, .35);
}

.wheel-bolts {
  position: absolute;
  inset: 0;
  z-index: 7;
  pointer-events: none;
}

.wheel-bolts span {
  position: absolute;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 42% 36%, #d8ddc5 0 12%, #5c655b 14% 24%, #111713 27% 58%, #a0aa98 60% 67%, #151b17 70%);
  box-shadow: 0 2px 5px rgba(0,0,0,.75);
}

.wheel-rotor {
  position: relative;
  z-index: 5;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  overflow: hidden;
  transform: rotate(0deg);
  will-change: transform;
  box-shadow:
    inset 0 0 30px rgba(0,0,0,.62),
    0 0 0 3px #090d0a;
}

.wheel-svg {
  display: block;
  width: 100%;
  height: 100%;
}

.segment-path {
  stroke: rgba(14, 21, 16, .72);
  stroke-width: 2.4;
}

.segment-highlight {
  opacity: 0;
  transition: opacity .25s ease;
}

.wheel-frame.won .segment-highlight.target {
  opacity: 1;
  animation: winnerGlow .72s ease-in-out 3;
}

@keyframes winnerGlow {
  0%, 100% { opacity: .12; }
  50% { opacity: .48; }
}

.segment-label {
  fill: #fffef4;
  font-weight: 900;
  font-size: 22px;
  text-anchor: middle;
  dominant-baseline: middle;
  filter: url(#labelShadow);
  pointer-events: none;
}

.segment-label .segment-icon {
  font-size: 29px;
}

.segment-label .segment-main {
  font-size: 22px;
}

.segment-label .segment-sub {
  fill: #fff9c8;
  font-size: 16px;
  font-weight: 800;
}

.spin-button {
  position: absolute;
  z-index: 15;
  width: 104px;
  height: 104px;
  border: 0;
  border-radius: 50%;
  padding: 0;
  cursor: pointer;
  color: #e9e9df;
  background:
    radial-gradient(circle at 34% 28%, #424943 0 7%, #111712 33%, #050705 68%, #1f271f 100%);
  box-shadow:
    0 0 0 6px #0b0f0c,
    0 0 0 10px #b38b10,
    0 0 0 13px rgba(255, 224, 64, .34),
    0 10px 22px rgba(0,0,0,.7),
    inset 0 4px 6px rgba(255,255,255,.13),
    inset 0 -7px 12px rgba(0,0,0,.85);
  transition: transform .18s ease, filter .18s ease, opacity .18s ease;
}

.spin-button::before {
  content: "";
  position: absolute;
  inset: 10px;
  border-radius: 50%;
  border: 1px solid rgba(244, 211, 42, .28);
}

.spin-button:not(:disabled):active {
  transform: scale(.94);
}

.spin-button:not(:disabled):hover {
  filter: brightness(1.13);
}

.spin-button:disabled {
  cursor: wait;
  opacity: .88;
}

.spin-button.spinning {
  animation: spinButtonPulse .85s ease-in-out infinite alternate;
}

@keyframes spinButtonPulse {
  from { box-shadow: 0 0 0 6px #0b0f0c, 0 0 0 10px #b38b10, 0 0 12px rgba(255,220,40,.25), inset 0 4px 6px rgba(255,255,255,.13), inset 0 -7px 12px rgba(0,0,0,.85); }
  to { box-shadow: 0 0 0 6px #0b0f0c, 0 0 0 10px #d1ad1b, 0 0 28px rgba(255,220,40,.58), inset 0 4px 6px rgba(255,255,255,.16), inset 0 -7px 12px rgba(0,0,0,.85); }
}

.spin-inner {
  position: relative;
  z-index: 2;
  display: inline-block;
  font-family: Arial, sans-serif;
  font-size: 23px;
  font-weight: 1000;
  font-style: italic;
  letter-spacing: -1.5px;
  text-shadow: 0 2px 1px #000;
}

.result-toast {
  position: absolute;
  z-index: 30;
  left: 50%;
  bottom: 10px;
  width: min(88%, 390px);
  min-height: 78px;
  padding: 13px 18px;
  border-radius: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  text-align: right;
  background: rgba(4, 10, 7, .90);
  border: 1px solid rgba(241, 206, 30, .42);
  box-shadow:
    0 18px 35px rgba(0,0,0,.5),
    0 0 22px rgba(241, 206, 30, .15),
    inset 0 1px 0 rgba(255,255,255,.08);
  backdrop-filter: blur(12px);
  transform: translate(-50%, 24px) scale(.94);
  opacity: 0;
  pointer-events: none;
  transition: opacity .32s ease, transform .32s cubic-bezier(.2,.9,.2,1.1);
}

.result-toast.show {
  transform: translate(-50%, 0) scale(1);
  opacity: 1;
}

.result-icon {
  flex: 0 0 auto;
  font-size: 34px;
}

.result-copy {
  display: grid;
  gap: 3px;
}

.result-copy strong {
  color: var(--gold-bright);
  font-size: 20px;
}

.result-copy span {
  color: #f5f3df;
  font-size: 15px;
  line-height: 1.4;
}

.result-toast.no-prize {
  border-color: rgba(179, 191, 169, .30);
  box-shadow: 0 18px 35px rgba(0,0,0,.5), inset 0 1px 0 rgba(255,255,255,.06);
}

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

.error-state .wheel-frame {
  filter: grayscale(.35) brightness(.74);
}

@media (max-width: 420px) {
  :root { --wheel-size: min(94vw, 430px); }
  .app-shell { padding-inline: 6px; }
  .wheel-title { margin-bottom: 8px; }
  .wheel-zone { padding-top: 25px; }
  .wheel-frame { padding: 29px; }
  .pointer { width: 63px; height: 88px; }
  .spin-button { width: 88px; height: 88px; }
  .spin-inner { font-size: 20px; }
  .segment-label .segment-icon { font-size: 25px; }
  .segment-label .segment-main { font-size: 19px; }
  .segment-label .segment-sub { font-size: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
  }
}
