:root{
  --bg: #0b0b0d;
  --text: #f2f2f2;
  --muted: #b9b9b9;

  --orange: #f4a300;
  --black: #0b0b0d;

  --ring: rgba(255,255,255,.28);
  --dot: rgba(255,255,255,.55);

  --size: min(340px, 82vw);
}

* { box-sizing: border-box; }
html, body { height: 100%; }

body{
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial;
  background:
    radial-gradient(1200px 700px at 50% -120px, rgba(244,163,0,.18), transparent 55%),
    radial-gradient(900px 600px at 50% 110%, rgba(255,255,255,.06), transparent 60%),
    var(--bg);
  color: var(--text);
  display: grid;
  place-items: center;
  padding: 24px;
}

.app{
  width: min(520px, 92vw);
  display: grid;
  gap: 16px;
  justify-items: center;
}

.title{
  margin: 0;
  font-size: 22px;
  font-weight: 700;
}

.wheel-wrap{
  position: relative;
  width: var(--size);
  height: var(--size);
  display: grid;
  place-items: center;
}

/* ================= POINTER ================= */
.pointer{
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 30;
}

.pointer::before{
  content: "";
  border-left: 14px solid transparent;
  border-right: 14px solid transparent;
  border-bottom: 24px solid var(--orange);
  display: block;
  filter: drop-shadow(0 6px 10px rgba(0,0,0,.6));
}

.pointer .pin{
  position: absolute;
  left: 50%;
  top: 18px;
  transform: translateX(-50%);
  width: 10px;
  height: 10px;
  background: #ffe08a;
  border-radius: 50%;
}

/* tick animatsiya */
@keyframes tick {
  0% { transform: translateX(-50%) rotate(0deg); }
  50% { transform: translateX(-50%) rotate(-12deg); }
  100% { transform: translateX(-50%) rotate(0deg); }
}

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

/* ================= WHEEL ================= */
.wheel{
  width: 100%;
  height: 100%;
  border-radius: 50%;
  position: relative;
  display: grid;
  place-items: center;
  cursor: pointer;
  user-select: none;
}

.wheel::before{
  content: "";
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 3px solid var(--ring);
  box-shadow: 0 18px 50px rgba(0,0,0,.6);
}

.wheel-face{
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background:
    conic-gradient(
      from -18deg,
      var(--black) 0 36deg,
      var(--orange) 36deg 72deg,
      var(--black) 72deg 108deg,
      var(--orange) 108deg 144deg,
      var(--black) 144deg 180deg,
      var(--orange) 180deg 216deg,
      var(--black) 216deg 252deg,
      var(--orange) 252deg 288deg,
      var(--black) 288deg 324deg,
      var(--orange) 324deg 360deg
    );
  transition: transform 4.2s cubic-bezier(.12,.78,.12,1);
  will-change: transform;
}

.wheel-face.spinning{
  filter: blur(.3px);
}

/* segment chiziqlari */
.wheel-face::before{
  content: "";
  position: absolute;
  inset: 0;
  background:
    repeating-conic-gradient(
      from -18deg,
      rgba(255,255,255,.18) 0 1deg,
      transparent 1deg 36deg
    );
}

/* markaz */
.hub{
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, rgba(255,255,255,.22), rgba(0,0,0,.45));
  border: 3px solid rgba(255,255,255,.18);
  z-index: 5;
}

/* ================= NUMBERS ================= */
.num{
  position: absolute;
  left: 50%;
  top: 50%;
  font-weight: 800;
  font-size: clamp(18px, 4.6vw, 28px);
  text-shadow: 0 2px 10px rgba(0,0,0,.55);
  pointer-events: none;
}

.num span{
  display: inline-block;
  transform-origin: center;
}

/* ================= CONTROLS ================= */
.controls{
  display: flex;
  gap: 10px;
}

.btn{
  background: var(--orange);
  color: #151515;
  border: none;
  border-radius: 12px;
  padding: 11px 16px;
  font-weight: 800;
  cursor: pointer;
}

.btn.btn-ghost{
  background: rgba(255,255,255,.10);
  color: var(--text);
  border: 1px solid rgba(255,255,255,.14);
}

.btn:disabled{
  opacity: .6;
  cursor: not-allowed;
}

.result{
  color: var(--muted);
}

.result-value{
  font-weight: 900;
  color: var(--text);
}

/* ================= MODAL ================= */
.modal{
  position: fixed;
  inset: 0;
  display: none;
  z-index: 100;
}

.modal.show{
  display: block;
}

.modal-backdrop{
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.6);
  backdrop-filter: blur(3px);
}

.modal-box{
  position: relative;
  max-width: 320px;
  margin: auto;
  top: 50%;
  transform: translateY(-50%);
  background: #111;
  border-radius: 16px;
  padding: 22px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,.8);
}

.modal-title{
  margin: 0 0 10px;
  font-size: 20px;
}

.modal-number{
  font-size: 48px;
  font-weight: 900;
  color: var(--orange);
  margin: 6px 0;
}

.modal-text{
  color: var(--muted);
  margin-bottom: 16px;
}

.modal-img{
  width: 100%;
  max-height: 180px;
  object-fit: cover;
  border-radius: 12px;
  margin: 10px 0;
  background: rgba(255,255,255,.06);
}

.modal-img.is-loading{
  filter: blur(6px);
  opacity: .75;
}

