* { box-sizing: border-box; }

/* While the wheel spins (idle-spin / spin animation) the corners of the
   square rotor box stick out past the .wheel-wrap bounds — without locking
   overflow, some mobile browsers scroll/shift the page horizontally because
   of it. Locked at the root level so the page stays put (doesn't touch the
   visual layers). */
html {
  overflow-x: hidden;
  width: 100%;
}

body {
  margin: 0;
  overflow-x: hidden;
  width: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  /* Dark mystical void with a slow-pulsing green magic glow behind the wheel
     — matches the site's own dark navy/black + neon-green brand instead of
     a flat near-black or (previously) a desert sunset. */
  background: radial-gradient(circle at 50% 32%, #0f2b1a 0%, #0a1a10 45%, #050a06 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}

.widget {
  width: 620px;
  max-width: 96vw;
  padding: 30px 24px 36px;
  text-align: center;
  background: transparent;
  color: #fff;
  position: relative;
  z-index: 2;
}

/* Drifting magic fog — three soft blurred green blobs slowly swirling
   behind everything, for an "enchanted" atmosphere instead of a flat void. */
.bg-mist {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.bg-mist span {
  position: absolute;
  width: 55vw;
  height: 55vw;
  max-width: 640px;
  max-height: 640px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(34, 197, 94, 0.16) 0%, rgba(34, 197, 94, 0) 70%);
  filter: blur(20px);
  animation: mistDrift 22s ease-in-out infinite;
}

.bg-mist span:nth-child(1) { top: -10%; left: -12%; animation-duration: 26s; }
.bg-mist span:nth-child(2) { bottom: -14%; right: -10%; animation-duration: 30s; animation-delay: -8s; }
.bg-mist span:nth-child(3) { top: 40%; left: 60%; animation-duration: 24s; animation-delay: -15s; }

@keyframes mistDrift {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(4%, -6%) scale(1.15); }
}

/* Ambient background life — a field of slow-drifting embers/motes behind the
   widget so the page doesn't feel static even before the user touches
   anything. Populated by wheel.js (random left/size/delay per particle);
   this block only defines the shared look + the float animation. */
.bg-particles {
  position: fixed;
  inset: 0;
  z-index: 1;
  overflow: hidden;
  pointer-events: none;
}

/* Drifting brand bull-heads — cropped straight from the wordmark's own
   icon glyph (public/bull-head.png), not a generic dot/leaf — so the ambient
   background reads as "our mark, scattered" instead of unrelated bokeh. */
.bg-particles .bull {
  position: absolute;
  bottom: -5%;
  filter: drop-shadow(0 0 4px rgba(74, 222, 128, 0.55));
  animation: bullDrift linear infinite;
  opacity: 0;
}

/* Sun-lit dust motes — soft round puffs of trail dust, the majority of the
   field, with the bull-heads mixed in sparingly on top. */
/* Glowing magic sparkles — bright green motes with a twinkle pulse layered
   on top of the drift, instead of flat dust, for an "enchanted" feel. */
.bg-particles .dust {
  position: absolute;
  bottom: -5%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(200, 255, 220, 0.95), rgba(74, 222, 128, 0.35) 60%, transparent 100%);
  box-shadow: 0 0 6px rgba(74, 222, 128, 0.6);
  animation: bullDrift linear infinite, sparkleTwinkle 2.4s ease-in-out infinite;
  opacity: 0;
}

@keyframes sparkleTwinkle {
  0%, 100% { filter: brightness(0.7); }
  50% { filter: brightness(1.6); }
}

@keyframes bullDrift {
  0% { transform: translate(0, 0) scale(0.75) rotate(0deg); opacity: 0; }
  8% { opacity: var(--particle-opacity, 0.7); }
  50% { transform: translate(var(--drift-x, 12px), -52vh) scale(1) rotate(calc(var(--bull-rot, 120deg) * 0.5)); }
  92% { opacity: var(--particle-opacity, 0.7); }
  100% { transform: translate(calc(var(--drift-x, 12px) * 2), -108vh) scale(0.65) rotate(var(--bull-rot, 120deg)); opacity: 0; }
}

