/* Lucky Wheel - استایل عمومی. همه‌ی کلاس‌ها با پیشوند lw- هستن. */
.lw {
  --lw-primary: #0a62b1;
  --lw-dark: #0f1c2e;
  --lw-accent: #9bc53d;
  --lw-bg: #ffffff;
  --lw-text: #0f1c2e;
  --lw-muted: #5b6b7e;
  --lw-border: #d9e2ec;
  --lw-link: #0a62b1;
  --lw-error: #b42318;
  --lw-radius: 14px;
  /* فونت کاملاً از قالب و المنتور (ارث از والد) */
  font-family: inherit;
  color: var(--lw-text);
  max-width: 560px;
  margin: 0 auto;
  padding: 16px;
  box-sizing: border-box;
}
.lw *, .lw *::before, .lw *::after { box-sizing: border-box; }
.lw [hidden] { display: none !important; }

/* تم تیره: یا از JS (بر اساس پس‌زمینه‌ی قالب) یا اگه JS نبود، از تنظیم سیستم */
.lw[data-theme="dark"] {
  --lw-bg: #13202f;
  --lw-text: #f1f5f9;
  --lw-muted: #c3d0de;
  --lw-border: #3a4f66;
  --lw-link: #8fcaff;
  --lw-error: #ffb4a8;
}
@media (prefers-color-scheme: dark) {
  .lw:not([data-theme]) {
    --lw-bg: #13202f;
    --lw-text: #f1f5f9;
    --lw-muted: #c3d0de;
    --lw-border: #3a4f66;
    --lw-link: #8fcaff;
    --lw-error: #ffb4a8;
  }
}

.lw-head { text-align: center; margin-bottom: 14px; }
.lw-tag {
  display: inline-block; background: var(--lw-accent); color: var(--lw-dark);
  font-size: 12px; font-weight: 800; border-radius: 999px; padding: 3px 10px;
}
.lw-title { margin: 8px 0 4px; font-size: 22px; font-weight: 800; }
.lw-sub { margin: 0; color: var(--lw-muted); font-size: 14px; line-height: 1.8; }

.lw-card {
  background: var(--lw-bg); border: 1px solid var(--lw-border);
  border-radius: var(--lw-radius); padding: 18px;
}
.lw-label { display: block; font-weight: 700; margin-bottom: 6px; font-size: 14px; }
.lw-input {
  width: 100%; border: 1px solid var(--lw-border); border-radius: 10px;
  padding: 11px 12px; font: inherit; font-size: 16px; background: var(--lw-bg); color: var(--lw-text);
  direction: ltr; text-align: center;
}
.lw-input:focus { outline: 2px solid var(--lw-primary); outline-offset: 1px; }
/* چهار کادر کنار هم: با specificity بالا تا استایل تم روی آن‌ها اثر نگذارد */
.lw .lw-otp {
  display: grid; grid-template-columns: repeat(4, 58px); justify-content: center; gap: 10px;
  margin: 6px auto 14px; width: max-content; max-width: 100%; direction: ltr;
}
.lw .lw-otp .lw-otp-box {
  display: block; position: static; float: none; inset: auto; margin: 0; min-width: 0; max-width: 100%;
  width: 58px; height: 62px; padding: 0; text-align: center; font: inherit; font-size: 26px; font-weight: 800;
  line-height: 1; color: var(--lw-text); background: var(--lw-bg); border: 2px solid var(--lw-border);
  border-radius: 12px; box-shadow: none; box-sizing: border-box; direction: ltr; appearance: none;
}
@media (max-width: 360px) {
  .lw .lw-otp { grid-template-columns: repeat(4, 50px); gap: 8px; }
  .lw .lw-otp .lw-otp-box { width: 50px; height: 56px; font-size: 22px; }
}
.lw .lw-otp .lw-otp-box:focus { outline: none; border-color: var(--lw-link); box-shadow: 0 0 0 3px rgba(10,98,177,.25); }
.lw-until { text-align: center; margin: 0 0 10px; font-weight: 700; color: var(--lw-text); }
.lw-check { display: flex; gap: 8px; align-items: flex-start; margin: 14px 0; font-size: 13px; line-height: 1.8; color: var(--lw-muted); }
.lw-check input { width: 24px; height: 24px; flex: 0 0 auto; margin-top: 2px; accent-color: var(--lw-primary); }
/* حداقل اندازه‌ی هدف لمسی ۴۴px (راهنمای دسترسی) */
.lw .lw-input { min-height: 44px; }
.lw .lw-btn { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; }
.lw .lw-link { min-height: 44px; display: inline-flex; align-items: center; }


