/* 🎡 Al Jawahiri wheel — the brand colours come from the server (admin settings)
   as CSS variables on :root; these are the defaults. */
:root {
  --bg: #0B1628; --primary: #E1FE64; --secondary: #8BC4DF; --extra: #2A8FE8;
  --small: #1A3A6B; --nothing: #101E36; --text: #FFFFFF; --text-dark: #0B1628;
  --wheel: min(88vw, 400px, 52vh);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }

/* An icon of the emoji pack: the device's emoji until the animated one is drawn in it. */
.ji {
  display: inline-grid; place-items: center; width: 1.35em; height: 1.35em; margin-inline-end: .3em;
  font-style: normal; line-height: 1; vertical-align: -0.28em; flex: none;
}
.ji svg { width: 100% !important; height: 100% !important; }
.btn .ji { width: 1.45em; height: 1.45em; }
.slot-icon { width: 30px; height: 30px; margin: 0; font-size: 20px; display: grid; }
.big-icon { width: 76px; height: 76px; font-size: 52px; margin: 0 auto 4px; display: grid; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); }
body {
  font-family: "Cairo", system-ui, -apple-system, "Segoe UI", Tahoma, sans-serif;
  overscroll-behavior: none; user-select: none; -webkit-user-select: none;
}
main {
  max-width: 480px; margin: 0 auto; min-height: 100vh;
  padding: max(12px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom));
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  background: radial-gradient(120% 60% at 50% 42%, color-mix(in srgb, var(--extra) 18%, transparent), transparent 70%);
}
main.loading .stage, main.loading .actions { opacity: .35; }

.top { width: 100%; text-align: center; }
.top h1 { display: flex; align-items: center; justify-content: center; margin: 4px 0 8px; font-size: 22px; font-weight: 800; color: var(--primary); letter-spacing: .3px; }
.chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.chip {
  display: inline-flex; align-items: center;
  padding: 4px 12px; border-radius: 999px; font-size: 14px; font-weight: 700;
  background: color-mix(in srgb, var(--secondary) 16%, transparent);
  border: 1px solid color-mix(in srgb, var(--secondary) 45%, transparent);
}
.balance { margin-top: 6px; font-size: 13px; opacity: .8; min-height: 1.2em; }

.stage { position: relative; width: var(--wheel); height: var(--wheel); margin-top: 14px; flex: none; }
#wheel { width: 100%; height: 100%; display: block; overflow: visible;
  filter: drop-shadow(0 10px 28px rgba(0, 0, 0, .45)); }
/* the pin at the top: lime, with a dark eye, it flicks at every slot */
.pointer {
  position: absolute; top: -18px; left: 50%; width: 11%; min-width: 34px; z-index: 4;
  transform: translateX(-50%); transform-origin: 50% 30%; overflow: visible;
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, .55)) drop-shadow(0 0 10px color-mix(in srgb, var(--primary) 45%, transparent));
}
.pointer .pin { fill: var(--primary); stroke: color-mix(in srgb, var(--primary) 60%, #000); stroke-width: 1.5; }
.pointer .pin-dot { fill: var(--bg); stroke: var(--secondary); stroke-width: 2; }
.pointer.tick { animation: tick .12s ease-out; }
@keyframes tick { 50% { transform: translateX(-50%) rotate(-14deg); } }

/* the glow behind the wheel */
.halo {
  position: absolute; inset: -12%; border-radius: 50%; z-index: -1; pointer-events: none;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--extra) 38%, transparent),
              color-mix(in srgb, var(--secondary) 10%, transparent) 70%, transparent);
  animation: breathe 4s ease-in-out infinite;
}
@keyframes breathe { 50% { transform: scale(1.04); opacity: .8; } }

/* rim lights: a slow blink at rest, a chase while turning */
.bulb { transition: opacity .2s; filter: drop-shadow(0 0 3px currentColor); }
.bulbs .odd { animation: blink 1.6s ease-in-out infinite; }
.bulbs .even { animation: blink 1.6s ease-in-out .8s infinite; }
.spinning .bulbs .odd { animation-duration: .32s; }
.spinning .bulbs .even { animation-duration: .32s; animation-delay: .16s; }
@keyframes blink { 50% { opacity: .25; } }

.win-glow { opacity: 0; }
.win-glow.on { animation: win 1.1s ease-out 3; }
@keyframes win { 0% { opacity: 0; } 30% { opacity: .38; } 100% { opacity: 0; } }

/* confetti from the centre of the wheel */
.confetti { position: absolute; left: 50%; top: 50%; width: 0; height: 0; z-index: 5; pointer-events: none; }
.confetti i {
  position: absolute; width: 9px; height: 14px; border-radius: 2px; opacity: 0;
  animation: burst 1.5s cubic-bezier(.15, .7, .3, 1) forwards;
}
@keyframes burst {
  0% { opacity: 1; transform: translate(0, 0) rotate(0) scale(.6); }
  70% { opacity: 1; }
  100% { opacity: 0; transform: translate(var(--dx), calc(var(--dy) + 120px)) rotate(var(--rot)) scale(1); }
}

