/**
 * Xoom GYM Discount Wheel — brand-aligned popup v1.2.0
 * Palette: purple #6827FB / #6E00CE, lime #F4FB27, black #0A0A0A, Rajdhani.
 * Scoped, mobile-first, no @import.
 */

.xgdw-root,
.xgdw-float-btn,
#xgdw-modal-root {
  --xgdw-purple: #6827FB;
  --xgdw-purple-deep: #6E00CE;
  --xgdw-lime: #F4FB27;
  --xgdw-black: #0A0A0A;
  --xgdw-black-2: #14081F;
  --xgdw-ink: #0A0A0A;
  --xgdw-text: #FEFEFE;
  --xgdw-muted: rgba(254, 254, 254, 0.72);
  --xgdw-line: rgba(254, 254, 254, 0.14);
  --xgdw-font: "Rajdhani", "Trebuchet MS", "Segoe UI", sans-serif;
  --xgdw-display: "Rajdhani", "Arial Narrow", Impact, sans-serif;
  --xgdw-red: var(--xgdw-purple);
  --xgdw-orange: var(--xgdw-purple-deep);
  --xgdw-navy: var(--xgdw-black);
  --xgdw-navy-2: var(--xgdw-black-2);
  --xgdw-green: var(--xgdw-lime);
  --xgdw-gold: var(--xgdw-lime);
  box-sizing: border-box;
  -webkit-font-smoothing: antialiased;
}

.xgdw-root *,
.xgdw-root *::before,
.xgdw-root *::after,
.xgdw-float-btn *,
#xgdw-modal-root * {
  box-sizing: border-box;
}

.xgdw-root button,
.xgdw-root input:not([type="checkbox"]):not([type="radio"]),
.xgdw-root textarea,
.xgdw-float-btn {
  font: inherit;
  appearance: none;
  -webkit-appearance: none;
  margin: 0;
}

.xgdw-root {
  font-family: var(--xgdw-font);
  color: var(--xgdw-text);
  line-height: 1.4;
  width: 100%;
  max-width: 100%;
}

.xgdw-root button,
.xgdw-float-btn {
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

/* Float */
.xgdw-float-btn {
  position: fixed !important;
  z-index: 99980 !important;
  bottom: max(16px, env(safe-area-inset-bottom, 0px));
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  max-width: min(220px, calc(100% - 24px));
  padding: 11px 14px;
  border: 0 !important;
  border-radius: 999px !important;
  background: linear-gradient(135deg, var(--xgdw-purple), var(--xgdw-purple-deep)) !important;
  color: #fff !important;
  font-family: var(--xgdw-display) !important;
  font-weight: 700 !important;
  font-size: 12px !important;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-decoration: none !important;
  box-shadow: 0 8px 22px rgba(104, 39, 251, 0.45) !important;
}

.xgdw-float-btn svg { width: 16px; height: 16px; flex-shrink: 0; }
.xgdw-float-btn span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 9.5rem; }
.xgdw-float-bottom-right { right: max(12px, env(safe-area-inset-right, 0px)); left: auto; }
.xgdw-float-bottom-left { left: max(12px, env(safe-area-inset-left, 0px)); right: auto; }

@media (max-width: 560px) {
  .xgdw-float-btn {
    bottom: max(72px, calc(env(safe-area-inset-bottom, 0px) + 64px));
    max-width: min(168px, calc(100% - 20px));
    padding: 10px 12px;
    font-size: 11px !important;
  }
  .xgdw-float-btn span { max-width: 7.5rem; }
}

@keyframes xgdw-pulse-once {
  0%, 100% { box-shadow: 0 8px 22px rgba(104, 39, 251, 0.45); }
  50% { box-shadow: 0 8px 22px rgba(104, 39, 251, 0.45), 0 0 0 8px rgba(244, 251, 39, 0.18); }
}
.xgdw-float-btn.is-attention { animation: xgdw-pulse-once 1.1s ease 2; }

/* Modal: always centered */
#xgdw-modal-root[hidden] { display: none !important; }

#xgdw-modal-root:not([hidden]) {
  position: fixed !important;
  inset: 0;
  z-index: 99990 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 14px !important;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
}

.xgdw-overlay {
  position: absolute;
  inset: 0;
  background: rgba(4, 2, 10, 0.82);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}