.lw-btn {
  display: inline-block; width: 100%; background: var(--lw-primary); color: #fff;
  border: 0; border-radius: 10px; padding: 12px 16px; font: inherit; font-weight: 800;
  font-size: 15px; cursor: pointer; text-align: center; text-decoration: none;
  transition: transform .15s, opacity .15s;
}
.lw-btn:hover { transform: translateY(-1px); }
.lw-btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.lw-btn-ghost { width: auto; background: transparent; color: var(--lw-link); border: 1px solid var(--lw-link); padding: 10px 14px; }
.lw-link { background: none; border: 0; color: var(--lw-link); font: inherit; cursor: pointer; margin-top: 10px; padding: 0; }

.lw-hint { color: var(--lw-muted); font-size: 13px; line-height: 1.8; margin: 8px 0; }
.lw-msg { color: var(--lw-error); font-size: 13px; min-height: 1.2em; margin: 8px 0 0; }

.lw-stats { display: flex; gap: 10px; margin-bottom: 14px; }
.lw-stat {
  flex: 1; text-align: center; background: var(--lw-primary); color: #fff;
  border-radius: 12px; padding: 10px 6px;
}
.lw-stat-n { display: block; font-size: 22px; font-weight: 800; }
.lw-stat-l { font-size: 12px; opacity: .9; }

.lw-wheel-wrap { position: relative; width: 100%; max-width: 380px; margin: 4px auto 12px; }
.lw-wheel-wrap canvas { width: 100%; height: auto; display: block; }
.lw-pointer {
  position: absolute; top: -6px; left: 50%; transform: translateX(-50%); z-index: 2;
  width: 0; height: 0; border-left: 14px solid transparent; border-right: 14px solid transparent;
  border-top: 24px solid var(--lw-accent); filter: drop-shadow(0 2px 2px rgba(0,0,0,.3));
}
.lw-spin { margin-top: 4px; }

.lw-result {
  margin-top: 14px; text-align: center; background: var(--lw-accent);
  color: var(--lw-dark); border-radius: 12px; padding: 14px;
}
.lw-result-text { margin: 0 0 8px; font-weight: 800; font-size: 16px; }
.lw-code-row { display: flex; gap: 8px; align-items: center; justify-content: center; flex-wrap: wrap; margin: 8px 0; }
.lw-code-box {
  background: #fff; color: var(--lw-dark); border-radius: 8px; padding: 8px 12px;
  font-weight: 800; direction: ltr; font-size: 15px; letter-spacing: 1px;
}
.lw-result .lw-btn-ghost { color: var(--lw-dark); border-color: var(--lw-dark); }
.lw-result .lw-hint { color: var(--lw-dark); }
.lw-result .lw-btn { background: var(--lw-dark); margin-top: 6px; }

.lw-invite { margin-top: 16px; padding-top: 14px; border-top: 1px dashed var(--lw-border); }
.lw-h3 { margin: 0 0 4px; font-size: 16px; }
.lw-link-input { font-size: 13px; text-align: left; flex: 1 1 200px; }

.lw-help { margin-top: 14px; font-size: 14px; line-height: 1.9; }
.lw-help summary { cursor: pointer; font-weight: 700; color: var(--lw-link); min-height: 44px; display: flex; align-items: center; }
/* حلقه‌ی فوکوس برای کیبورد، همیشه دیده شود */
.lw :focus-visible { outline: 3px solid var(--lw-link); outline-offset: 2px; }
.lw-help ol { padding-inline-start: 20px; }

@media (max-width: 480px) {
  .lw-title { font-size: 19px; }
  .lw-card { padding: 14px; }
  .lw-stat-n { font-size: 19px; }
}
@media (prefers-reduced-motion: reduce) {
  .lw-btn { transition: none; }
}

.lw-captcha { margin: 0 0 12px; }

/* ===== سازگاری با استایل قالب و المنتور =====
   قالب‌ها معمولاً دکمه، ورودی و تگ‌های p/h را سراسری استایل می‌کنند.
   این بخش با #lw-root (اولویت بالاتر) و !important، ظاهر افزونه را ثابت نگه می‌دارد. */
