.neyl-ps {
  --neyl-ps-accent: #ffffff;
  --neyl-ps-bg: #000000;
  --neyl-ps-clay: #c4a484;
  --neyl-ps-sand: #e4d5c3;
  --neyl-ps-height-d: 100vh;
  --neyl-ps-height-m: 70vh;
  --neyl-ps-width-d: 100%;
  --neyl-ps-width-m: 100%;
  position: relative;
  width: var(--neyl-ps-width-d);
  max-width: 100%;
  height: var(--neyl-ps-height-d);
  min-height: 320px;
  overflow: hidden;
  background: var(--neyl-ps-bg);
  font-family: "Vazirmatn", "Segoe UI", Tahoma, system-ui, sans-serif;
  color: #fff;
  isolation: isolate;
  touch-action: pan-y;
  -webkit-tap-highlight-color: transparent;
  margin-inline: auto;
}

@media (min-width: 901px) {
  .neyl-ps.neyl-ps--no-desktop {
    display: none !important;
  }
}

@media (max-width: 900px) {
  .neyl-ps.neyl-ps--no-mobile {
    display: none !important;
  }
}

.neyl-ps *,
.neyl-ps *::before,
.neyl-ps *::after {
  box-sizing: border-box;
}

.neyl-ps__layer {
  position: absolute;
  inset: 0;
}

.neyl-ps__img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
  user-select: none;
  -webkit-user-drag: none;
  display: block;
  pointer-events: none;
}

.neyl-ps__strips {
  position: absolute;
  inset: 0;
}

.neyl-ps__strip {
  position: absolute;
  top: 0;
  bottom: 0;
  overflow: hidden;
}

.neyl-ps__strip-inner {
  position: absolute;
  top: 0;
  bottom: 0;
}

.neyl-ps__zoom {
  position: relative;
  width: 100%;
  height: 100%;
  will-change: transform;
}

.neyl-ps__nav {
  position: absolute;
  inset: 0;
  z-index: 20;
}

.neyl-ps__progress-track {
  pointer-events: none;
  position: absolute;
  inset-inline: 1.5rem;
  top: 1.5rem;
  z-index: 10;
  height: 1px;
  background: color-mix(in srgb, var(--neyl-ps-accent) 20%, transparent);
}

.neyl-ps__progress-fill {
  height: 100%;
  width: 100%;
  transform-origin: left center;
  background: var(--neyl-ps-accent);
}

.neyl-ps__chapter-wrap {
  pointer-events: none;
  position: absolute;
  inset-inline: 0;
  top: 0;
  z-index: 12;
  padding: 3rem 1.5rem 0;
}

.neyl-ps__chapter {
  display: block;
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--neyl-ps-accent);
}

.neyl-ps__bottom {
  position: absolute;
  inset-inline: 0;
  bottom: 0;
  z-index: 12;
  display: flex;
  align-items: flex-end;
  padding: 0 1.5rem 2.5rem;
  pointer-events: none;
}

.neyl-ps__title {
  margin: 0;
  width: 33.333%;
  flex-shrink: 0;
  overflow: hidden;
  display: flex;
  align-items: flex-end;
  font-family: "Instrument Serif", Georgia, serif;
  font-size: clamp(2.75rem, 8vw, 6rem);
  font-weight: 400;
  line-height: 1;
  color: var(--neyl-ps-accent);
}

.neyl-ps__spacer {
  width: 33.333%;
  flex-shrink: 0;
}

.neyl-ps__counter {
  width: 33.333%;
  flex-shrink: 0;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  padding-block: 1.25rem;
  font-size: 0.75rem;
  color: color-mix(in srgb, var(--neyl-ps-accent) 70%, transparent);
}

.neyl-ps__counter-num-wrap {
  display: inline-block;
  width: 2ch;
  overflow: hidden;
  text-align: end;
}

.neyl-ps__counter-num {
  display: inline-block;
}

.neyl-ps__cursor {
  pointer-events: none;
  position: fixed;
  left: 0;
  top: 0;
  z-index: 100;
  opacity: 0;
}

.neyl-ps__cursor-ball {
  width: 3.75rem;
  height: 3.75rem;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--neyl-ps-accent);
}

.neyl-ps__cursor-icon {
  position: relative;
  width: 1.875rem;
  height: 1.875rem;
}

.neyl-ps__cursor-line {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 1rem;
  height: 2px;
  background: #000;
}