/* Compact dialog */
.xgdw-dialog {
  position: relative;
  z-index: 1;
  width: min(300px, calc(100% - 28px)) !important;
  max-width: calc(100% - 28px) !important;
  max-height: min(82vh, 560px);
  max-height: min(82dvh, 560px);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  margin: 0 auto;
  padding: 16px 14px 14px;
  border-radius: 16px;
  border: 1px solid var(--xgdw-line);
  background:
    radial-gradient(90% 50% at 50% -10%, rgba(104, 39, 251, 0.38), transparent 55%),
    linear-gradient(165deg, #1A0A2E 0%, var(--xgdw-black) 100%);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.55);
  color: var(--xgdw-text);
  font-family: var(--xgdw-font);
}

.xgdw-dialog-close {
  position: absolute;
  top: 4px;
  right: 4px;
  z-index: 3;
  width: 34px;
  height: 34px;
  border: 0 !important;
  border-radius: 10px !important;
  background: rgba(255, 255, 255, 0.08) !important;
  color: #fff !important;
  font-size: 18px !important;
  line-height: 1 !important;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
}

.xgdw-dialog-body { width: 100%; }

.xgdw-wheel-embed,
.xgdw-lookup {
  width: 100%;
  max-width: 340px;
  margin: 0 auto;
  padding: 16px 14px;
  border-radius: 16px;
  border: 1px solid var(--xgdw-line);
  background: linear-gradient(165deg, #1A0A2E 0%, var(--xgdw-black) 100%);
}

.xgdw-wheel-header {
  text-align: center;
  margin: 0 0 8px;
  padding: 0 26px;
}

.xgdw-eyebrow {
  display: inline-flex;
  margin: 0 0 4px;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(104, 39, 251, 0.2);
  border: 1px solid rgba(244, 251, 39, 0.35);
  color: var(--xgdw-lime);
  font-family: var(--xgdw-display);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.xgdw-title {
  margin: 0 0 2px !important;
  font-family: var(--xgdw-display) !important;
  font-size: 1.2rem !important;
  font-weight: 800 !important;
  letter-spacing: 0.02em !important;
  line-height: 1.1 !important;
  text-transform: uppercase;
  color: #fff !important;
}

.xgdw-subtitle {
  margin: 0 !important;
  color: var(--xgdw-muted) !important;
  font-size: 0.75rem !important;
  font-weight: 500 !important;
}

/* Compact wheel */
.xgdw-wheel-stage {
  position: relative;
  width: min(168px, calc(100% - 96px));
  margin: 2px auto 12px;
  aspect-ratio: 1 / 1;
  overflow: visible;
}

.xgdw-wheel-stage::before {
  content: "";
  position: absolute;
  inset: -5px;
  border-radius: 50%;
  background: conic-gradient(from 0deg, rgba(104, 39, 251, 0.55), rgba(244, 251, 39, 0.28), rgba(110, 0, 206, 0.4), rgba(104, 39, 251, 0.55));
  z-index: 0;
  animation: xgdw-ring 8s linear infinite;
}

.xgdw-wheel-stage::after {
  content: "";
  position: absolute;
  inset: -2px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.18);
  z-index: 0;
  pointer-events: none;
}

@keyframes xgdw-ring { to { transform: rotate(360deg); } }

.xgdw-canvas {
  position: relative;
  z-index: 1;
  display: block;
  width: 100% !important;
  height: auto !important;
  max-width: 100%;
  border-radius: 50%;
  background: var(--xgdw-black);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.45), 0 0 0 3px rgba(10, 10, 10, 0.95);
}

.xgdw-pointer {
  position: absolute;
  top: -5px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 4;
  width: 0;
  height: 0;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-top: 14px solid var(--xgdw-gold);
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.45));
}

.xgdw-pointer::after {
  content: "";
  position: absolute;
  top: -14px;
  left: -3px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 2px var(--xgdw-gold);
}

/* Buttons compact */
.xgdw-btn {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 42px;
  padding: 10px 12px !important;
  border: 0 !important;
  border-radius: 12px !important;
  font-family: var(--xgdw-display) !important;
  font-weight: 700 !important;
  font-size: 13px !important;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #fff !important;
  text-decoration: none !important;
}

.xgdw-btn:disabled { opacity: 0.55; cursor: not-allowed; }
.xgdw-btn:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