#lw-root { font-family: inherit !important; }
#lw-root .lw-btn {
  display: flex !important; align-items: center !important; justify-content: center !important;
  width: 100% !important; min-height: 44px !important; margin: 0 !important; padding: 12px 16px !important;
  background-color: var(--lw-primary) !important; background-image: none !important; color: #ffffff !important;
  border: 0 !important; border-radius: 10px !important; box-shadow: none !important;
  font-family: inherit !important; font-size: 15px !important; font-weight: 800 !important; line-height: 1.4 !important;
  text-transform: none !important; letter-spacing: 0 !important; text-decoration: none !important; cursor: pointer !important;
}
#lw-root .lw-btn:disabled { opacity: .5 !important; cursor: not-allowed !important; }
#lw-root .lw-btn.lw-btn-ghost {
  width: auto !important; display: inline-flex !important; flex: 0 0 auto !important;
  background-color: transparent !important; color: var(--lw-link) !important;
  border: 1px solid var(--lw-link) !important; padding: 10px 16px !important;
}
#lw-root .lw-result .lw-btn { background-color: var(--lw-dark) !important; color: #ffffff !important; }
#lw-root .lw-result .lw-btn.lw-btn-ghost { background-color: transparent !important; color: var(--lw-dark) !important; border-color: var(--lw-dark) !important; }
#lw-root .lw-link {
  display: inline-flex !important; align-items: center !important; min-height: 44px !important; margin: 0 !important; padding: 0 !important;
  background: none !important; border: 0 !important; color: var(--lw-link) !important; font-family: inherit !important; font-size: 14px !important;
}
#lw-root .lw-input {
  display: block !important; width: 100% !important; min-height: 44px !important; margin: 0 !important; padding: 10px 12px !important;
  font-family: inherit !important; font-size: 16px !important; color: var(--lw-text) !important; background-color: var(--lw-bg) !important;
  border: 1px solid var(--lw-border) !important; border-radius: 10px !important; box-shadow: none !important;
}
#lw-root .lw-link-input { direction: ltr !important; text-align: left !important; visibility: visible !important; opacity: 1 !important; }

/* چهار کادر کد ورود: حتماً کنار هم و ردیف واحد */
#lw-root .lw-otp {
  display: grid !important; grid-template-columns: repeat(4, 58px) !important; gap: 10px !important;
  justify-content: center !important; width: max-content !important; max-width: 100% !important;
  margin: 6px auto 14px !important; padding: 0 !important; direction: ltr !important;
}
#lw-root .lw-otp .lw-otp-box {
  display: block !important; float: none !important; position: static !important; width: 58px !important; height: 62px !important;
  min-width: 0 !important; max-width: 100% !important; margin: 0 !important; padding: 0 !important; inset: auto !important;
  font-family: inherit !important; font-size: 26px !important; font-weight: 800 !important; line-height: 1 !important; text-align: center !important;
  color: var(--lw-text) !important; background-color: var(--lw-bg) !important; border: 2px solid var(--lw-border) !important;
  border-radius: 12px !important; box-shadow: none !important; appearance: none !important;
}
@media (max-width: 360px) {
  #lw-root .lw-otp { grid-template-columns: repeat(4, 50px) !important; gap: 8px !important; }
  #lw-root .lw-otp .lw-otp-box { width: 50px !important; height: 56px !important; font-size: 22px !important; }
}

/* فاصله‌ها: قالب نباید فاصله‌ی اضافه بدهد */
#lw-root p, #lw-root h2, #lw-root h3 { font-family: inherit !important; }
#lw-root .lw-title { margin: 8px 0 4px !important; }
#lw-root .lw-sub, #lw-root .lw-hint, #lw-root .lw-until { margin: 6px 0 !important; }
#lw-root .lw-stats { margin: 0 0 14px !important; }
#lw-root .lw-msg { margin: 6px 0 0 !important; min-height: 1.2em !important; }
#lw-root .lw-invite { margin: 16px 0 0 !important; padding: 14px 0 0 !important; border-top: 1px dashed var(--lw-border) !important; }
#lw-root .lw-invite .lw-h3 { margin: 0 0 4px !important; }
#lw-root .lw-invite .lw-code-row { display: flex !important; flex-direction: column !important; gap: 8px !important; margin: 8px 0 0 !important; }
#lw-root .lw-invite .lw-code-row .lw-btn.lw-btn-ghost { width: 100% !important; }
#lw-root .lw-help { margin: 14px 0 0 !important; }
#lw-root .lw-spin { margin: 4px 0 !important; }
#lw-root .lw-result { margin: 14px 0 0 !important; }
#lw-root .lw-result .lw-code-row { flex-direction: row !important; flex-wrap: wrap !important; }
#lw-root .lw-code-box { display: inline-block !important; padding: 8px 12px !important; border-radius: 8px !important; }
#lw-root .lw-check input { width: 24px !important; height: 24px !important; margin: 2px 0 0 !important; }
/* شماره‌ی موبایل و متن‌های راهنما همیشه رنگ متن کارت را بگیرند (در تم تیره هم خوانا باشند) */
#lw-root .lw-hint bdi, #lw-root .lw-hint b, #lw-root .lw-until b { color: inherit !important; background: transparent !important; }