h1.brand-logo {
  margin: 0 0 10px;
  display: flex;
  justify-content: center;
  filter: drop-shadow(0 0 12px rgba(34, 197, 94, 0.55));
}

h1.brand-logo img {
  height: 64px;
  width: auto;
  display: block;
}

.subtitle {
  margin: 0 0 40px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.2px;
  color: #cfd6dc;
  text-shadow: 0 0 10px rgba(34, 197, 94, 0.35);
}

.step.hidden { display: none; }

/* Loading step — flex-centered within a fixed-ish min-height instead of the
   old fixed top margin on the spinner, which only centered it by accident on
   one specific viewport height and looked adrift/off-balance elsewhere. */
#loadingStep {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 360px;
}

/* #loadingStep (ID, specificity 1-0-0) would otherwise beat .step.hidden
   (0-2-0) and stay visible even with the "hidden" class added — this makes
   sure hidden always wins regardless of source order. */
#loadingStep.hidden {
  display: none;
}

/* Loading spinner — a plain spinning ring instead of a "Loading" label */
.spinner {
  width: 64px;
  height: 64px;
  border: 5px solid rgba(34, 197, 94, 0.15);
  border-top-color: #22c55e;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  filter: drop-shadow(0 0 12px rgba(34, 197, 94, 0.35));
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.error {
  color: #ff8080;
  font-size: 14px;
  line-height: 1.5;
  padding: 20px 8px;
}

button {
  position: relative;
  width: 100%;
  padding: 14px;
  border: 1px solid #22c55e;
  border-radius: 12px;
  /* Elite black + neon-green-edge button — dark body, the green lives in the
     border/glow, not as a flat fill. */
  background: linear-gradient(344deg, #0d1712, #16241c);
  color: #4ade80;
  font-weight: 800;
  font-size: 16px;
  letter-spacing: 1px;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(34, 197, 94, 0.3), inset 0 1px 0 rgba(255,255,255,0.08);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

button:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(34, 197, 94, 0.45), inset 0 1px 0 rgba(255,255,255,0.08);
}

button:active:not(:disabled) {
  transform: translateY(0);
}

button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  box-shadow: none;
}

/* SPIN button — set apart from the other buttons (Close, Go to Game, etc.)
   with a VIP/embossed-coin feel (layered gradient + inner/outer shadow) and
   a continuous sweeping shine, to give it a "premium" feel.

   IMPORTANT: Chromium excludes the rounded-off corners of a border-radius
   box from hit-testing (clicks there fall through to whatever's behind) —
   confirmed by testing (corners missed, center/edges worked). So the actual
   <button> element stays a full RECTANGLE (no border-radius) for 100%
   clickable area everywhere, including corners. The rounded gold look comes
   from .spin-btn-bg, a child layer with its own border-radius — purely
   visual, doesn't shrink the real click target. */
#spinBtn {
  border: none;
  border-radius: 0;
  background: none;
  box-shadow: none;
  padding: 16px;
  font-size: 17px;
  letter-spacing: 1.8px;
  /* Without this, #spinBtn has no z-index of its own, so its z-indexed
     children (.spin-btn-bg at -1, the loading ::before/::after at 0) don't
     get compared against EACH OTHER in a contained local stack — they get
     hoisted up and compared against whatever else on the page happens to
     have a z-index, which can produce visible seams/gaps. isolation:isolate
     forces a real local stacking context so these layers only ever stack
     against each other. */
  isolation: isolate;
}

.spin-btn-bg {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: 14px;
  /* Clips the shine sweep (::before below) to the rounded shape — this
     CANNOT live on #spinBtn itself (that would bring back the corner
     click-through bug), so it's on this purely-decorative child instead.
     Without it, the sweep's translateX(-130%→130%) carries it outside the
     button's silhouette and it renders as a stray diagonal streak floating
     in the page next to the button (reported bug, confirmed via screenshot). */
  overflow: hidden;
  /* Deep emerald-to-black, not a pale mint highlight — a sharper, more
     "aggressive" primary CTA instead of a soft pastel one. */
  background: linear-gradient(165deg, #4ade80 0%, #16a34a 30%, #0d1712 100%);
  box-shadow:
    0 10px 34px rgba(34, 197, 94, 0.55),
    inset 0 2px 0 rgba(255, 255, 255, 0.35),
    inset 0 -4px 10px rgba(0, 0, 0, 0.5),
    0 0 0 1px rgba(74, 222, 128, 0.5);
  pointer-events: none;
}

.spin-btn-label {
  position: relative;
  /* White, not the base button's green text — the button's own gradient
     already carries the green, white text stays legible across all of it
     (including the near-black bottom-right corner) and reads as sharper. */
  color: #ffffff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
}

.spin-btn-bg::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, transparent 35%, rgba(255, 255, 255, 0.6) 50%, transparent 65%);
  transform: translateX(-130%);
  animation: btnShine 3.4s ease-in-out infinite;
  pointer-events: none;
}