/* Glass widget */
.neyl-ps__glass-wrap {
  pointer-events: none;
  position: absolute;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: flex-start; /* راست در RTL */
  padding: 0 1.5rem;
}

/* جایگاه ویجت: راست / وسط / چپ (با توجه به dir=rtl) */
.neyl-ps--align-right .neyl-ps__glass-wrap,
.neyl-ps[data-glass-align="right"] .neyl-ps__glass-wrap {
  justify-content: flex-start;
}

.neyl-ps--align-center .neyl-ps__glass-wrap,
.neyl-ps[data-glass-align="center"] .neyl-ps__glass-wrap {
  justify-content: center;
}

.neyl-ps--align-left .neyl-ps__glass-wrap,
.neyl-ps[data-glass-align="left"] .neyl-ps__glass-wrap {
  justify-content: flex-end;
}

.neyl-ps--align-center .neyl-ps__glass {
  text-align: center;
}

.neyl-ps--align-center .neyl-ps__badge {
  margin-inline: auto;
}

.neyl-ps--align-center .neyl-ps__cta,
.neyl-ps[data-glass-align="center"] .neyl-ps__cta {
  margin-inline: auto;
}

.neyl-ps__glass {
  pointer-events: auto;
  width: 100%;
  max-width: 28rem;
  flex: 0 0 auto;
  border-radius: 26px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  padding: 2rem 2.15rem;
  background:
    linear-gradient(
      160deg,
      rgba(255, 255, 255, 0.28) 0%,
      rgba(255, 255, 255, 0.1) 42%,
      rgba(255, 255, 255, 0.04) 100%
    ),
    rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(22px) saturate(175%);
  -webkit-backdrop-filter: blur(22px) saturate(175%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.35),
    inset 0 -1px 0 rgba(0, 0, 0, 0.12),
    0 18px 40px -24px rgba(0, 0, 0, 0.35);
}

.neyl-ps__badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 30px;
  margin-bottom: 1rem;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.08);
  font-size: 12.5px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.92);
}

.neyl-ps__badge i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--neyl-ps-clay);
}

.neyl-ps__heading {
  margin: 0;
  font-size: clamp(1.75rem, 4vw, 2.35rem);
  font-weight: 700;
  line-height: 1.25;
  color: #fdfdfd;
}

.neyl-ps__sub {
  margin: 0.75rem 0 0;
  font-size: 0.98rem;
  line-height: 1.85;
  color: rgba(255, 255, 255, 0.75);
}

html body .neyl-ps .neyl-ps__cta,
html body .neyl-ps a.neyl-ps__cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  margin-top: 1.35rem;
  padding: 0.65rem 1.4rem;
  border-radius: 999px;
  background: #fff !important;
  color: #111 !important;
  font-weight: 650;
  font-size: 0.9rem;
  text-decoration: none !important;
  border: 0 !important;
  box-shadow: none !important;
  transition: background 0.18s ease;
  width: auto;
  max-width: 100%;
}

html body .neyl-ps .neyl-ps__cta:hover {
  background: var(--neyl-ps-sand) !important;
  color: #111 !important;
}