/* ===== پاپ‌آپ جایزه، پس‌زمینه‌ی تیره، افکت کاغذ رنگی و تکان نشانگر ===== */
.lw-backdrop { position: fixed; inset: 0; background: rgba(8, 12, 20, .6); z-index: 9998; animation: lw-fade .25s ease-out; }
#lw-root .lw-result.lw-pop {
  position: fixed !important; z-index: 9999; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: min(92vw, 400px); margin: 0 !important; padding: 26px 20px 20px !important;
  border-radius: 18px !important; box-shadow: 0 24px 60px rgba(0, 0, 0, .4) !important;
  animation: lw-pop-in .45s cubic-bezier(.2, .9, .3, 1.25);
}
#lw-root .lw-close {
  position: absolute !important; top: 8px; inset-inline-end: 8px; width: auto !important; min-height: 36px !important;
  padding: 6px 12px !important; font-size: 13px !important;
}
#lw-root .lw-result.lw-pop .lw-result-text { font-size: 18px !important; }
.lw-fx { position: fixed; inset: 0; pointer-events: none; z-index: 9999; }
#lw-root .lw-pointer.lw-tick { animation: lw-kick .16s ease-out; }
@keyframes lw-kick { 0% { transform: translateX(-50%) rotate(0); } 40% { transform: translateX(-50%) rotate(-16deg); } 100% { transform: translateX(-50%) rotate(0); } }
@keyframes lw-pop-in { from { opacity: 0; transform: translate(-50%, -40%) scale(.9); } to { opacity: 1; transform: translate(-50%, -50%) scale(1); } }
@keyframes lw-fade { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .lw-backdrop, #lw-root .lw-result.lw-pop, #lw-root .lw-pointer.lw-tick { animation: none !important; }
}

/* ===== اصلاحات نهایی ===== */
/* متن آمار همیشه سفید روی کادر آبی */
#lw-root .lw-stat, #lw-root .lw-stat *, #lw-root .lw-stat-n, #lw-root .lw-stat-l { color: #ffffff !important; }
/* اسپینر روی دکمه‌ها */
#lw-root .lw-btn.lw-busy { position: relative; cursor: wait !important; opacity: .85 !important; }
#lw-root .lw-btn.lw-busy::after {
  content: ''; display: inline-block; width: 16px; height: 16px; margin-inline-start: 10px; vertical-align: middle;
  border: 2px solid #ffffff; border-top-color: transparent; border-radius: 50%; animation: lw-spin .7s linear infinite;
}
@keyframes lw-spin { to { transform: rotate(360deg); } }
/* کادر دعوت: ردیف افقی و فشرده */
#lw-root .lw-invite .lw-code-row { flex-direction: row !important; flex-wrap: wrap !important; align-items: stretch !important; gap: 8px !important; margin: 8px 0 0 !important; }
#lw-root .lw-invite .lw-link-input { flex: 1 1 180px !important; min-width: 0 !important; width: auto !important; }
#lw-root .lw-invite .lw-code-row .lw-btn.lw-btn-ghost { width: auto !important; flex: 0 0 auto !important; }
#lw-root .lw-invite { margin-top: 12px !important; padding-top: 10px !important; }
/* فلش آکاردئون «چطور کار می‌کنه» */
#lw-root .lw-help summary { list-style: none !important; display: flex !important; justify-content: space-between !important; align-items: center !important; gap: 8px; }
#lw-root .lw-help summary::-webkit-details-marker { display: none; }
#lw-root .lw-help .lw-caret { display: inline-block; font-size: 18px; line-height: 1; transition: transform .2s ease; }
#lw-root .lw-help[open] .lw-caret { transform: rotate(180deg); }

/* بوم گردونه در برابر CSS قالب (مثلاً قوانین canvas یا wrapper که آن را مخفی یا صفر می‌کنند) */
#lw-root .lw-wheel-wrap { display: block !important; position: relative !important; width: 100% !important; max-width: 520px !important; margin-inline: auto !important; visibility: visible !important; opacity: 1 !important; }
#lw-root canvas#lw-canvas { display: block !important; width: 100% !important; max-width: 100% !important; height: auto !important; min-height: 240px !important; visibility: visible !important; opacity: 1 !important; }

/* کدهای تخفیف کاربر */
#lw-root .lw-codes { margin-top: 18px; padding-top: 14px; border-top: 1px dashed currentColor; }
#lw-root .lw-codes[hidden] { display: none !important; }
#lw-root .lw-codes-title { font-size: 16px !important; font-weight: 800 !important; margin: 0 0 8px !important; }
#lw-root .lw-codes-list { list-style: none !important; margin: 0 !important; padding: 0 !important; display: grid; gap: 8px; }
#lw-root .lw-code-item { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 6px 12px; padding: 10px 12px; border-radius: 12px; background: rgba(127,127,127,.08); border: 1px solid rgba(127,127,127,.25); }
#lw-root .lw-code-label { font-size: 14px; }
#lw-root .lw-code-val { font-weight: 800; font-size: 16px; letter-spacing: .04em; user-select: all; }

#lw-root .lw-code-items { display:block; opacity:.85; font-size:12px; line-height:1.6; margin-top:2px; }
