/* phone-stories — دواير النتايج تحت الهيرو + عارض الستوري (الموبايل بس).
   العناصر دي بيعملها phone-stories.js؛ على الكمبيوتر ومن غير جافاسكربت مش موجودة أو مستخبية. */
.pst, .pstory { display: none; }

@media (max-width: 767px) {
  /* ================= الدواير ================= */
  html.phone-app .pst {
    display: block; position: relative; z-index: 1;
    padding: 6px 16px 34px;
  }
  html.phone-app .pst__head {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    margin: 0 0 14px; line-height: 1.3;
  }
  html.phone-app .pst__t {
    display: flex; align-items: center; gap: 9px;
    font-size: 15.5px; font-weight: 700; color: var(--text);
  }
  html.phone-app .pst__t::before {
    content: ""; flex: none; width: 7px; height: 7px; border-radius: 50%;
    background: var(--accent); box-shadow: 0 0 0 4px var(--tint-16);
  }
  html.phone-app .pst__hint { font-size: 12px; font-weight: 600; color: var(--text-2); white-space: nowrap; }

  html.phone-app .pst__rail {
    list-style: none; margin: 0 -16px; padding: 2px 16px 4px;
    display: grid; grid-auto-flow: column; grid-auto-columns: minmax(76px, 1fr); gap: 8px;
    overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-x pan-y; /* pan-x لوحده بيبلع السحب لفوق والصفحة بتتجمد */
  }
  html.phone-app .pst__rail::-webkit-scrollbar { display: none; }
  html.phone-app .pst__item { display: flex; justify-content: center; min-width: 0; }
  html.phone-app .pst__btn {
    display: flex; flex-direction: column; align-items: center; gap: 0;
    width: 100%; min-width: 64px; min-height: 44px; padding: 2px 0 4px;
    border-radius: 18px; text-align: center; -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
  }
  html.phone-app .pst__btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
  html.phone-app .pst__o {
    display: block; width: 70px; height: 70px; border-radius: 50%; padding: 2.5px;
    background: conic-gradient(from 40deg, #C4F82A, #E9FFA6 35%, #9ED61A 70%, #C4F82A);
    transition: transform .2s var(--ease);
  }
  html.phone-app .pst__btn:active .pst__o { transform: scale(.93); }
  html.phone-app .pst__c {
    position: relative; display: grid; place-items: center; width: 100%; height: 100%;
    border-radius: 50%; border: 3px solid var(--bg); overflow: hidden; background: #d9d9d6;
  }
  html.phone-app .pst__crop {
    position: absolute; inset: 0; background-size: 330%; background-repeat: no-repeat; filter: grayscale(.15);
  }
  html.phone-app .pst__c::after {
    content: ""; position: absolute; inset: 0;
    background: radial-gradient(circle, rgba(10,10,11,.64), rgba(10,10,11,.8));
  }
  html.phone-app .pst__x {
    position: relative; z-index: 2; direction: ltr; unicode-bidi: isolate;
    font-size: 17px; font-weight: 700; line-height: 1; color: #fff; letter-spacing: -.01em;
    font-feature-settings: "tnum" 1;
  }
  html.phone-app .pst__x em { font-style: normal; color: #C4F82A; margin-inline-start: 1px; }
  html.phone-app .pst__lab {
    margin-top: 7px; font-size: 12.5px; font-weight: 700; line-height: 1.25; color: var(--text); white-space: nowrap;
  }
  html.phone-app .pst__n { direction: ltr; unicode-bidi: isolate; font-feature-settings: "tnum" 1; }
  html.phone-app .pst__sub { font-size: 11px; line-height: 1.45; color: var(--text-3); white-space: nowrap; }
  /* اتشافت: خط رمادي رفيع والرقم باهت */
  html.phone-app .pst__item.is-seen .pst__o { background: var(--glass-brd-hi); padding: 1.25px; }
  html.phone-app .pst__item.is-seen .pst__c { border-width: 4.25px; }
  html.phone-app .pst__item.is-seen .pst__x { color: rgba(255,255,255,.72); }
  html.phone-app .pst__item.is-seen .pst__x em { color: rgba(196,248,42,.7); }
  html.phone-app .pst__item.is-seen .pst__lab { color: var(--text-2); }

  /* ================= العارض ================= */
  html.phone-app.story-open, html.phone-app.story-open body { overflow: hidden !important; }
  html.phone-app .pstory:not([hidden]) {
    /* جزيرة غامقة في الدارك واللايت */
    --s-bg: #0A0A0B; --s-1: #141416; --s-2: #1B1B1F;
    --s-line: rgba(255,255,255,.09); --s-line2: rgba(255,255,255,.14);
    --s-t1: #F5F5F4; --s-t2: #A1A1AA; --s-t3: #6B6B73; --s-lime: #C4F82A; --s-ink: #0A0A0B;
    position: fixed; inset: 0; z-index: 200;
    display: flex; flex-direction: column;
    padding: calc(env(safe-area-inset-top, 0px) + 10px) 16px calc(env(safe-area-inset-bottom, 0px) + 14px);
    background: radial-gradient(120% 50% at 50% -8%, rgba(196,248,42,.13), rgba(196,248,42,.035) 50%, transparent 72%), var(--s-bg);
    color: var(--s-t1);
    touch-action: none; overscroll-behavior: contain;
    -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent;
  }
  html.phone-app .pstory [hidden] { display: none !important; }
  /* صرفنا ← رجع والمضاعف: مكانهم محجوز من أول لقطة، وبيظهروا في دورهم */
  html.phone-app .pstory .is-wait { visibility: hidden; }

  /* شرايط التقدّم: واحد لكل لقطة */
  html.phone-app .pstory__bars { position: relative; z-index: 2; display: flex; gap: 4px; }
  html.phone-app .pstory__bars i { flex: 1; height: 3px; border-radius: 2px; background: rgba(255,255,255,.2); overflow: hidden; display: block; }
  html.phone-app .pstory__bars b { display: block; height: 100%; background: #fff; transform: scaleX(0); transform-origin: left center; }
  html.phone-app[dir="rtl"] .pstory__bars b { transform-origin: right center; }
  html.phone-app .pstory__bars i.is-done b { transform: scaleX(1); }

  /* الرأس */
  html.phone-app .pstory__head {
    position: relative; z-index: 2; display: flex; align-items: center; gap: 10px; margin-top: 10px; min-height: 44px;
  }
  html.phone-app .pstory__disc {
    flex: none; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center;
    background: var(--s-lime); color: var(--s-ink);
  }
  html.phone-app .pstory svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
  html.phone-app .pstory__who { flex: 1; min-width: 0; }
  html.phone-app .pstory__who b { display: block; font-size: 14.5px; font-weight: 700; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  html.phone-app .pstory__cur { color: var(--s-t2); font-weight: 500; }
  html.phone-app .pstory__count {
    display: inline-block; direction: ltr; unicode-bidi: isolate;
    font-size: 11.5px; letter-spacing: .08em; color: var(--s-t2); line-height: 1.4; font-feature-settings: "tnum" 1;
  }
  html.phone-app .pstory__ctl { flex: none; display: flex; gap: 2px; }
  html.phone-app .pstory__ctl button {
    width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; color: #fff; position: relative;
  }
  html.phone-app .pstory__ctl button::before {
    content: ""; position: absolute; inset: 4px; border-radius: 50%; background: rgba(255,255,255,.06); border: 1px solid var(--s-line);
  }
  html.phone-app .pstory__ctl svg { position: relative; width: 17px; height: 17px; }
  html.phone-app .pstory__ctl button:focus-visible { outline: 2px solid var(--s-lime); outline-offset: -2px; }

  /* المسرح: اللقطة، ثم صرفنا ← رجع، ثم المضاعف */
  html.phone-app .pstory__stage {
    position: relative; z-index: 0; flex: 1; min-height: 0;
    display: flex; flex-direction: column; justify-content: center; gap: 18px;
    padding: 14px 4px 16px;
    pointer-events: none;
  }
  html.phone-app .pstory__stage > * { translate: 0 var(--lift, 0px); transition: translate .56s cubic-bezier(0.22, 0.8, 0.2, 1); }
  html.phone-app .pstory__stage.is-still > * { transition: none; }
  html.phone-app .pstory__shotwrap { padding: 0 6px; }
  html.phone-app .pstory__shot {
    margin: 0; transform: rotate(-2deg); border-radius: 20px; background: var(--s-2); padding: 6px;
    box-shadow: 0 0 0 1px var(--s-line2), 0 34px 60px -24px rgba(0,0,0,.9);
  }
  html.phone-app[dir="ltr"] .pstory__shot { transform: rotate(2deg); }
  html.phone-app .pstory__bar {
    height: 30px; display: flex; align-items: center; justify-content: space-between; padding: 0 8px 2px;
    font-size: 11.5px; font-weight: 600; color: var(--s-t2);
  }
  html.phone-app .pstory__real { display: flex; align-items: center; gap: 7px; color: var(--s-t1); }
  html.phone-app .pstory__real i { width: 6px; height: 6px; border-radius: 50%; background: var(--s-lime); box-shadow: 0 0 0 3px rgba(196,248,42,.18); display: block; }
  html.phone-app .pstory__code { font-size: 11px; color: var(--s-t3); letter-spacing: .06em; direction: ltr; unicode-bidi: isolate; }
  html.phone-app .pstory__win { position: relative; height: 200px; border-radius: 14px; overflow: hidden; background: #fff; direction: ltr; }
  html.phone-app .pstory__layer { position: absolute; left: 0; top: 0; width: 100%; will-change: transform; }
  html.phone-app .pstory__win img { display: block; width: 100%; height: auto; max-width: none; }
  html.phone-app .pstory__scan {
    position: absolute; left: 0; right: 0; top: 0; height: 2px; background: var(--s-lime);
    box-shadow: 0 0 0 1px rgba(10,10,11,.25), 0 0 14px 2px rgba(196,248,42,.75);
    transform: translateY(var(--row, 0px));
  }
  html.phone-app .pstory__band { position: absolute; left: 0; right: 0; height: 22px; background: linear-gradient(180deg, rgba(196,248,42,.16), transparent); }
  html.phone-app .pstory__tag {
    position: absolute; height: 22px; padding: 0 9px; border-radius: 999px; display: flex; align-items: center;
    font-size: 11px; font-weight: 700; line-height: 1; white-space: nowrap;
    background: var(--s-ink); color: var(--s-t1);
  }
  html.phone-app .pstory__tag--out { background: var(--s-lime); color: var(--s-ink); }

  html.phone-app .pstory__ledger {
    display: flex; align-items: center; min-height: 68px; border-radius: 18px; padding: 8px 16px;
    background: var(--s-1); border: 1px solid var(--s-line);
  }
  html.phone-app .pstory__col { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; align-items: flex-start; }
  html.phone-app .pstory__col--out { align-items: flex-end; }
  html.phone-app .pstory__col small { font-size: 12px; font-weight: 600; color: var(--s-t2); }
  html.phone-app .pstory__col--out small { color: var(--s-lime); }
  html.phone-app .pstory__col strong { display: flex; align-items: baseline; gap: 5px; font-size: 20px; font-weight: 700; line-height: 1.25; white-space: nowrap; }
  html.phone-app .pstory__col--out strong { color: var(--s-lime); }
  html.phone-app .pstory__col strong > span[dir] { direction: ltr; unicode-bidi: isolate; font-feature-settings: "tnum" 1; }
  html.phone-app .pstory__u { font-size: 12px; font-weight: 600; color: var(--s-t2); }
  html.phone-app .pstory__arr {
    flex: none; width: 32px; height: 32px; margin: 0 10px; border-radius: 50%; display: grid; place-items: center;
    background: var(--s-2); border: 1px solid var(--s-line2); color: var(--s-t1);
  }
  html.phone-app .pstory__arr svg { width: 16px; height: 16px; stroke-width: 2.1; }
  html.phone-app[dir="rtl"] .pstory__arr svg { transform: scaleX(-1); }

  html.phone-app .pstory__big { display: flex; align-items: center; gap: 14px; padding: 0 2px; }
  html.phone-app .pstory__x {
    flex: none; direction: ltr; unicode-bidi: isolate; font-size: 104px; font-weight: 700; line-height: 1;
    letter-spacing: -.04em; font-feature-settings: "tnum" 1;
  }
  html.phone-app .pstory__x em { font-style: normal; color: var(--s-lime); font-size: .62em; margin-inline-start: 2px; letter-spacing: 0; }
  html.phone-app .pstory__each { min-width: 0; font-size: 17px; font-weight: 700; line-height: 1.35; color: var(--s-lime); }
  html.phone-app .pstory__each small { display: block; margin-top: 3px; font-size: 13px; font-weight: 500; color: var(--s-t2); }

  /* مناطق الضغط: تلت البداية = اللي قبلها، الباقي = اللي بعدها (بتتعكس مع اتجاه القراية) */
  html.phone-app .pstory__zone { position: absolute; z-index: 1; top: 0; bottom: 0; background: transparent; }
  html.phone-app .pstory__zone--prev { inset-inline-start: 0; width: 33.34%; }
  html.phone-app .pstory__zone--next { inset-inline-end: 0; width: 66.66%; }
  html.phone-app .pstory__zone:focus-visible { outline: 2px solid var(--s-lime); outline-offset: -6px; border-radius: 22px; }

  /* شريط الرد = زرار الحجز */
  html.phone-app .pstory__reply {
    position: relative; z-index: 2; flex: none;
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    height: 60px; border-radius: 999px; padding-inline: 20px 6px;
    background: var(--s-1); border: 1px solid var(--s-line2);
  }
  html.phone-app .pstory__ask { min-width: 0; font-size: 15px; font-weight: 600; color: var(--s-t1); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  html.phone-app .pstory__book {
    flex: none; display: inline-flex; align-items: center; gap: 8px; height: 48px; padding: 0 18px;
    border-radius: 999px; background: var(--s-lime); color: var(--s-ink); font-size: 14.5px; font-weight: 700; white-space: nowrap;
  }
  html.phone-app .pstory__book svg { width: 18px; height: 18px; }
  html.phone-app[dir="rtl"] .pstory__book svg { transform: scaleX(-1); }
  html.phone-app .pstory__book:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

  /* الحركة مقفولة: مفيش ساعة — الشريط الحالي مليان وزرار الإيقاف ملوش لازمة */
  @media (prefers-reduced-motion: reduce) {
    html.phone-app .pstory__bars i.is-now b { transform: scaleX(1); }
    html.phone-app .pstory__pause { display: none !important; }
    html.phone-app .pst__o { transition: none; }
  }
}

/* موبايلات قصيرة: كل لقطة تخلص فوق شريط الرد */
@media (max-width: 767px) and (max-height: 720px) {
  html.phone-app .pstory__stage { gap: 12px; padding-block: 8px 10px; }
  html.phone-app .pstory__bar { height: 26px; }
  html.phone-app .pstory__ledger { min-height: 58px; padding-block: 6px; }
  html.phone-app .pstory__col strong { font-size: 18px; }
  html.phone-app .pstory__x { font-size: 78px; }
  html.phone-app .pstory__each { font-size: 15px; }
  html.phone-app .pstory__each small { font-size: 12px; }
  html.phone-app .pstory__reply { height: 56px; }
  html.phone-app .pstory__book { height: 44px; }
}