/* ---------- موبایل / تبلت — قاب ریلز ۹:۱۶ لب‌به‌لب ---------- */
@media (max-width: 900px) {
  .neyl-ps {
    /* عرض کامل گوشی، ارتفاع متناسب با عرض (نسبت ریلز) */
    width: 100vw;
    max-width: 100vw;
    margin-inline: calc(50% - 50vw);
    height: min(100dvh, calc(100vw * 16 / 9));
    min-height: 0;
    aspect-ratio: 9 / 16;
  }

  .neyl-ps__progress-track {
    inset-inline: 1rem;
    top: 1rem;
  }

  .neyl-ps__chapter-wrap {
    padding: 2.25rem 1rem 0;
  }

  .neyl-ps__bottom {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 0.65rem;
    padding: 0 1rem 0.85rem;
    z-index: 14;
  }

  .neyl-ps__title {
    order: 0;
    width: auto;
    max-width: 55%;
    font-size: clamp(1.35rem, 7vw, 1.85rem);
    opacity: 0.9;
  }

  .neyl-ps__spacer {
    display: none;
  }

  .neyl-ps__counter {
    order: 0;
    width: auto;
    padding-block: 0;
    justify-content: flex-end;
  }

  .neyl-ps__cursor {
    display: none !important;
  }

  /* ویجت شیشه‌ای ثابت در پایین تصویر */
  .neyl-ps__glass-wrap {
    align-items: flex-end;
    justify-content: center;
    padding: 0 0.75rem 0.85rem;
  }

  .neyl-ps__glass {
    /* ابعاد ثابت — با بزرگ‌تر شدن قاب رشد نمی‌کند */
    width: 100%;
    max-width: 22.5rem;
    border-radius: 18px;
    padding: 1.05rem 1.05rem 1.1rem;
    background:
      linear-gradient(
        160deg,
        rgba(255, 255, 255, 0.32) 0%,
        rgba(255, 255, 255, 0.12) 45%,
        rgba(255, 255, 255, 0.05) 100%
      ),
      rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(18px) saturate(180%);
    -webkit-backdrop-filter: blur(18px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.34);
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.4),
      0 14px 36px -20px rgba(0, 0, 0, 0.35);
  }

  .neyl-ps__badge {
    height: 28px;
    margin-bottom: 0.65rem;
    font-size: 11.5px;
    background: rgba(255, 255, 255, 0.14);
  }

  .neyl-ps__heading {
    font-size: 1.4rem;
    line-height: 1.3;
  }

  .neyl-ps__sub {
    margin-top: 0.45rem;
    font-size: 0.86rem;
    line-height: 1.65;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  html body .neyl-ps .neyl-ps__cta,
  html body .neyl-ps a.neyl-ps__cta {
    width: 100%;
    margin-top: 0.85rem;
    min-height: 44px;
  }

  /* عنوان/شمارنده به بالا تا ویجت آزادانه پایین تصویر بماند */
  .neyl-ps:has(.neyl-ps__glass) .neyl-ps__bottom {
    inset-inline: 0;
    top: 0;
    bottom: auto;
    align-items: flex-start;
    padding: 3.1rem 1rem 0;
    pointer-events: none;
  }

  .neyl-ps:has(.neyl-ps__glass) .neyl-ps__title {
    font-size: clamp(1.25rem, 6.5vw, 1.7rem);
    opacity: 0.88;
    text-shadow: 0 1px 10px rgba(0, 0, 0, 0.35);
  }

  .neyl-ps__heading {
    text-shadow: 0 1px 8px rgba(0, 0, 0, 0.28);
  }
}

@media (max-width: 520px) {
  .neyl-ps__glass-wrap {
    padding: 0 0.65rem 0.75rem;
  }

  .neyl-ps__glass {
    max-width: 22.5rem;
    border-radius: 16px;
    padding: 0.95rem 0.95rem 1rem;
  }

  .neyl-ps__sub {
    -webkit-line-clamp: 2;
    font-size: 0.84rem;
  }

  .neyl-ps__chapter {
    font-size: 0.7rem;
  }
}

/* coarse pointer (لمس واقعی) — همان چیدمان موبایل */
.neyl-ps.is-coarse .neyl-ps__bottom {
  flex-direction: column;
  align-items: stretch;
  gap: 0.65rem;
}

.neyl-ps.is-coarse .neyl-ps__title {
  order: 2;
  width: 100%;
}

.neyl-ps.is-coarse .neyl-ps__spacer {
  display: none;
}

.neyl-ps.is-coarse .neyl-ps__counter {
  order: 1;
  width: 100%;
  padding-block: 0;
}

.neyl-ps.is-coarse .neyl-ps__cursor {
  display: none !important;
}

.neyl-ps.is-coarse .neyl-ps__nav {
  cursor: pointer;
}

@media (min-width: 640px) and (max-width: 900px) {
  .neyl-ps__progress-track,
  .neyl-ps__chapter-wrap,
  .neyl-ps__bottom {
    padding-inline: 1.35rem;
  }

  .neyl-ps__glass-wrap {
    padding-inline: 1.15rem;
  }
}

.neyl-ps .is-off {
  display: none !important;
}

@media (min-width: 901px) {
  .neyl-ps__progress-track,
  .neyl-ps__chapter-wrap,
  .neyl-ps__bottom,
  .neyl-ps__glass-wrap {
    padding-inline: 2.5rem;
  }

  .neyl-ps__progress-track {
    inset-inline: 2.5rem;
    top: 2rem;
  }

  .neyl-ps__chapter-wrap {
    padding-top: 4rem;
  }
}

@media (min-width: 1024px) {
  .neyl-ps__glass-wrap {
    padding-inline: 4rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .neyl-ps__zoom,
  .neyl-ps__strip {
    will-change: auto;
  }
}
