/* ==========================================================================
   Spin & Win — wheel popup styles
   --------------------------------------------------------------------------
   Palette: red, white, black and blue only. Everything is scoped under
   `.spin-wheel` so it cannot leak into the Startup Singam page styles.
   No global resets, no :root overrides.
   ========================================================================== */

.spin-wheel,
.spin-wheel__overlay {
  --sw-red:        #e01b24;
  --sw-red-deep:   #8e1119;
  --sw-red-soft:   rgba(224, 27, 36, 0.22);
  --sw-white:      #ffffff;
  --sw-black:      #0b0b12;
  --sw-blue:       #1b57c4;
  --sw-blue-deep:  #0e2a5c;
  --sw-blue-soft:  rgba(27, 87, 196, 0.28);
  --sw-line:       rgba(255, 255, 255, 0.14);
  --sw-muted:      rgba(255, 255, 255, 0.66);

  --sw-radius:     28px;
  --sw-ease-out:   cubic-bezier(0.22, 1, 0.36, 1);
  --sw-spin-time:  4.2s;

  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--sw-white);
  -webkit-font-smoothing: antialiased;
}

/* --------------------------------------------------------------------------
   Floating trigger
   Sits bottom-left: the site's own chat button and its Watch/Vote bar already
   occupy the bottom-right corner.
   -------------------------------------------------------------------------- */
.spin-wheel__trigger {
  position: fixed;
  left: 20px;
  bottom: 20px;
  z-index: 10040;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 13px 22px 13px 16px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 999px;
  background: linear-gradient(135deg, #e01b24 0%, #8e1119 100%);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.01em;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5), 0 0 0 4px rgba(224, 27, 36, 0.12);
  cursor: pointer;
  transition: transform 0.18s var(--sw-ease-out), box-shadow 0.18s var(--sw-ease-out);
}
.spin-wheel__trigger:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.55), 0 0 0 6px rgba(224, 27, 36, 0.2);
}
.spin-wheel__trigger:active { transform: translateY(0); }
.spin-wheel__trigger:focus-visible { outline: 3px solid var(--sw-white); outline-offset: 3px; }
.spin-wheel__trigger svg { width: 22px; height: 22px; flex: 0 0 auto; }

/* --------------------------------------------------------------------------
   Overlay + dialog
   -------------------------------------------------------------------------- */
.spin-wheel__overlay {
  position: fixed;
  inset: 0;
  z-index: 10050;
  display: grid;
  place-items: center;
  padding: 24px 16px;
  overflow-y: auto;
  /* No backdrop-filter here: it re-blurs the rotating wheel on every frame
     and drags the frame rate down on modest hardware, which reads as a
     stuttering, slow spin. The scrim alone gives the same separation. */
  background:
    radial-gradient(120% 90% at 50% 0%, rgba(27, 87, 196, 0.34) 0%, rgba(6, 6, 12, 0.92) 68%);
  animation: sw-fade 0.24s ease-out;
}
@keyframes sw-fade { from { opacity: 0; } to { opacity: 1; } }

/* The overlay carries `display: grid` for centring, which outranks the UA's
   `[hidden] { display: none }` rule — so the hidden state has to be restated
   explicitly or the wheel sits on top of the page from the first paint. */
.spin-wheel__overlay[hidden] { display: none; }

.spin-wheel__dialog {
  position: relative;
  width: 100%;
  max-width: 540px;
  max-height: 94vh;
  overflow-y: auto;
  padding: 30px 26px 26px;
  border-radius: var(--sw-radius);
  border: 1px solid rgba(255, 255, 255, 0.12);
  background:
    radial-gradient(130% 100% at 50% 0%, rgba(224, 27, 36, 0.30) 0%, rgba(14, 42, 92, 0) 58%),
    linear-gradient(180deg, #101018 0%, #08080d 62%, #050508 100%);
  box-shadow:
    0 40px 90px rgba(0, 0, 0, 0.7),
    0 0 0 1px rgba(224, 27, 36, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  animation: sw-rise 0.3s var(--sw-ease-out);
}
@keyframes sw-rise {
  from { opacity: 0; transform: translateY(16px) scale(0.97); }
  to   { opacity: 1; transform: none; }
}

/* When GSAP drives the entrance it owns the transform outright. */
.spin-wheel--gsap { animation: none; }
.spin-wheel--gsap .spin-wheel__dialog { animation: none; }

.spin-wheel__close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 1px solid var(--sw-line);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.07);
  color: var(--sw-white);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.16s, transform 0.16s var(--sw-ease-out);
}
.spin-wheel__close:hover { background: var(--sw-red); border-color: var(--sw-red); transform: scale(1.06); }
.spin-wheel__close:focus-visible { outline: 3px solid var(--sw-white); outline-offset: 2px; }