.xgdw-btn-spin,
.xgdw-btn-primary {
  background: linear-gradient(135deg, var(--xgdw-lime), #E8F020) !important;
  color: var(--xgdw-ink) !important;
  box-shadow: 0 8px 18px rgba(244, 251, 39, 0.28) !important;
}

.xgdw-btn-secondary {
  background: rgba(255, 255, 255, 0.08) !important;
  border: 1px solid var(--xgdw-line) !important;
  text-transform: none;
  font-family: var(--xgdw-font) !important;
  font-size: 13px !important;
  letter-spacing: 0;
}

.xgdw-btn-ghost {
  background: transparent !important;
  color: var(--xgdw-muted) !important;
  min-height: 36px;
  text-transform: none;
  font-family: var(--xgdw-font) !important;
  font-size: 12px !important;
  letter-spacing: 0;
  box-shadow: none !important;
}

.xgdw-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: xgdw-spin 0.7s linear infinite;
}
@keyframes xgdw-spin { to { transform: rotate(360deg); } }

.xgdw-chance,
.xgdw-hint,
.xgdw-exhausted-banner {
  margin: 8px 0 0;
  padding: 7px 9px;
  border-radius: 10px;
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.35;
  text-align: center;
}

.xgdw-chance {
  background: rgba(104, 39, 251, 0.16);
  border: 1px solid rgba(104, 39, 251, 0.4);
  color: #D4C2FF;
}

.xgdw-chance.is-used {
  background: rgba(244, 251, 39, 0.12);
  border-color: rgba(244, 251, 39, 0.4);
  color: #F4FB27;
}

.xgdw-exhausted-banner {
  margin: 0 0 10px;
  background: rgba(104, 39, 251, 0.18);
  border: 1px solid rgba(104, 39, 251, 0.45);
  color: #E0D4FF;
  font-family: var(--xgdw-display);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 0.8rem;
}

.xgdw-hint {
  background: rgba(244, 251, 39, 0.1);
  border: 1px solid rgba(244, 251, 39, 0.28);
  color: #F4FB27;
  text-align: left;
  margin: 0 0 10px;
}

.xgdw-status {
  min-height: 1.1em;
  margin: 8px 0 0;
  text-align: center;
  color: var(--xgdw-muted);
  font-size: 0.78rem;
}
.xgdw-status.is-error { color: #FF8A9A; }
.xgdw-status.is-ok { color: var(--xgdw-lime); }

.xgdw-result-panel { text-align: center; width: 100%; }
.xgdw-steps { display: none; }

.xgdw-result-discount {
  margin: 2px 0 8px !important;
  font-family: var(--xgdw-display) !important;
  font-size: 1.55rem !important;
  font-weight: 800 !important;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  line-height: 1;
  color: var(--xgdw-lime) !important;
}

.xgdw-code-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  margin: 0 0 8px;
  background: rgba(0, 0, 0, 0.28);
  border: 1px dashed rgba(244, 251, 39, 0.45);
  border-radius: 12px;
}

.xgdw-code-value {
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: #fff;
  word-break: break-all;
  text-align: left;
}

.xgdw-copy-btn {
  flex-shrink: 0;
  min-height: 36px;
  padding: 8px 10px !important;
  border: 0 !important;
  border-radius: 10px !important;
  background: rgba(255, 255, 255, 0.12) !important;
  color: #fff !important;
  font-weight: 700 !important;
  font-size: 11px !important;
  font-family: var(--xgdw-font) !important;
}
.xgdw-copy-btn.is-copied { background: var(--xgdw-purple) !important; }

.xgdw-meta {
  color: var(--xgdw-muted) !important;
  font-size: 0.78rem !important;
  margin: 0 0 8px !important;
}

.xgdw-actions { display: grid; gap: 8px; width: 100%; }

.xgdw-claim-panel .xgdw-label,
.xgdw-lookup .xgdw-label {
  display: block;
  margin: 0 0 4px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--xgdw-muted);
  text-align: left;
}

.xgdw-input,
.xgdw-textarea,
.xgdw-select {
  display: block;
  width: 100% !important;
  min-height: 40px;
  padding: 9px 11px !important;
  margin: 0 0 8px !important;
  border-radius: 10px !important;
  border: 1px solid var(--xgdw-line) !important;
  background: rgba(0, 0, 0, 0.28) !important;
  color: #fff !important;
  font-size: 16px !important;
  font-family: var(--xgdw-font) !important;
}

.xgdw-select {
  appearance: none;
  -webkit-appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, #f4fb27 50%), linear-gradient(135deg, #f4fb27 50%, transparent 50%);
  background-position: calc(100% - 18px) calc(50% - 3px), calc(100% - 12px) calc(50% - 3px);
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  padding-right: 34px !important;
  cursor: pointer;
}