@keyframes btnShine {
  0%, 25% { transform: translateX(-130%); }
  65%, 100% { transform: translateX(130%); }
}

#spinBtn:hover:not(:disabled) .spin-btn-bg {
  box-shadow:
    0 14px 40px rgba(34, 197, 94, 0.7),
    inset 0 2px 0 rgba(255, 255, 255, 0.4),
    inset 0 -4px 10px rgba(0, 0, 0, 0.5),
    0 0 0 1px rgba(74, 222, 128, 0.65);
}

#spinBtn:hover:not(:disabled) {
  transform: translateY(-2px) scale(1.008);
}

#spinBtn:active:not(:disabled) {
  transform: translateY(0) scale(0.99);
}

#spinBtn:disabled .spin-btn-bg {
  box-shadow: none;
}

#spinBtn:disabled .spin-btn-bg::before {
  display: none;
}

/* The button is also disabled while spinning (to prevent double-clicks), but
   that's exactly the moment it should look most alive — we cancel the
   generic button:disabled dimming (opacity 0.4) here so it stays bright and
   pulsing until the spin finishes. */
#spinBtn:disabled.spinning {
  opacity: 1;
}

/* A large, high-contrast spinner (gold on a dark backdrop) shown on the
   button while checking status (cooldown/restriction) or waiting for the
   spin result — the old one was thin/dark-on-dark and nearly invisible
   against the gold background. */
#spinBtn.loading {
  color: transparent;
  pointer-events: none;
}

/* A dark medallion (backdrop) instead of the shine — the spinner ring sits
   ON TOP of it, staying clearly visible instead of disappearing into the
   gold background. */
#spinBtn.loading::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  /* Was 42px around a 26px ring — an 8px gap of bare dark backdrop on every
     side made it read as "big dark blob with a tiny ring adrift inside",
     not one cohesive spinner. Tightened to a ~4px halo around the ring. */
  width: 34px;
  height: 34px;
  margin: -17px 0 0 -17px;
  background: radial-gradient(circle, rgba(10, 12, 8, 0.62), rgba(10, 12, 8, 0.42) 70%, transparent 100%);
  border-radius: 50%;
  animation: none;
  transform: none;
  z-index: 0;
}

#spinBtn.loading::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 28px;
  height: 28px;
  margin: -14px 0 0 -14px;
  /* The dim part of the ring was only 30% opacity — against the dark
     medallion, that read as barely-there, so any frozen frame looked like a
     bright crescent floating off-center rather than a full ring with one
     bright highlight. Raised so the full circle stays legible at rest. */
  border: 3px solid rgba(255, 243, 224, 0.55);
  border-top-color: #fff3e0;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  z-index: 1;
}

.wheel-wrap {
  position: relative;
  /* Full container width (matches the SPIN button and title exactly) instead
     of a fixed 560px — a fixed value left a 6px gap on each side versus the
     button/title (which are 100% width), so the wheel's edges didn't line up
     with them. Percentage width also means: on narrow viewports (mobile
     iframe) it naturally shrinks with the container, and aspect-ratio keeps
     the height in lockstep so the wheel never looks oval/squashed. */
  width: 100%;
  aspect-ratio: 1 / 1;
  margin: 34px auto 28px;
  /* A slow, subtle breathing scale on the whole assembly — reads as "idle
     but alive" at rest, distinct from (and independent of) the wheel's own
     rotation, which lives on .wheel-rotor's transform and isn't touched
     here. Paused during an active spin (see .wheel-wrap.spinning below) so
     it doesn't fight the impact-shake or make the fast spin look wobbly. */
  animation: wrapBreathe 4.5s ease-in-out infinite;
}