.spin-wheel__sound {
  position: absolute;
  top: 14px;
  right: 60px;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 1px solid var(--sw-line);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.07);
  color: var(--sw-white);
  cursor: pointer;
  transition: background 0.16s, color 0.16s, transform 0.16s var(--sw-ease-out);
}
.spin-wheel__sound:hover { background: var(--sw-blue); border-color: var(--sw-blue); transform: scale(1.06); }
.spin-wheel__sound:focus-visible { outline: 3px solid var(--sw-white); outline-offset: 2px; }
.spin-wheel__sound[aria-pressed="true"] { color: rgba(255, 255, 255, 0.4); }

.spin-wheel__heading {
  margin: 0 0 6px;
  text-align: center;
  font-size: 32px;
  font-weight: 900;
  letter-spacing: -0.03em;
  line-height: 1.05;
  color: var(--sw-white);
  text-shadow: 0 4px 30px rgba(224, 27, 36, 0.45);
}
.spin-wheel__eyebrow {
  margin: 0 0 18px;
  text-align: center;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--sw-red);
}

/* --------------------------------------------------------------------------
   Wheel stage
   -------------------------------------------------------------------------- */
.spin-wheel__stage {
  position: relative;
  width: 100%;
  /* Shrink on short viewports so the whole wheel stays visible above the
     fold; floor at 300px so it never becomes unreadably small. */
  max-width: max(300px, min(440px, calc(94vh - 340px)));
  margin: 0 auto;
  aspect-ratio: 1 / 1;
}
/* Red and blue bloom behind the wheel so it reads as a lit object. */
.spin-wheel__stage::before {
  content: '';
  position: absolute;
  inset: -14%;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 42%, rgba(224, 27, 36, 0.30) 0%, rgba(27, 87, 196, 0.18) 44%, transparent 70%);
  pointer-events: none;
}

.spin-wheel__rotor {
  position: absolute;
  inset: 0;
  transform: rotate(0deg);
  will-change: transform;
}
/* The CSS transition is only the no-GSAP fallback; GSAP animates the rotor
   itself. If a transition is left on while GSAP writes the transform every
   frame, the browser smooths each write and the wheel looks like it is
   lagging at low speed. */
.spin-wheel--fallback .spin-wheel__rotor {
  transition: transform var(--sw-spin-time) var(--sw-ease-out);
}
.spin-wheel__rotor svg { display: block; width: 100%; height: 100%; }

.spin-wheel__pointer {
  position: absolute;
  top: -14px;
  left: 50%;
  margin-left: -19px;
  z-index: 3;
  width: 38px;
  height: 48px;
  transform-origin: 50% 12%;
  /* A drop-shadow filter here would re-rasterise the clipped triangle on
     every frame of the spin; the shadow is painted as a plain layer instead. */
  filter: none;
}
.spin-wheel__pointer::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(160deg, #ff5560 0%, #e01b24 45%, #8e1119 100%);
  clip-path: polygon(50% 100%, 0 24%, 10% 7%, 50% 0, 90% 7%, 100% 24%);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.55);
}
.spin-wheel__pointer::after {
  content: '';
  position: absolute;
  left: 6px;
  right: 6px;
  top: 7px;
  bottom: 0;
  background: linear-gradient(160deg, #15151f 0%, #0b0b12 100%);
  clip-path: polygon(50% 100%, 0 22%, 50% 0, 100% 22%);
}

.spin-wheel__hub {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 4;
  transform: translate(-50%, -50%);
  width: 25%;
  aspect-ratio: 1 / 1;
  border: 0;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 30%, #1a1a24 0%, #0b0b12 70%);
  color: var(--sw-white);
  font-size: clamp(11px, 2.4vw, 15px);
  font-weight: 900;
  letter-spacing: 0.2em;
  text-indent: 0.2em;
  cursor: pointer;
  box-shadow: 0 0 0 2px var(--sw-red), 0 10px 24px rgba(0, 0, 0, 0.55);
  transition: transform 0.18s var(--sw-ease-out), box-shadow 0.18s var(--sw-ease-out);
}
.spin-wheel__hub:hover:not(:disabled) {
  transform: translate(-50%, -50%) scale(1.05);
  box-shadow: 0 0 0 2px var(--sw-red), 0 0 30px rgba(224, 27, 36, 0.5), 0 12px 28px rgba(0, 0, 0, 0.6);
}
.spin-wheel__hub:active:not(:disabled) { transform: translate(-50%, -50%) scale(0.97); }
.spin-wheel__hub:disabled { opacity: 0.55; cursor: default; }
.spin-wheel__hub:focus-visible { outline: 3px solid var(--sw-white); outline-offset: 4px; }

.spin-wheel__spark {
  position: absolute;
  z-index: 5;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
  pointer-events: none;
}

/* --------------------------------------------------------------------------
   Result card
   -------------------------------------------------------------------------- */
.spin-wheel__card {
  margin: 22px auto 0;
  padding: 22px 22px 24px;
  max-width: 420px;
  text-align: center;
  border-radius: 20px;
  border: 1px solid var(--sw-line);
  border-top: 3px solid var(--sw-red);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.08) 0%, rgba(255, 255, 255, 0.02) 100%);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}
