/* دسته‌بندی رویدادها (cx-*) — فایل مستقل، توکن‌های تم؛ Light/Dark */
.cx { --cx-card: #fff; --cx-line: rgba(106, 68, 234, .08); --cx-ink: #14102f; --cx-mut: #6b6880; --cx-acc: #5b3fd8;
  --cx-sh: 0 8px 24px -14px rgba(60, 40, 140, .35); color: var(--cx-ink); min-height: 60vh; padding-bottom: 6rem; }
.dark .cx { --cx-card: rgba(255, 255, 255, .06); --cx-line: rgba(255, 255, 255, .1); --cx-ink: #f4f2ff; --cx-mut: #a7a3c4; --cx-acc: #8b6dff; --cx-sh: 0 10px 26px -16px rgba(0, 0, 0, .8); }

/* ── هیرو ── */
.cx-hero { position: relative; overflow: hidden; padding: 18px 16px 18px;
  background: linear-gradient(180deg, #e9e2fc 0%, #f1ecfd 55%, rgba(241, 236, 253, 0) 100%); }
.dark .cx-hero { background: linear-gradient(180deg, rgba(106, 68, 234, .28) 0%, rgba(106, 68, 234, .1) 60%, transparent 100%); }
.cx-hero__in { position: relative; max-width: 72rem; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 118px; }
.cx-hero__txt { position: relative; z-index: 1; flex: 1 1 auto; min-width: 0; text-align: start; }
.cx-hero__t { margin: 0; font-size: clamp(1.7rem, 7.4vw, 2.5rem); line-height: 1.35; font-weight: 900; letter-spacing: 0; }
.cx-hero__d { margin: 4px 0 0; font-size: .85rem; line-height: 1.8; color: var(--cx-mut); }
.cx-hero__art { flex: none; width: clamp(120px, 38vw, 190px); height: auto; margin-inline-start: -14px; filter: drop-shadow(0 14px 18px rgba(91, 63, 216, .25)); }
.cx-hero__t1 { transform-origin: 70px 52px; animation: cxFloatA 6s ease-in-out infinite; }
.cx-hero__t2 { transform-origin: 112px 88px; animation: cxFloatB 6s ease-in-out infinite; }
@keyframes cxFloatA { 50% { transform: rotate(-16deg) translateY(-3px); } }
@keyframes cxFloatB { 50% { transform: rotate(-6deg) translateY(3px); } }

/* ── جستجو ── */
.cx-search { position: relative; z-index: 1; max-width: 72rem; margin: 14px auto 0; display: flex; align-items: center; gap: 8px; padding: 0 14px;
  height: 46px; border-radius: 999px; background: var(--cx-card); box-shadow: var(--cx-sh); border: 1px solid var(--cx-line); }
.dark .cx-search { background: rgba(255, 255, 255, .08); }
.cx-search__btn { flex: none; display: grid; place-items: center; width: 28px; height: 28px; border: 0; background: transparent; color: var(--cx-mut); cursor: pointer; }
.cx-search__btn svg { width: 20px; height: 20px; }
.cx-search__in { flex: 1 1 auto; min-width: 0; height: 100%; border: 0; background: transparent; color: var(--cx-ink); font: inherit; font-size: .88rem; outline: none; }
.cx-search__in::placeholder { color: var(--cx-mut); }
.cx-search:focus-within { box-shadow: 0 0 0 3px rgba(91, 63, 216, .22), var(--cx-sh); }

/* ── بدنه ── */
.cx-body { max-width: 72rem; margin: 0 auto; padding: 0 14px; }
.cx-chips { display: flex; gap: 5px; margin: 6px 0 14px; padding: 2px 2px 6px; overflow-x: auto; scrollbar-width: none; }
.cx-chips::-webkit-scrollbar { display: none; }
.cx-pill { flex: none; display: inline-flex; align-items: center; gap: 4px; height: 36px; padding: 0 8px; border: 1px solid transparent; border-radius: 999px;
  background: color-mix(in srgb, var(--cx-ink) 5%, var(--cx-card)); color: var(--cx-ink); font: inherit; font-size: .7rem; font-weight: 700; cursor: pointer;
  box-shadow: 0 6px 14px -10px rgba(60, 40, 140, .35); transition: background .2s, color .2s, transform .15s, box-shadow .2s; white-space: nowrap; }
.cx-pill svg { width: 15px; height: 15px; flex: none; color: var(--cx-acc); transition: color .2s; }
.cx-pill:hover { transform: translateY(-1px); }
.cx-pill:active { transform: scale(.96); }
.cx-pill.is-on { background: linear-gradient(135deg, #6a44ea, #5336cc); color: #fff; box-shadow: 0 10px 20px -10px rgba(91, 63, 216, .7); }
.cx-pill.is-on svg { color: #fff; }
.cx-pill:focus-visible { outline: 2px solid var(--cx-acc); outline-offset: 2px; }

/* ── شبکهٔ کارت‌ها ── */
.cx-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
@media (min-width: 640px) { .cx-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; } }
@media (min-width: 1024px) { .cx-grid { gap: 14px; } }
.cx-li { display: flex; opacity: 0; animation: cxIn .5s cubic-bezier(.2, .8, .2, 1) forwards; animation-delay: calc(var(--i) * 45ms); }
@keyframes cxIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

.cx-card { position: relative; flex: 1 1 auto; display: flex; align-items: center; gap: 6px; min-height: 64px; padding: 8px 8px; border-radius: 16px;
  background: var(--cx-card); border: 1px solid var(--cx-line); box-shadow: var(--cx-sh); color: inherit; text-decoration: none;
  transition: transform .22s cubic-bezier(.2, .8, .2, 1), box-shadow .22s; -webkit-tap-highlight-color: transparent; overflow: hidden; }
.cx-card:hover { transform: translateY(-3px); box-shadow: 0 16px 30px -16px rgba(60, 40, 140, .5); }
.cx-card:active { transform: scale(.975); }
.cx-card:focus-visible { outline: 2px solid var(--cx-acc); outline-offset: 2px; }

.cx-chip { order: 1; flex: none; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 10px; background: var(--tb); color: var(--tf); transition: transform .25s; }
.dark .cx-chip { background: color-mix(in srgb, var(--tf) 22%, transparent); }
.cx-chip svg { width: 17px; height: 17px; }
.cx-card:hover .cx-chip { transform: scale(1.08) rotate(-4deg); }
.cx-card__txt { order: 2; flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; text-align: start; }
.cx-card__name { font-size: .74rem; font-weight: 800; line-height: 1.45; word-break: normal; overflow-wrap: break-word; hyphens: manual; }
.cx-card__name.is-long { font-size: .66rem; }
.cx-card__n { display: inline-flex; align-items: center; gap: 4px; font-size: .66rem; white-space: nowrap; color: var(--cx-mut); }
.cx-live { width: 6px; height: 6px; border-radius: 50%; background: #00c2a8; box-shadow: 0 0 0 0 rgba(0, 194, 168, .6); animation: cxPulse 1.8s infinite; }
@keyframes cxPulse { 70% { box-shadow: 0 0 0 6px rgba(0, 194, 168, 0); } 100% { box-shadow: 0 0 0 0 rgba(0, 194, 168, 0); } }

/* دسته‌پوستر (چپِ کارت) */
.cx-stack { order: 3; position: relative; flex: none; width: 46px; height: 40px; }
.cx-stack__p { position: absolute; bottom: 0; width: 26px; height: 34px; border-radius: 6px; overflow: hidden; background: linear-gradient(135deg, #cfc4f7, #a998ee);
  box-shadow: 0 6px 10px -4px rgba(20, 10, 60, .45); transition: transform .3s cubic-bezier(.2, .8, .2, 1); }
.cx-stack__p img { display: block; width: 100%; height: 100%; object-fit: cover; }
.cx-stack__p--0 { left: 16px; z-index: 3; transform: rotate(6deg); width: 29px; height: 38px; }
.cx-stack__p--1 { left: 8px; z-index: 2; transform: rotate(-8deg) scale(.9); }
.cx-stack__p--2 { left: 0; z-index: 1; transform: rotate(-17deg) scale(.8); opacity: .95; }
.cx-card:hover .cx-stack__p--0 { transform: rotate(9deg) translateY(-3px); }
.cx-card:hover .cx-stack__p--1 { transform: rotate(-14deg) translate(-3px, -1px) scale(.9); }
.cx-card:hover .cx-stack__p--2 { transform: rotate(-24deg) translate(-5px, 1px) scale(.8); }
.cx-stack__p--empty { background: linear-gradient(135deg, #d9d0f9, #b7a8f0); }

.cx-card__go { order: 4; flex: none; display: grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; background: var(--cx-card); border: 1px solid var(--cx-line); color: var(--cx-mut);
  box-shadow: 0 3px 8px -4px rgba(60, 40, 140, .4); transition: transform .2s, background .2s, color .2s; }
.cx-card__go svg { width: 11px; height: 11px; }
.cx-card:hover .cx-card__go { background: var(--cx-acc); color: #fff; transform: translateX(-3px); }

.cx-empty { margin: 18px 0; text-align: center; font-size: .85rem; color: var(--cx-mut); }
[x-cloak] { display: none !important; }

/* دسکتاپ: فضای بیشتر */
@media (min-width: 768px) {
  .cx-card__name.is-long { font-size: .9rem; }
  .cx-pill { padding: 0 16px; gap: 7px; font-size: .85rem; height: 40px; } .cx-pill svg { width: 18px; height: 18px; } .cx-chips { gap: 8px; }
  .cx-hero { padding: 28px 24px 26px; }
  .cx-hero__in { min-height: 150px; }
  .cx-hero__d { font-size: 1rem; }
  .cx-search { height: 54px; padding: 0 20px; }
  .cx-search__in { font-size: 1rem; }
  .cx-card { min-height: 92px; padding: 12px 14px; gap: 12px; }
  .cx-chip { width: 46px; height: 46px; border-radius: 14px; } .cx-chip svg { width: 25px; height: 25px; }
  .cx-card__name { font-size: .98rem; }
.cx-card__n { font-size: .8rem; }
  .cx-stack { width: 84px; height: 66px; }
  .cx-stack__p { width: 46px; height: 60px; border-radius: 9px; }
  .cx-stack__p--0 { left: 28px; width: 52px; height: 66px; } .cx-stack__p--1 { left: 13px; } .cx-stack__p--2 { left: 0; }
  .cx-card__go { width: 28px; height: 28px; }
}
@media (prefers-reduced-motion: reduce) {
  .cx-li { animation: none; opacity: 1; } .cx-hero__t1, .cx-hero__t2, .cx-live { animation: none; }
  .cx-card, .cx-stack__p, .cx-chip { transition: none; }
}

/* صفحهٔ نخست: همان کارت‌ها، بدونِ هیرو */
.cx--home { min-height: 0; padding-bottom: 0; background: transparent; }
.cx--home .cx-grid { gap: 9px; }
.cx-more { display: inline-flex; align-items: center; gap: 6px; font-size: .9rem; font-weight: 700; color: var(--cx-mut); white-space: nowrap; text-decoration: none; }
.cx-more svg { width: 16px; height: 16px; }
.cx-more:hover { color: var(--cx-acc); }