.wheel-wrap.spinning {
  animation: none;
}

@keyframes wrapBreathe {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.012); }
}

/* Static glass-dome highlight — a fixed reflection arc (NOT rotating, per
   design direction: the wheel previously had an independently-rotating
   light sweep that was deliberately removed) sitting above the segments but
   below the pointer/hub, for a glossy/premium "under glass" feel without
   reintroducing motion that competes with the actual spin. */
.wheel-gloss {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  z-index: 2;
  pointer-events: none;
  background: linear-gradient(
    122deg,
    rgba(255, 255, 255, 0.32) 0%,
    rgba(255, 255, 255, 0.1) 16%,
    transparent 30%,
    transparent 68%,
    rgba(255, 255, 255, 0.05) 84%,
    rgba(255, 255, 255, 0.14) 100%
  );
  mix-blend-mode: screen;
}

/* The old asymmetric conic "light-rays" made a blotchy shadow in the background — removed. */
.light-rays {
  display: none;
}

/* A single, even, soft gold halo — wraps the wheel symmetrically, no blotches */
.wheel-glow {
  position: absolute;
  inset: -28px;
  border-radius: 50%;
  background: radial-gradient(
    circle,
    rgba(34, 197, 94, 0.22) 0%,
    rgba(34, 197, 94, 0.06) 48%,
    transparent 70%
  );
  filter: blur(26px);
  animation: pulse 4.5s ease-in-out infinite;
  z-index: 0;
}

@keyframes pulse {
  0%, 100% { opacity: 0.55; transform: scale(1); }
  50% { opacity: 0.8; transform: scale(1.025); }
}

.wheel-glow.active {
  animation: pulseFast 0.5s ease-in-out infinite;
}

@keyframes pulseFast {
  0%, 100% { opacity: 0.7; transform: scale(1.02); }
  50% { opacity: 1; transform: scale(1.12); }
}

#spinBtn.spinning {
  animation: btnPulse 0.6s ease-in-out infinite;
}

@keyframes btnPulse {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.25); }
}

/* Faceted magic-gem pointer — a glowing green crystal shard in a gold claw
   setting, matching the mystical brand theme. The outer container
   (.pointer) only fixes the POSITION; the actual visual and spin animation
   live in the inner .pointer-shape — the "catch on segment boundary" effect
   (see wheel.js) rotates only the inner piece like a hinge at the top,
   without disturbing the position. */
.pointer {
  position: absolute;
  top: -6%;
  left: 50%;
  width: 15%;
  height: 17%;
  transform: translateX(-50%);
  z-index: 4;
}

.pointer-shape {
  position: relative;
  width: 100%;
  height: 100%;
  transform-origin: 50% 0%;
  /* Visuals (facet gradient, gold claw setting, facet lines, drop shadow)
     live in the child <svg> — a faceted emerald-cut crystal, bright at the
     top-left facet fading to deep green at the tip. */
  filter:
    drop-shadow(0 4px 8px rgba(0, 0, 0, 0.55))
    drop-shadow(0 0 12px rgba(74, 222, 128, 0.9))
    drop-shadow(0 0 26px rgba(34, 197, 94, 0.55));
}

.pointer-shape svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.wheel-rotor {
  position: absolute;
  inset: 0;
  z-index: 1;
}

.wheel-rotor.idle-spin {
  animation: idleRotate 26s linear infinite;
}