.spin-wheel__card-label {
  margin: 0 0 8px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--sw-red);
}
.spin-wheel__card-title {
  margin: 0 0 8px;
  font-size: clamp(26px, 5.2vw, 34px);
  font-weight: 900;
  letter-spacing: -0.025em;
  line-height: 1.08;
  color: var(--sw-white);
}
.spin-wheel__card-title--win {
  background: linear-gradient(180deg, #ffffff 0%, #bcd2ff 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 6px 26px rgba(27, 87, 196, 0.45);
}
.spin-wheel__card-title--none { color: var(--sw-muted); }
.spin-wheel__card-sub {
  margin: 0;
  font-size: 14px;
  line-height: 1.55;
  color: var(--sw-muted);
}
.spin-wheel__card-sub strong { color: var(--sw-white); font-weight: 700; }

/* --------------------------------------------------------------------------
   Form
   -------------------------------------------------------------------------- */
.spin-wheel__form {
  margin: 20px auto 0;
  max-width: 420px;
}
.spin-wheel__form-title {
  margin: 0 0 14px;
  text-align: center;
  font-size: 15px;
  font-weight: 700;
  color: var(--sw-white);
}
.spin-wheel__row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.spin-wheel__field { display: flex; flex-direction: column; gap: 6px; }
.spin-wheel__field--wide { grid-column: 1 / -1; }
.spin-wheel__field label {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.7);
}
.spin-wheel__req { color: var(--sw-red); }
.spin-wheel__field input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--sw-line);
  background: rgba(255, 255, 255, 0.06);
  color: var(--sw-white);
  font: inherit;
  font-size: 15px;
  transition: border-color 0.16s, box-shadow 0.16s, background 0.16s;
}
.spin-wheel__field input::placeholder { color: rgba(255, 255, 255, 0.34); }
.spin-wheel__field input:focus {
  outline: none;
  border-color: var(--sw-blue);
  background: rgba(27, 87, 196, 0.12);
  box-shadow: 0 0 0 3px rgba(27, 87, 196, 0.28);
}
.spin-wheel__field input[aria-invalid="true"] {
  border-color: var(--sw-red);
  box-shadow: 0 0 0 3px rgba(224, 27, 36, 0.22);
}
.spin-wheel__error {
  min-height: 15px;
  font-size: 12px;
  font-weight: 600;
  color: #ff8a8a;
}
.spin-wheel__hp {
  position: absolute !important;
  left: -9999px !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
}
.spin-wheel__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}
.spin-wheel__btn {
  flex: 1 1 auto;
  min-height: 48px;
  padding: 12px 20px;
  border-radius: 999px;
  border: 1px solid transparent;
  font: inherit;
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.16s var(--sw-ease-out), box-shadow 0.16s, background 0.16s, opacity 0.16s;
}
.spin-wheel__btn:hover { transform: translateY(-1px); }
.spin-wheel__btn:active { transform: translateY(0); }
.spin-wheel__btn:focus-visible { outline: 3px solid var(--sw-white); outline-offset: 2px; }
.spin-wheel__btn--primary {
  background: linear-gradient(135deg, #ff4d57 0%, #e01b24 45%, #b0161e 100%);
  color: #fff;
  box-shadow: 0 12px 26px rgba(224, 27, 36, 0.3);
}
.spin-wheel__btn--primary:hover { box-shadow: 0 16px 34px rgba(224, 27, 36, 0.42); }
.spin-wheel__btn--ghost {
  background: rgba(27, 87, 196, 0.18);
  border-color: rgba(27, 87, 196, 0.6);
  color: var(--sw-white);
}
.spin-wheel__btn--ghost:hover { background: rgba(27, 87, 196, 0.32); }
.spin-wheel__btn[disabled] { opacity: 0.55; cursor: default; transform: none; }

.spin-wheel__status {
  margin: 12px 0 0;
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  color: var(--sw-muted);
}
.spin-wheel__status--ok { color: #8fd0ff; }
.spin-wheel__status--fail { color: #ff8a8a; }
.spin-wheel__manual {
  margin: 10px 0 0;
  font-size: 12px;
  text-align: center;
  color: var(--sw-muted);
}
.spin-wheel__manual button {
  border: 0;
  background: none;
  padding: 0;
  color: var(--sw-blue);
  font: inherit;
  font-weight: 700;
  text-decoration: underline;
  cursor: pointer;
}
.spin-wheel__live {
  position: absolute !important;
  left: -9999px !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* --------------------------------------------------------------------------
   Small screens
   -------------------------------------------------------------------------- */
@media (max-width: 520px) {
  .spin-wheel__dialog { padding: 24px 18px 20px; }
  .spin-wheel__heading { font-size: 27px; }
  .spin-wheel__row { grid-template-columns: 1fr; }
  .spin-wheel__card { padding: 18px 16px 20px; }
}

@media (prefers-reduced-motion: reduce) {
  .spin-wheel__rotor { transition-duration: 0.01s; }
  .spin-wheel__overlay, .spin-wheel__dialog { animation: none; }
  .spin-wheel__trigger, .spin-wheel__hub, .spin-wheel__btn, .spin-wheel__close, .spin-wheel__sound {
    transition: none;
  }
}