.xgdw-select option {
  color: #111;
  background: #fff;
}

.xgdw-textarea { min-height: 72px; resize: vertical; }
.xgdw-input:focus,
.xgdw-textarea:focus,
.xgdw-select:focus {
  outline: none !important;
  border-color: var(--xgdw-lime) !important;
  box-shadow: 0 0 0 2px rgba(244, 251, 39, 0.22) !important;
}

.xgdw-check {
  position: relative;
  z-index: 2;
  display: flex !important;
  gap: 10px;
  align-items: flex-start;
  margin: 6px 0 12px;
  padding: 8px 6px;
  font-size: 0.78rem;
  color: var(--xgdw-muted);
  text-align: left;
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
  pointer-events: auto !important;
}

.xgdw-check span {
  flex: 1;
  line-height: 1.35;
  pointer-events: none;
}

.xgdw-root .xgdw-check input[type="checkbox"],
#xgdw-modal-root .xgdw-check input[type="checkbox"],
.xgdw-check input[type="checkbox"] {
  appearance: auto !important;
  -webkit-appearance: checkbox !important;
  -moz-appearance: checkbox !important;
  position: relative !important;
  z-index: 3 !important;
  display: inline-block !important;
  visibility: visible !important;
  opacity: 1 !important;
  width: 20px !important;
  height: 20px !important;
  min-width: 20px !important;
  min-height: 20px !important;
  margin: 1px 0 0 !important;
  padding: 0 !important;
  flex-shrink: 0 !important;
  pointer-events: auto !important;
  cursor: pointer !important;
  accent-color: var(--xgdw-purple);
  background: #fff !important;
  border: 2px solid rgba(255, 255, 255, 0.65) !important;
  border-radius: 4px !important;
  transform: none !important;
  clip: auto !important;
  clip-path: none !important;
}

.xgdw-hp {
  position: absolute !important;
  left: 0 !important;
  top: 0 !important;
  width: 1px !important;
  height: 1px !important;
  margin: -1px !important;
  padding: 0 !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  border: 0 !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

.xgdw-lookup-row { display: grid; grid-template-columns: 1fr; gap: 8px; }
.xgdw-lookup-row .xgdw-input { margin-bottom: 0 !important; }
.xgdw-lookup-result { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--xgdw-line); }
.xgdw-lookup-card { display: grid; gap: 8px; margin-bottom: 10px; text-align: left; }
.xgdw-lookup-card strong { color: #fff; }

/* Larger phones / tablet: still centered, slightly roomier */
@media (min-width: 400px) {
  .xgdw-dialog {
    width: min(320px, calc(100% - 32px)) !important;
    padding: 18px 16px 16px;
  }
  .xgdw-wheel-stage { width: 184px; }
  .xgdw-title { font-size: 1.3rem !important; }
}

@media (min-width: 768px) {
  .xgdw-dialog {
    width: min(340px, 100%) !important;
    padding: 20px 18px 18px;
  }
  .xgdw-wheel-stage { width: 200px; }
  .xgdw-title { font-size: 1.4rem !important; }
  .xgdw-btn { min-height: 44px; font-size: 14px !important; }
  .xgdw-float-btn { font-size: 13px !important; padding: 12px 16px; }
  .xgdw-lookup-row { grid-template-columns: 1fr auto; }
  .xgdw-lookup-row .xgdw-btn { width: auto; min-width: 120px; }
  .xgdw-steps {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    margin: 0 0 10px;
  }
  .xgdw-step {
    padding: 8px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--xgdw-line);
    font-size: 11px;
    color: var(--xgdw-muted);
    text-align: left;
  }
  .xgdw-step strong {
    display: block;
    color: #fff;
    font-size: 12px;
    margin-bottom: 2px;
  }
}

@media (max-width: 359px) {
  .xgdw-dialog {
    width: calc(100% - 20px) !important;
    padding: 14px 12px 12px;
  }
  .xgdw-wheel-stage { width: min(148px, calc(100% - 72px)); }
  .xgdw-title { font-size: 1.1rem !important; }
}

@media (prefers-reduced-motion: reduce) {
  .xgdw-float-btn,
  .xgdw-btn,
  .xgdw-spinner,
  .xgdw-float-btn.is-attention,
  .xgdw-wheel-stage::before {
    transition: none !important;
    animation: none !important;
  }
}