.slot-label { font-weight: 800; paint-order: stroke; }
.hub {
  position: absolute; z-index: 2; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: 25%; height: 25%; border-radius: 50%; display: grid; place-items: center; overflow: hidden;
  background: radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--bg) 70%, #fff), var(--bg) 60%,
              color-mix(in srgb, var(--bg) 70%, #000));
  border: 3px solid var(--secondary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 70%, transparent),
              0 0 0 7px color-mix(in srgb, var(--bg) 80%, transparent),
              0 6px 18px rgba(0, 0, 0, .55), 0 0 28px color-mix(in srgb, var(--primary) 30%, transparent);
}
.hub > * { width: 78%; height: 78%; object-fit: contain; }
.hub canvas { width: 100%; height: 100%; }
#hub-default .crown { fill: var(--primary); }
#hub-default .gem-dot { fill: var(--secondary); }
#hub-default .gem, #hub-default .gem-line {
  fill: none; stroke: var(--secondary); stroke-width: 5; stroke-linejoin: round; stroke-linecap: round;
}
#hub-default .gem-line { stroke-width: 3.5; }

.message { min-height: 1.5em; margin: 6px 0 0; text-align: center; font-size: 15px; font-weight: 600; }
.message.error { color: #FF8A80; }

.actions { width: 100%; display: flex; flex-direction: column; gap: 10px; margin-top: 4px; }
.btn {
  display: flex; align-items: center; justify-content: center;
  width: 100%; border: 0; border-radius: 14px; padding: 14px 16px; cursor: pointer;
  font: inherit; font-size: 18px; font-weight: 800; transition: transform .08s, opacity .2s;
}
.btn:active:not(:disabled) { transform: scale(.98); }
.btn:disabled { opacity: .45; cursor: default; }
.btn.primary {
  position: relative; overflow: hidden; color: var(--text-dark);
  background: linear-gradient(180deg, color-mix(in srgb, var(--primary) 80%, #fff), var(--primary) 55%,
              color-mix(in srgb, var(--primary) 82%, #000));
  box-shadow: 0 6px 20px color-mix(in srgb, var(--primary) 35%, transparent), inset 0 -3px 0 rgba(0, 0, 0, .12);
}
.btn.primary:not(:disabled)::after {             /* a light sweeping across the main button */
  content: ""; position: absolute; inset: 0; transform: translateX(-120%);
  background: linear-gradient(100deg, transparent 30%, rgba(255, 255, 255, .55) 50%, transparent 70%);
  animation: sweep 3.2s ease-in-out infinite;
}
@keyframes sweep { 60%, 100% { transform: translateX(120%); } }
.btn.secondary { background: var(--secondary); color: var(--text-dark); font-size: 16px; }
.btn.ghost { background: transparent; color: var(--text); border: 1px solid color-mix(in srgb, var(--text) 30%, transparent);
  font-size: 15px; padding: 11px; }

.foot { width: 100%; display: flex; justify-content: space-between; margin-top: auto; padding-top: 8px; }
.link { display: inline-flex; align-items: center; background: none; border: 0; color: var(--text); opacity: .75; font: inherit; font-size: 15px; padding: 8px; cursor: pointer; }

.modal {
  position: fixed; inset: 0; z-index: 10; display: grid; place-items: center; padding: 16px;
  background: rgba(0, 0, 0, .6); backdrop-filter: blur(3px); animation: fade .2s ease-out;
}
.modal[hidden] { display: none; }
.card {
  width: min(100%, 380px); padding: 22px 18px 16px; border-radius: 22px; text-align: center;
  background: var(--bg); border: 2px solid var(--secondary);
  box-shadow: 0 20px 60px rgba(0, 0, 0, .6); animation: pop .35s cubic-bezier(.2, 1.4, .4, 1);
}
.card .big { font-size: 30px; font-weight: 800; color: var(--primary); line-height: 1.3; }
.card .text { margin: 10px 0 16px; font-size: 15px; line-height: 1.8; white-space: pre-line; }
.card .text b { color: var(--primary); }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { transform: scale(.7); opacity: 0; } }

@media (max-height: 620px) {
  :root { --wheel: min(80vw, 46vh); }
  .top h1 { font-size: 19px; margin-bottom: 4px; }
  .btn { padding: 11px; font-size: 16px; }
}
/* small stars twinkling in the background */
body::before {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: -2; opacity: .55;
  background-image:
    radial-gradient(1.5px 1.5px at 12% 18%, #fff, transparent), radial-gradient(1px 1px at 82% 12%, #fff, transparent),
    radial-gradient(1.5px 1.5px at 70% 78%, var(--primary), transparent), radial-gradient(1px 1px at 22% 72%, #fff, transparent),
    radial-gradient(1.2px 1.2px at 48% 8%, var(--secondary), transparent), radial-gradient(1px 1px at 92% 52%, #fff, transparent),
    radial-gradient(1.2px 1.2px at 6% 48%, var(--secondary), transparent), radial-gradient(1px 1px at 58% 94%, #fff, transparent);
  animation: twinkle 5s ease-in-out infinite alternate;
}
@keyframes twinkle { to { opacity: .2; } }

@media (prefers-reduced-motion: reduce) {
  .card, .modal, .halo, .bulbs *, body::before, .btn.primary::after { animation: none !important; }
}