@keyframes idleRotate {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

#wheelCanvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  /* Polished dark obsidian frame (not the old bronze/wood) — a black
     enchanted stone with a faint jade sheen, so the glowing sigil ring
     (.wheel-ring) reads as etched INTO the stone rather than sitting on
     warm wood. Gold rivets (drawn on the canvas) pop harder against this
     cooler, darker base too. */
  /* Widened from 14px so the sigil ring (.wheel-ring) has its own band to
     sit in — at 14px it overlapped the segment labels. */
  border: 26px solid transparent;
  background-image:
    linear-gradient(#0d1712, #0d1712),
    linear-gradient(344deg, #060907 0%, #16241c 28%, #2f4d3c 50%, #16241c 72%, #060907 100%);
  background-origin: border-box;
  background-clip: content-box, border-box;
  box-shadow:
    0 0 0 2px #0f0906,
    0 0 0 5px rgba(74, 222, 128, 0.35),
    0 14px 50px rgba(0,0,0,0.6),
    inset 0 0 46px rgba(0,0,0,0.6),
    inset 0 3px 10px rgba(255,255,255,0.12);
}


/* Glowing sigil ring etched into the frame — alternating rune glyphs and
   tiny crystal facets on a pulsing circuit line, echoing the hub's rune
   dial and the pointer's gem instead of a plain woven rope. Lives inside
   .wheel-rotor so it spins together with the frame (which already rotates
   as one piece), not pinned in place against a spinning ring behind it. */
.wheel-ring {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
  pointer-events: none;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.5));
}

/* Strike-on-landing flash: a white/amber flash over the wheel + a jolt on
   the (non-rotating) wrap + an intensified glow on the pointer horn — plays
   right before the result modal opens, so the win reads as "struck". */
.strike-flash {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  pointer-events: none;
  z-index: 6;
  background: radial-gradient(circle, rgba(255,255,255,0.95) 0%, rgba(74, 222, 128, 0.75) 40%, rgba(34, 197, 94, 0) 75%);
  opacity: 0;
}

.strike-flash.active {
  animation: lightningFlash 0.45s ease-out;
}

@keyframes lightningFlash {
  0% { opacity: 0; }
  6% { opacity: 1; }
  14% { opacity: 0.15; }
  22% { opacity: 0.85; }
  35% { opacity: 0; }
  100% { opacity: 0; }
}

/* Shakes the WRAP (not .wheel-rotor) — the rotor's transform is the wheel's
   actual landed rotation, set directly via JS; animating transform on it
   here would fight that and snap the wheel off its landed angle. */
.wheel-wrap.impact {
  animation: impactShake 0.4s ease-out;
}

/* Kıvılcım patlaması — strikeLightning() ile aynı anda wheel.js tarafından
   pointer ucuna üretilip eklenen kısa ömürlü .spark elemanları. Her biri
   kendi --dx/--dy açı/mesafesiyle dışa doğru fırlayıp söner. */
.spark {
  position: absolute;
  top: 2%;
  left: 50%;
  width: 6px;
  height: 6px;
  margin: -3px 0 0 -3px;
  border-radius: 50%;
  background: radial-gradient(circle, #ffffff, #4ade80 60%, transparent 100%);
  box-shadow: 0 0 8px rgba(74, 222, 128, 0.9);
  pointer-events: none;
  z-index: 5;
  animation: sparkFly 0.6s ease-out forwards;
}

@keyframes sparkFly {
  0% { transform: translate(0, 0) scale(1); opacity: 1; }
  100% { transform: translate(var(--dx), var(--dy)) scale(0.3); opacity: 0; }
}

@keyframes impactShake {
  0%, 100% { transform: translate(0, 0); }
  15% { transform: translate(-6px, 3px); }
  30% { transform: translate(5px, -4px); }
  45% { transform: translate(-4px, 2px); }
  60% { transform: translate(3px, -2px); }
  75% { transform: translate(-2px, 1px); }
  90% { transform: translate(1px, 0); }
}

/* Filter-only (not transform) — .pointer-shape's transform is driven
   directly via JS for the segment-catch tick, so this only touches filter. */
.pointer-shape.strike {
  animation: hornStrike 0.4s ease-out;
}

@keyframes hornStrike {
  0%, 100% {
    filter:
      drop-shadow(0 4px 8px rgba(0, 0, 0, 0.55))
      drop-shadow(0 0 12px rgba(74, 222, 128, 0.9))
      drop-shadow(0 0 26px rgba(34, 197, 94, 0.55));
  }
  25% {
    filter:
      drop-shadow(0 4px 8px rgba(0, 0, 0, 0.55))
      drop-shadow(0 0 18px rgba(255, 255, 255, 1))
      drop-shadow(0 0 60px rgba(74, 222, 128, 1))
      drop-shadow(0 0 100px rgba(34, 197, 94, 0.8));
  }
}

/* Flickering green magic flame ring around the center logo — sized larger
   than .hub (44% vs 25% of .wheel-wrap) so the flames root right at the
   hub's edge and lick outward. Sits just under .hub in z-index so the hub
   disc covers the flames' base/attach points cleanly. */
.hub-flame {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 44%;
  height: 44%;
  transform: translate(-50%, -50%);
  z-index: 2;
  pointer-events: none;
}

.hub {
  position: absolute;
  top: 50%;
  left: 50%;
  /* Used to be a fixed px value (140px) — when .wheel-wrap narrowed on small
     screens (mobile iframe), the hub didn't shrink proportionally and
     overlapped the segment labels. Percentage-based like everything else
     (canvas, pointer, gems): 140/560 = 25%. */
  width: 25%;
  height: 25%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  /* The frame rings we used to add (three-color, then a single gold one)
     overlapped logo.png's OWN ring and produced a "crooked/double edge"
     feel. Now there are no extra rings at all — just the logo with its own
     ring, plus a subtle shadow and nothing else. */
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5);
  z-index: 3;
  animation: hubBreathe 3.2s ease-in-out infinite;
}

