/* ═══ اليوميات ═══ */
/* text-card colours (also the poll card) */

/* the row of circles */
.stories { display: grid; gap: 8px; grid-template-columns: minmax(0, 1fr); min-width: 0; }
.stories__head { display: flex; align-items: center; justify-content: space-between; padding-inline: 2px; }
.stories__head b { display: inline-flex; align-items: center; gap: 6px; font-size: 15px; }
.stories__head b .i { color: var(--primary); }
.stories__wrap { position: relative; min-width: 0; }
.stories__row { display: flex; gap: 14px; overflow-x: auto; padding: 4px 2px 6px; scroll-snap-type: x proximity; scrollbar-width: none; overscroll-behavior-x: contain; }
.stories__row::-webkit-scrollbar { display: none; }
.st-item { flex: none; width: 74px; display: grid; justify-items: center; gap: 6px; background: none; border: 0; padding: 0; color: var(--ink); cursor: pointer; scroll-snap-align: start; font: inherit; }
.st-face { position: relative; width: 70px; height: 70px; display: block; }
.st-ring { position: absolute; inset: 0; width: 100%; height: 100%; }
.st-ring path, .st-ring circle { fill: none; stroke-width: 5; stroke-linecap: round; stroke: #8E8EC8; transition: stroke .3s; }
.st-item:not(.all-seen) .st-ring :is(path, circle):not(.seen) { stroke: var(--primary); }
.st-ring .seen, .all-seen .st-ring :is(path, circle) { stroke: var(--line-2); }
.st-pic { position: absolute; inset: 6px; border-radius: 50%; overflow: hidden; background: var(--surface-2); border: 2px solid var(--bg); display: grid; place-items: center; }
.st-pic img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s; }
.st-item:hover .st-pic img { transform: scale(1.08); }
.st-ini { width: 100%; height: 100%; display: grid; place-items: center; font-weight: 700; font-size: 22px; color: #fff; background: var(--c, var(--primary)); }
.st-pin { position: absolute; bottom: -2px; inset-inline-end: -2px; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--primary); color: #fff; border: 2px solid var(--bg); }
.st-pin .i { width: 12px; height: 12px; }
.st-name { max-width: 74px; font-size: 12px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.st-item:not(.all-seen) .st-name { color: var(--ink); font-weight: 700; }
.st-item.skel .st-face { border-radius: 50%; background: var(--surface-2); animation: skel 1.4s ease-in-out infinite; }
.st-item.skel .st-name { width: 44px; height: 10px; border-radius: 5px; background: var(--surface-2); }
@keyframes skel { 50% { opacity: .5; } }
.st-arrow { position: absolute; top: 22px; z-index: 2; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-2); color: var(--ink-2); cursor: pointer; }
.st-arrow[hidden] { display: none; }
.st-arrow.prev { inset-inline-start: -6px; }
.st-arrow.next { inset-inline-end: -6px; }
.st-arrow:hover { color: var(--primary); }

/* a post's content (viewer and feed) */
.pm { position: relative; display: grid; place-items: center; overflow: hidden; background: #111522; }
.pm img, .pm video { width: 100%; height: 100%; object-fit: contain; display: block; }
.pm.is-loading::after { content: ""; position: absolute; width: 34px; height: 34px; border-radius: 50%; border: 3px solid rgba(255, 255, 255, .25); border-top-color: #fff; animation: spin .8s linear infinite; }
.pm.is-broken::after { content: "تعذر التحميل"; border: 0; animation: none; width: auto; height: auto; color: rgba(255, 255, 255, .7); font-size: 13px; }
@keyframes spin { to { transform: rotate(360deg); } }
.pm-text { background: var(--pb); color: #fff; padding: 28px 22px; }
.pm-text > p { margin: 0; font-size: 24px; line-height: 1.6; font-weight: 700; text-align: center; white-space: pre-wrap; text-shadow: 0 1px 12px rgba(0, 0, 0, .12); max-width: 34ch; }
.pm-text > p.mid { font-size: 20px; }
.pm-text > p.long { font-size: 16px; line-height: 1.8; font-weight: 400; }
/* poll */
.sv__poll { width: min(100%, 420px); display: grid; gap: 10px; }
.poll__q { display: flex; gap: 8px; align-items: center; justify-content: center; font-weight: 700; font-size: 18px; line-height: 1.5; text-align: center; margin-bottom: 4px; }
.poll__o { position: relative; display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 0 16px; border-radius: 14px; overflow: hidden; border: 1px solid rgba(255, 255, 255, .5); background: rgba(255, 255, 255, .16); color: #fff; font: inherit; font-weight: 700; text-align: start; cursor: pointer; isolation: isolate; }
.poll__o i { position: absolute; inset-block: 0; inset-inline-start: 0; z-index: -1; background: rgba(255, 255, 255, .28); transition: width .6s var(--ease); }
.poll__o.mine { border-color: #fff; background: rgba(255, 255, 255, .24); }
.poll__o.mine::before { content: "✓"; }
.poll__o:not(.done):hover { background: rgba(255, 255, 255, .26); }
.poll__n { text-align: center; font-size: 12.5px; opacity: .85; }

/* full-screen viewer */
.sv { position: fixed; inset: 0; z-index: 85; background: rgba(8, 10, 20, .94); display: grid; place-items: center; opacity: 0; transition: opacity .2s; touch-action: none; user-select: none; -webkit-user-select: none; }
.sv.open { opacity: 1; }
.sv__stage { position: relative; width: 100%; height: 100%; max-width: 480px; display: grid; grid-template-rows: auto 1fr auto; overflow: hidden; background: #0C0F1C; color: #fff; transform: scale(.96); transition: transform .3s var(--ease); }
.sv.open .sv__stage { transform: none; }
@media (min-width: 720px) { .sv__stage { height: min(92dvh, 860px); border-radius: 22px; box-shadow: 0 30px 90px rgba(0, 0, 0, .5); } }
.sv__media { grid-row: 1 / -1; grid-column: 1; display: grid; }
.sv__media > .pm { width: 100%; height: 100%; }
.sv__bars { position: absolute; z-index: 3; inset: 0 0 auto; display: flex; gap: 4px; padding: calc(var(--safe-t) + 10px) 10px 0; direction: rtl; }
.sv__bars i { flex: 1; height: 3px; border-radius: 2px; background: rgba(255, 255, 255, .32); overflow: hidden; }
.sv__bars b { display: block; height: 100%; background: #fff; border-radius: 2px; }
.sv__top { position: absolute; z-index: 3; inset: 0 0 auto; display: flex; align-items: center; gap: 10px; padding: calc(var(--safe-t) + 22px) 12px 26px; background: linear-gradient(rgba(0, 0, 0, .5), transparent); }
.sv__top b { font-size: 14px; }
.sv__title, .sv__time { font-size: 12px; opacity: .75; }
.sv__btn { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; color: #fff; background: none; border: 0; cursor: pointer; }
.sv__btn:hover { background: rgba(255, 255, 255, .14); }
.sv__foot { position: absolute; z-index: 3; inset: auto 0 0; display: grid; gap: 8px; padding: 30px 14px calc(var(--safe-b) + 14px); background: linear-gradient(transparent, rgba(0, 0, 0, .6)); }
.sv__cap { margin: 0; font-size: 14.5px; line-height: 1.7; max-height: 5.2em; overflow: auto; }
.sv__acts { display: flex; gap: 6px; }
.sv__act { display: inline-flex; align-items: center; gap: 6px; min-width: 44px; height: 42px; padding: 0 12px; border-radius: 21px; border: 0; background: rgba(255, 255, 255, .14); color: #fff; font: inherit; font-weight: 700; cursor: pointer; }
.sv__act:hover { background: rgba(255, 255, 255, .22); }
.sv__act:disabled { opacity: .45; }
.sv__act.on .i { fill: #F06A8A; stroke: #F06A8A; }
.sv__act .num:empty { display: none; }
.sv__nav { position: absolute; z-index: 3; top: 50%; translate: 0 -50%; width: 42px; height: 42px; border-radius: 50%; border: 0; display: none; place-items: center; background: rgba(255, 255, 255, .16); color: #fff; cursor: pointer; }
.sv__nav.prev { inset-inline-start: 10px; }
.sv__nav.next { inset-inline-end: 10px; }
.sv__nav:disabled { opacity: .3; }
@media (hover: hover) and (pointer: fine) { .sv__nav { display: grid; } .sv__nav:hover { background: rgba(255, 255, 255, .28); } }
@media (min-width: 720px) { .sv__nav.prev { inset-inline-start: calc(50% - 240px - 58px); } .sv__nav.next { inset-inline-end: calc(50% - 240px - 58px); } .sv__stage { overflow: visible; } .sv__stage > .sv__media { border-radius: 22px; overflow: hidden; } }
.sv.paused .sv__bars { opacity: .5; }
.sv__heart { position: absolute; z-index: 4; inset: 0; display: grid; place-items: center; pointer-events: none; opacity: 0; }
.sv__heart .i { width: 110px; height: 110px; fill: #fff; stroke: none; filter: drop-shadow(0 6px 24px rgba(0, 0, 0, .35)); }
.sv__heart.pop { animation: heart-pop .8s var(--ease); }
@keyframes heart-pop { 0% { opacity: 0; transform: scale(.4); } 15% { opacity: 1; transform: scale(1.1); } 30% { transform: scale(.95); } 70% { opacity: 1; transform: scale(1); } 100% { opacity: 0; transform: scale(1.1); } }
@media (prefers-reduced-motion: reduce) { .sv, .sv__stage, .poll__o i { transition: none; } .sv__heart.pop { animation-duration: .01s; } }

/* comments */
.cm-list { display: grid; gap: 12px; min-height: 120px; max-height: 52dvh; overflow-y: auto; }
.cm { display: flex; gap: 10px; align-items: flex-start; }
.cm p { margin: 2px 0 0; line-height: 1.7; font-size: 14px; white-space: pre-wrap; overflow-wrap: anywhere; }
.cm__h { display: flex; gap: 8px; align-items: baseline; }
.cm-new { display: flex; gap: 8px; align-items: flex-end; width: 100%; }
.cm-new .textarea { flex: 1; min-height: 44px; resize: none; }
.cm-new .btn { flex: none; width: 48px; padding: 0; }

/* new post */
.pc-pick { display: grid; place-items: center; gap: 6px; width: 100%; min-height: 200px; border-radius: 20px; border: 2px dashed var(--line-2); background: var(--surface-2); color: var(--ink-2); cursor: pointer; overflow: hidden; padding: 16px; font: inherit; }
.pc-pick .i-l { width: 40px; height: 40px; color: var(--primary); }
.pc-pick.has { padding: 0; border-style: solid; background: #111522; max-height: 52dvh; }
.pc-pick img, .pc-pick video { width: 100%; max-height: 52dvh; object-fit: contain; display: block; }
.pc-preview { border-radius: 20px; min-height: 220px; }
.pc-preview textarea { width: 100%; min-height: 160px; border: 0; background: transparent; color: #fff; font: inherit; font-size: 21px; font-weight: 700; line-height: 1.6; text-align: center; resize: none; outline: none; }
.pc-preview textarea::placeholder { color: rgba(255, 255, 255, .7); }
.pc-bgs { display: flex; gap: 10px; flex-wrap: wrap; }
.pc-bg { width: 36px; height: 36px; border-radius: 50%; border: 3px solid var(--surface); background: var(--pb); box-shadow: 0 0 0 1px var(--line); cursor: pointer; }
.pc-bg.on { box-shadow: 0 0 0 2px var(--primary); }
.pc-tpl { display: flex; gap: 8px; flex-wrap: wrap; }
.pc-opts { display: grid; gap: 8px; }
.btn.busy { opacity: .7; pointer-events: none; }

/* the page: one card per post */
.feed { display: grid; gap: 18px; grid-template-columns: minmax(0, 1fr); max-width: 560px; margin-inline: auto; }
@media (min-width: 1100px) { .feed { max-width: none; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); align-items: start; } }
.post { display: grid; border-radius: 22px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-1); overflow: hidden; }
.post.skel { height: 420px; background: var(--surface-2); animation: skel 1.4s ease-in-out infinite; }
.post__h { display: flex; align-items: center; gap: 10px; padding: 10px 12px; }
.post__h b { font-size: 14px; }
.post__m { cursor: pointer; }
.post__m > .pm { aspect-ratio: 4 / 5; max-height: 70dvh; }
.post__m > .pm-text { aspect-ratio: 1; }
.post__a { display: flex; gap: 4px; padding: 6px 8px 0; }
.post__btn { display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 10px; border-radius: 12px; border: 0; background: none; color: var(--ink); font: inherit; font-weight: 700; cursor: pointer; }
.post__btn:hover { background: var(--hover); }
.post__btn.on .i { fill: #E0516F; stroke: #E0516F; }
.post__btn:disabled { opacity: .4; }
.post__btn .num:empty { display: none; }
.post__cap { margin: 4px 14px 0; font-size: 14px; line-height: 1.7; white-space: pre-wrap; }
.post__more { justify-self: start; margin: 2px 8px 0; padding: 6px; border: 0; background: none; color: var(--ink-3); font: inherit; font-size: 13px; cursor: pointer; }
.post > :last-child { margin-bottom: 12px; }

/* ═══ 1.10 ═══ */
/* clean circles: nothing behind them, just the picture inside the ring */
.st-pic { background: transparent; border: 0; inset: 7px; }
.st-pic .st-ini { border-radius: 50%; }
.st-pin { border-color: var(--bg); }
/* elegant arrows over a soft fade at the edges, only when there are more circles */
.stories__wrap:has(.st-arrow.prev:not([hidden]))::before, .stories__wrap:has(.st-arrow.next:not([hidden]))::after { opacity: 1; }
.st-arrow { top: 20px; width: 32px; height: 32px; border: 0; background: color-mix(in srgb, var(--surface) 82%, transparent); backdrop-filter: blur(8px); box-shadow: 0 4px 14px rgba(38, 44, 72, .16); color: var(--primary); transition: transform .15s; }
.st-arrow:hover { transform: scale(1.08); }
.st-arrow.prev { inset-inline-start: 2px; } .st-arrow.next { inset-inline-end: 2px; }
/* duration choice */
.seg.hours { display: grid; grid-template-columns: repeat(4, 1fr); width: 100%; }
.seg.hours button { justify-content: center; }
/* on the story: the latest comments float up (well under a quarter of the screen) */
.sv__live { display: grid; gap: 6px; justify-items: start; max-height: 22dvh; overflow: hidden; padding: 0; border: 0; background: none; color: #fff; font: inherit; text-align: start; cursor: pointer; -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 22%); mask-image: linear-gradient(to bottom, transparent 0, #000 22%); }
.live-c { max-width: 88%; padding: 6px 12px; border-radius: 16px; background: rgba(15, 18, 36, .42); backdrop-filter: blur(6px); font-size: 13.5px; line-height: 1.6; opacity: 0; animation: live-in .5s var(--ease) forwards; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.live-c b { font-weight: 700; margin-inline-end: 4px; }
.live-c.empty { display: inline-flex; gap: 6px; align-items: center; opacity: .0; }
.live-more { font-size: 12px; opacity: .85; padding: 0 6px; }
@keyframes live-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.sv__left { margin-inline-start: auto; align-self: center; font-size: 12px; opacity: .8; }
/* the full thread slides up inside the story */
.sv__panel { position: absolute; z-index: 6; inset: auto 0 0; height: 62%; display: flex; flex-direction: column; border-radius: 22px 22px 0 0; background: var(--surface); color: var(--ink); box-shadow: 0 -20px 50px rgba(0, 0, 0, .35); transform: translateY(100%); transition: transform .3s var(--ease); padding-bottom: var(--safe-b); }
.sv__panel.open { transform: none; }
.sv__panel-h { display: flex; align-items: center; gap: 8px; padding: 10px 14px 6px; }
.sv__panel .sv__btn { color: var(--ink-2); }
.sv__panel .cm-box { flex: 1; min-height: 0; display: flex; flex-direction: column; padding: 0 14px 12px; }
.sv__panel .cm-list { flex: 1; max-height: none; }
/* threads */
.cm-box { display: grid; gap: 10px; }
.cm-list { display: grid; align-content: start; gap: 14px; max-height: 56dvh; overflow-y: auto; overscroll-behavior: contain; padding: 4px 2px; }
.cm.is-reply { margin-inline-start: 34px; }
.cm.is-reply .avatar { width: 26px; height: 26px; font-size: 11px; }
.cm__to { display: inline-flex; align-items: center; gap: 3px; font-size: 11.5px; color: var(--primary); }
.cm__to .i { width: 12px; height: 12px; }
.cm__acts { display: flex; gap: 14px; margin-top: 2px; }
.cm__btn { padding: 0; border: 0; background: none; color: var(--ink-3); font: inherit; font-size: 12px; font-weight: 700; cursor: pointer; }
.cm__btn:hover { color: var(--primary); }
.cm-empty { display: flex; align-items: center; gap: 6px; justify-content: center; padding: 18px; color: var(--ink-3); font-size: 13.5px; }
.cm-to { display: flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 12px; background: var(--primary-soft); color: var(--primary); font-size: 12.5px; font-weight: 700; }
.cm-to[hidden] { display: none; }
.cm-to__x { margin-inline-start: auto; border: 0; background: none; color: inherit; cursor: pointer; display: grid; }
.cm-off { margin: 0; text-align: center; }
/* the page: one post under another, never wider than a phone, with its comments under it */
.feed, .feed { max-width: 440px !important; grid-template-columns: minmax(0, 1fr) !important; margin-inline: auto; }
.post__cm { display: grid; gap: 4px; padding: 6px 14px 0; }
.pc-line { margin: 0; font-size: 13.5px; line-height: 1.7; overflow-wrap: anywhere; }
.pc-line.is-reply { padding-inline-start: 14px; border-inline-start: 2px solid var(--line-2); color: var(--ink-2); }
.pc-open { display: flex; align-items: center; gap: 6px; width: 100%; min-height: 38px; margin-top: 6px; padding: 0 14px; border: 1px solid var(--line); border-radius: 19px; background: var(--surface-2); color: var(--ink-3); font: inherit; font-size: 13.5px; text-align: start; cursor: text; }
.post__life { padding: 6px 14px 0; }
.post__more { margin: 0; padding: 2px 0; }

/* 1.11 — smaller, softer circles */
.stories__row { gap: 12px; }
.st-item { width: 62px; gap: 5px; }
.st-face { width: 58px; height: 58px; }
.st-ring path, .st-ring circle { stroke-width: 3.5; }
.st-pic { inset: 5px; border-width: 1.5px; }
.st-ini { font-size: 18px; }
.st-pin { width: 18px; height: 18px; }
.st-pin .i { width: 10px; height: 10px; }
.st-name { max-width: 62px; font-size: 11.5px; }
@media (min-width: 960px) { .st-item { width: 68px; } .st-face { width: 64px; height: 64px; } .st-name { max-width: 68px; } }

/* the text post's colours: a light tray of small dots, set apart from the card */
.pc-bgs { justify-content: center; gap: 8px; margin-top: 12px; padding: 8px 12px; border-radius: 999px; background: var(--surface-2); width: fit-content; margin-inline: auto; flex-wrap: nowrap; }
.pc-bg { width: 26px; height: 26px; border: 2px solid var(--surface); box-shadow: 0 1px 4px rgba(38, 44, 72, .16); transition: transform .15s var(--spring), box-shadow .15s; }
.pc-bg:hover { transform: scale(1.08); }
.pc-bg.on { transform: scale(1.12); box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--primary); }

/* 1.14 — brighter, lit-up colours for text posts */
.pbg-lav { --pb: #7D6DE0; }
.pbg-sky { --pb: #3F98DA; }
.pbg-mint { --pb: #2FAE84; }
.pbg-peach { --pb: #F08A3E; }
.pbg-rose { --pb: #E8668A; }
.pbg-night { --pb: #2E3483; }
/* 1.16 — the home strip's own small buttons: «نشر» and «عرض» */
.stories__head { gap: 6px; }
.st-chip { display: inline-flex; align-items: center; gap: 4px; min-height: 30px; padding: 0 11px; border-radius: 999px; border: 0; font: inherit; font-size: 12.5px; font-weight: 700; cursor: pointer; text-decoration: none;
  color: var(--on-primary); background: var(--primary); }
.st-chip.soft { color: var(--primary); background: var(--primary-soft); }
.st-chip .i-s { width: 14px; height: 14px; }
.stories__none { margin: 0; padding: 12px 14px; border-radius: 16px; font-size: 13px; color: var(--ink-3); background: var(--surface-2); }
/* 1.17 — composing: the kinds, the ready phrases and the card each get room to breathe; the card is one flat colour */
.pc { gap: 18px; }
.pc-tpl { gap: 8px 8px; margin-bottom: 14px; }
.pc-tpl .chip { min-height: 36px; }
.pc-preview { margin-top: 2px; }
.pc-bgs { margin-top: 16px; }

/* 1.18 · the feed is tighter: a text card is as tall as its words (no empty square), pictures stop at a calm height */
.post__m > .pm { aspect-ratio: 4 / 5; max-height: 62dvh; }
.post__m > .pm-text { aspect-ratio: auto; min-height: 150px; max-height: none; padding: 30px 22px; }
.feed { gap: 14px; }
.post__h { padding: 8px 12px; }
.post > :last-child { margin-bottom: 8px; }

/* 1.19 · the circles row is compact: small header buttons, no empty band above or below the circles */
.stories { gap: 4px; }
.stories__row { padding: 2px 2px 0; }
.st-item { gap: 3px; }