/* Idle "alive" cue on the center logo — a slow breathing glow ring, distinct
   from the wheel's own pulse (.wheel-glow) so the hub doesn't read as inert
   while the rest of the wheel is animated. */
@keyframes hubBreathe {
  0%, 100% { box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5), 0 0 0 0 rgba(74, 222, 128, 0.35); }
  50% { box-shadow: 0 4px 18px rgba(0, 0, 0, 0.5), 0 0 0 8px rgba(74, 222, 128, 0); }
}

.hub img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.cooldown {
  font-size: 13px;
  color: #a9adc1;
  margin-top: 14px;
}

.modal {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(4, 5, 12, 0.78);
  backdrop-filter: blur(8px);
  border-radius: 20px;
  opacity: 0;
  animation: modalFadeIn 0.3s ease forwards;
}

.modal.hidden {
  display: none !important;
}

@keyframes modalFadeIn {
  to { opacity: 1; }
}

#confettiCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
}

.modal-card {
  position: relative;
  width: 84%;
  padding: 30px 24px 24px;
  text-align: center;
  background: linear-gradient(160deg, #14201a, #05100a);
  border: 1px solid rgba(34, 197, 94, 0.4);
  border-radius: 18px;
  box-shadow: 0 24px 60px rgba(0,0,0,0.6), 0 0 50px rgba(34, 197, 94, 0.15);
  transform: scale(0.6);
  opacity: 0;
  animation: cardPopIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) 0.1s forwards;
}

@keyframes cardPopIn {
  to { transform: scale(1); opacity: 1; }
}

/* No-win (Try Again) screen — DELIBERATELY muted/neutral compared to the win
   screen: matte silver instead of a gold border, no confetti/burst. Meant to
   read as a clean "info screen" without implying a victory. */
.modal-card--nowin {
  border-color: rgba(199, 206, 222, 0.25);
  box-shadow: 0 24px 60px rgba(0,0,0,0.6), 0 0 40px rgba(199, 206, 222, 0.06);
}

.modal-card--nowin .burst {
  display: none;
}

/* Slowly rotating light-ray beams behind the win card — a "jackpot" cue that
   sits BEHIND everything else in the card (z-index 0, same layer as .burst)
   so text/buttons stay fully legible on top of it. Hidden on the no-win
   screen along with .burst — same "no implied victory" rule. */
.win-rays {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 340px;
  height: 340px;
  transform: translate(-50%, -50%);
  z-index: 0;
  pointer-events: none;
  opacity: 0.5;
  background: repeating-conic-gradient(
    rgba(74, 222, 128, 0.22) 0deg 6deg,
    transparent 6deg 24deg
  );
  animation: raysRotate 14s linear infinite;
  -webkit-mask-image: radial-gradient(circle, black 15%, transparent 68%);
  mask-image: radial-gradient(circle, black 15%, transparent 68%);
}

.modal-card--nowin .win-rays {
  display: none;
}

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

.burst {
  position: absolute;
  top: 62px;
  left: 50%;
  width: 200px;
  height: 200px;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, rgba(34, 197, 94, 0.4), transparent 70%);
  z-index: 0;
  animation: burstPulse 1.8s ease-out infinite;
}

@keyframes burstPulse {
  0% { opacity: 0.9; transform: translate(-50%, -50%) scale(0.5); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(1.5); }
}

.prize-icon {
  position: relative;
  width: 72px;
  height: 72px;
  margin: 0 auto 14px;
  border-radius: 50%;
  /* Black chrome medallion with a green glow ring — not a solid green disc. */
  background: radial-gradient(circle at 35% 30%, #4b525a, #1a1d21 70%, #150e09 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.35), 0 0 24px rgba(34, 197, 94, 0.3), 0 8px 24px rgba(0,0,0,0.5);
  animation: iconBounce 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) 0.2s both;
}

.modal-card--nowin .prize-icon {
  background: radial-gradient(circle at 35% 30%, #3d4759, #262e3c 60%, #171d27 100%);
  box-shadow: 0 0 0 4px rgba(199, 206, 222, 0.12), 0 8px 24px rgba(0,0,0,0.4);
}

@keyframes iconBounce {
  0% { transform: scale(0); }
  70% { transform: scale(1.18); }
  100% { transform: scale(1); }
}

.result-title {
  position: relative;
  font-size: 26px;
  font-weight: 800;
  color: #4ade80;
  margin: 0 0 8px;
  text-shadow: 0 0 20px rgba(74, 222, 128, 0.5);
}

.modal-card--nowin .result-title {
  color: #d7dceb;
  text-shadow: none;
}

.result-text {
  position: relative;
  font-size: 21px;
  font-weight: 700;
  margin-bottom: 4px;
}

.result-text.hidden {
  display: none;
}

.result-subtext {
  position: relative;
  font-size: 14px;
  line-height: 1.5;
  color: #a9adc1;
  margin: 0 0 18px;
  /* Lets a literal \n\n in the no-win message render as a paragraph break
     (title + tagline, blank line, then the Telegram lead-in) without
     resorting to innerHTML/<br>. */
  white-space: pre-line;
}

.result-subtext.hidden {
  display: none;
}

.game-name {
  position: relative;
  font-size: 14px;
  font-weight: 600;
  color: #a9adc1;
  margin: 0 0 16px;
}

.game-name.hidden {
  display: none;
}

.game-link {
  position: relative;
  display: block;
  width: 100%;
  padding: 14px;
  margin-bottom: 10px;
  border-radius: 12px;
  background: linear-gradient(135deg, #4ade80, #22c55e);
  color: #3d1f0a;
  font-weight: 800;
  font-size: 15px;
  letter-spacing: 0.5px;
  text-decoration: none;
  box-shadow: 0 8px 24px rgba(34, 197, 94, 0.35);
}

.game-link.hidden {
  display: none;
}

.game-link.disabled {
  opacity: 0.5;
  pointer-events: none;
}

/* Telegram brand blue — deliberately different from the other action buttons
   (gold/green) to give a "this is a separate channel" feel. It's the main
   CTA on the no-win screen, so it's a bit more prominent (icon + label, centered). */
.telegram-link {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 14px;
  margin-bottom: 10px;
  border-radius: 12px;
  background: linear-gradient(135deg, #2AABEE, #229ED9);
  color: #fff;
  font-weight: 800;
  font-size: 15px;
  letter-spacing: 0.5px;
  text-decoration: none;
  box-shadow: 0 8px 24px rgba(42, 171, 238, 0.4), inset 0 1px 0 rgba(255,255,255,0.25);
}

.telegram-link svg {
  flex-shrink: 0;
}

.telegram-link.hidden {
  display: none;
}

.secondary-btn {
  position: relative;
  width: 100%;
  /* 12px was slightly under the ~44px minimum recommended touch target
     height (measured 41px) — bumped to match the other action buttons. */
  padding: 14px;
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 12px;
  background: transparent;
  color: #a9adc1;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  box-shadow: none;
}

.secondary-btn:hover {
  background: rgba(255,255,255,0.06);
  transform: none;
  box-shadow: none;
}

.secondary-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.secondary-btn:disabled:hover {
  background: transparent;
}
