:root {
  --bg: #000;
  --fg: #fff;
  --fg2: rgba(255,255,255,.75);
  --muted: rgba(255,255,255,.5);
  --line: rgba(255,255,255,.12);
  --card: #121212;
  --card2: #1e1e1e;
  --red: #fe2c55;
  --yellow: #facd00;
  --sat: calc(var(--tg-safe-area-inset-top, 0px) + var(--tg-content-safe-area-inset-top, 0px));
  --sab: max(var(--tg-safe-area-inset-bottom, 0px), env(safe-area-inset-bottom, 0px));
  --nav: 52px;
  --font: "TikTok Sans", -apple-system, BlinkMacSystemFont, "SF Arabic", "Segoe UI", Roboto, "Noto Sans Arabic", Tahoma, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--fg); font-family: var(--font);
  overflow: hidden; overscroll-behavior: none; -webkit-user-select: none; user-select: none; -webkit-text-size-adjust: 100%; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }
svg { display: block; fill: currentColor; }
img { -webkit-user-drag: none; }

#app { position: fixed; inset: 0; }
body.has-nav #app { bottom: calc(var(--nav) + var(--sab)); }

/* ---------- bottom nav ---------- */
#nav { position: fixed; inset: auto 0 0 0; height: calc(var(--nav) + var(--sab)); padding-bottom: var(--sab);
  background: #000; border-top: 1px solid var(--line); display: flex; z-index: 40; }
#nav[hidden] { display: none; }
#nav a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: var(--muted); font-size: 10.5px; font-weight: 500; }
#nav a svg { width: 25px; height: 25px; }
#nav a.on { color: #fff; }

/* ---------- pages ---------- */
.page { position: absolute; inset: 0; overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch;
  padding-top: var(--sat); overscroll-behavior: contain; }
.topbar { position: sticky; top: 0; z-index: 5; height: 48px; display: grid; grid-template-columns: 48px 1fr 48px;
  align-items: center; background: rgba(0,0,0,.92); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line); }
.topbar h1 { margin: 0; font-size: 16.5px; font-weight: 600; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn { width: 44px; height: 44px; display: grid; place-items: center; }
.icon-btn svg { width: 24px; height: 24px; }
.stroke svg, svg.stroke { fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }

.big-title { padding: 14px 16px 6px; font-size: 22px; font-weight: 700; display: flex; align-items: baseline; gap: 8px; }
.big-title small { font-size: 13px; color: var(--muted); font-weight: 500; }

/* ---------- avatars ---------- */
.av { border-radius: 50%; overflow: hidden; background: linear-gradient(135deg, #ff4d6d, #7b2ff7); flex: none;
  display: grid; place-items: center; font-weight: 700; color: #fff; text-transform: uppercase; }
.av img { width: 100%; height: 100%; object-fit: cover; display: block; }
.verified { display: inline-grid; place-items: center; width: 15px; height: 15px; border-radius: 50%; background: #20d5ec;
  vertical-align: -2px; margin-inline-start: 3px; }
.verified svg { width: 10px; height: 10px; fill: none; stroke: #fff; stroke-width: 3.2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- accounts list ---------- */
.acc-list { padding: 4px 0 24px; }
.acc { display: flex; align-items: center; gap: 12px; padding: 10px 16px; }
.acc:active { background: var(--card); }
.acc .av { width: 56px; height: 56px; font-size: 21px; }
.acc .who { flex: 1; min-width: 0; }
.acc .nm { font-size: 15.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.acc .sub { font-size: 13px; color: var(--muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; direction: rtl; }
.acc .pill { font-size: 12px; font-weight: 600; padding: 6px 12px; border-radius: 4px; background: var(--card2); color: var(--fg2); white-space: nowrap; }
.acc .pill.off { color: var(--muted); }
.stories { display: flex; gap: 14px; overflow-x: auto; padding: 8px 16px 14px; scrollbar-width: none; border-bottom: 1px solid var(--line); }
.stories::-webkit-scrollbar { display: none; }
.story { display: flex; flex-direction: column; align-items: center; gap: 6px; width: 70px; flex: none; }
.story .ring { padding: 2.5px; border-radius: 50%; background: linear-gradient(45deg, #fe2c55, #ff9a3c); }
.story .ring.seen { background: var(--line); }
.story .av { width: 62px; height: 62px; border: 2.5px solid #000; font-size: 22px; }
.story span { font-size: 11.5px; color: var(--fg2); max-width: 70px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hint { color: var(--muted); font-size: 12.5px; text-align: center; padding: 18px 24px 30px; line-height: 1.8; }
.hint code { background: var(--card2); padding: 2px 6px; border-radius: 4px; color: var(--fg2); direction: ltr; display: inline-block; }

/* ---------- profile ---------- */
.prof { display: flex; flex-direction: column; align-items: center; padding: 18px 16px 6px; text-align: center; }
.prof .av { width: 96px; height: 96px; font-size: 36px; }
.prof .handle { margin-top: 12px; font-size: 17px; font-weight: 600; direction: ltr; }
.prof .stats { display: flex; margin-top: 16px; }
.prof .stats div { padding: 0 18px; position: relative; }
.prof .stats div + div::before { content: ""; position: absolute; inset-inline-start: 0; top: 7px; height: 12px; width: 1px; background: var(--line); }
.prof .stats b { display: block; font-size: 17px; font-weight: 700; direction: ltr; }
.prof .stats span { font-size: 13px; color: var(--muted); }
.prof .bio { margin-top: 14px; font-size: 14px; line-height: 1.6; color: var(--fg); white-space: pre-line; max-width: 320px; }
.prof .badge { margin-top: 12px; font-size: 12px; color: var(--muted); display: inline-flex; gap: 6px; align-items: center;
  background: var(--card); padding: 5px 12px; border-radius: 30px; }
.prof .badge i { width: 7px; height: 7px; border-radius: 50%; background: #2ecc71; display: inline-block; }
.prof .badge i.off { background: #888; }
.tabs { display: flex; position: sticky; top: 48px; z-index: 4; background: #000; border-bottom: 1px solid var(--line); margin-top: 14px; }
.tabs button { flex: 1; height: 44px; display: grid; place-items: center; color: var(--muted); position: relative; }
.tabs button svg { width: 22px; height: 22px; }
.tabs button.on { color: #fff; }
.tabs button.on::after { content: ""; position: absolute; bottom: -1px; width: 44px; height: 2px; background: #fff; border-radius: 2px; }
.tabs button span { font-size: 13.5px; font-weight: 600; }

/* ---------- grid ---------- */
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5px; padding-bottom: 20px; }
.tile { position: relative; aspect-ratio: 3 / 4; background: var(--card); overflow: hidden; }
.tile img { width: 100%; height: 100%; object-fit: cover; display: block; opacity: 0; transition: opacity .25s; }
.tile img.ok { opacity: 1; }
.tile::after { content: ""; position: absolute; inset: auto 0 0 0; height: 40%; background: linear-gradient(transparent, rgba(0,0,0,.55)); pointer-events: none; }
.tile .views { position: absolute; bottom: 5px; right: 6px; z-index: 1; display: flex; align-items: center; gap: 3px;
  font-size: 12.5px; font-weight: 600; direction: ltr; text-shadow: 0 1px 2px rgba(0,0,0,.5); }
.tile .views svg { width: 14px; height: 14px; fill: none; stroke: #fff; stroke-width: 2.2; stroke-linejoin: round; }
.tile .kind { position: absolute; top: 6px; inset-inline-end: 6px; z-index: 1; filter: drop-shadow(0 1px 2px rgba(0,0,0,.6)); }
.tile .kind svg { width: 17px; height: 17px; }
.tile .who { position: absolute; bottom: 5px; left: 6px; z-index: 1; width: 22px; height: 22px; font-size: 10px; border: 1.5px solid #fff; }
.skel { background: linear-gradient(100deg, #111 30%, #1d1d1d 50%, #111 70%); background-size: 300% 100%; animation: shimmer 1.3s infinite linear; }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }

.empty { padding: 60px 30px; text-align: center; color: var(--muted); font-size: 14px; line-height: 1.8; }
.empty svg { width: 54px; height: 54px; margin: 0 auto 12px; opacity: .45; }
.empty b { display: block; color: #fff; font-size: 16px; margin-bottom: 4px; }

/* ---------- feed ---------- */
.feed { position: absolute; inset: 0; overflow-y: scroll; scroll-snap-type: y mandatory; overscroll-behavior: contain;
  scrollbar-width: none; background: #000; }
.feed::-webkit-scrollbar { display: none; }
.slide { position: relative; height: 100%; scroll-snap-align: start; scroll-snap-stop: always; overflow: hidden; background: #000; }
.slide .poster, .slide video.media { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: var(--fit, contain); }
.slide .poster { opacity: 1; transition: opacity .2s; }
.slide.playing .poster { opacity: 0; }
.stage { position: absolute; inset: 0; }
.shade { position: absolute; inset: auto 0 0 0; height: 45%; background: linear-gradient(transparent, rgba(0,0,0,.6)); pointer-events: none; }
.shade.top { inset: 0 0 auto 0; height: 22%; background: linear-gradient(rgba(0,0,0,.45), transparent); }

.rail { position: absolute; inset-inline-end: 6px; bottom: 18px; z-index: 3; display: flex; flex-direction: column; align-items: center; gap: 15px; width: 56px; }
.rail .r-av { position: relative; margin-bottom: 6px; }
.rail .r-av .av { width: 48px; height: 48px; border: 1.5px solid #fff; font-size: 19px; }
.rail .r-btn { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 12.5px; font-weight: 600;
  text-shadow: 0 1px 2px rgba(0,0,0,.4); direction: ltr; }
.rail .r-btn svg { width: 36px; height: 36px; filter: drop-shadow(0 1px 3px rgba(0,0,0,.35)); transition: transform .15s; }
.rail .r-btn:active svg { transform: scale(.88); }
.rail .like.on svg { color: var(--red); animation: pop .35s; }
.rail .fav.on svg { color: var(--yellow); animation: pop .35s; }
@keyframes pop { 40% { transform: scale(1.25); } }
.rail .disc { width: 46px; height: 46px; border-radius: 50%; margin-top: 4px; padding: 9px;
  background: radial-gradient(circle, #222 40%, #111 41%, #333 70%, #111 71%); animation: spin 5s linear infinite; animation-play-state: paused; }
.slide.playing .rail .disc { animation-play-state: running; }
.rail .disc .av { width: 28px; height: 28px; font-size: 11px; }
@keyframes spin { to { transform: rotate(360deg); } }

.meta { position: absolute; inset-inline-start: 12px; inset-inline-end: 76px; bottom: 18px; z-index: 3; text-shadow: 0 1px 2px rgba(0,0,0,.4); }
.meta .m-user { font-size: 16px; font-weight: 700; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.meta .m-user .date { font-weight: 400; font-size: 13px; color: var(--fg2); }
.meta .m-desc { margin-top: 6px; font-size: 14.5px; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; white-space: pre-line; word-break: break-word; }
.meta .m-desc.open { -webkit-line-clamp: unset; max-height: 40vh; overflow-y: auto; }
.meta .m-desc b { font-weight: 700; }
.meta .m-music { margin-top: 9px; display: flex; align-items: center; gap: 6px; font-size: 13.5px; max-width: 240px; }
.meta .m-music svg { width: 15px; height: 15px; flex: none; }
.marq { overflow: hidden; white-space: nowrap; flex: 1; mask-image: linear-gradient(90deg, transparent, #000 18%); -webkit-mask-image: linear-gradient(90deg, transparent, #000 18%); }
.marq span { display: inline-block; animation: marq 10s linear infinite; animation-play-state: paused; }
.marq span i { display: inline-block; width: 36px; }
.slide.playing .marq span { animation-play-state: running; }
@keyframes marq { to { transform: translateX(50%); } }

.bar { position: absolute; inset: auto 0 0 0; height: 16px; z-index: 4; display: flex; align-items: flex-end; touch-action: none; }
.bar i { display: block; height: 2px; width: 0; background: rgba(255,255,255,.85); transition: height .15s; pointer-events: none; }
.bar::before { content: ""; position: absolute; inset: auto 0 0 0; height: 2px; background: rgba(255,255,255,.2); transition: height .15s; }
.bar.drag i, .bar.drag::before { height: 5px; }
.slide.paused .bar i, .slide.paused .bar::before { height: 4px; }

.playicon { position: absolute; top: 50%; left: 50%; width: 72px; height: 72px; margin: -36px 0 0 -36px; z-index: 2; pointer-events: none;
  opacity: 0; transform: scale(1.4); transition: opacity .15s, transform .15s; color: rgba(255,255,255,.7); }
.slide.paused .playicon { opacity: 1; transform: scale(1); }
.burst { position: absolute; width: 96px; height: 96px; margin: -48px 0 0 -48px; z-index: 5; pointer-events: none; color: var(--red);
  animation: burst .8s ease-out forwards; filter: drop-shadow(0 4px 12px rgba(0,0,0,.3)); }
@keyframes burst { 0% { transform: scale(0) rotate(var(--r)); opacity: 0; } 15% { transform: scale(1.2) rotate(var(--r)); opacity: 1; }
  30% { transform: scale(.95) rotate(var(--r)); } 70% { opacity: 1; transform: scale(1) rotate(var(--r)) translateY(0); }
  100% { opacity: 0; transform: scale(1.6) rotate(var(--r)) translateY(-60px); } }

/* photo posts */
.photos { position: absolute; inset: 0; overflow-x: auto; overflow-y: hidden; display: flex; scroll-snap-type: x mandatory; scrollbar-width: none; direction: ltr; }
.photos::-webkit-scrollbar { display: none; }
.photos img { flex: 0 0 100%; width: 100%; height: 100%; object-fit: contain; scroll-snap-align: center; scroll-snap-stop: always; }
.dots { position: absolute; bottom: 8px; left: 0; right: 0; display: flex; justify-content: center; gap: 4px; z-index: 4; direction: ltr; pointer-events: none; }
.dots i { width: 5px; height: 5px; border-radius: 3px; background: rgba(255,255,255,.4); transition: all .2s; }
.dots i.on { background: #fff; width: 14px; }
.slide.has-dots .meta { bottom: 28px; }
.pcount { position: absolute; top: calc(var(--sat) + 60px); inset-inline-start: 12px; z-index: 4; font-size: 12px; font-weight: 600; direction: ltr;
  background: rgba(0,0,0,.4); padding: 3px 9px; border-radius: 20px; }

/* feed header */
.fhead { position: absolute; top: calc(var(--sat) + 6px); left: 0; right: 0; z-index: 6; height: 44px; display: flex; align-items: center; justify-content: center; gap: 22px; pointer-events: none; }
.fhead button { pointer-events: auto; font-size: 16.5px; font-weight: 600; color: rgba(255,255,255,.6); position: relative; padding: 8px 0; text-shadow: 0 1px 3px rgba(0,0,0,.4); }
.fhead button.on { color: #fff; }
.fhead button.on::after { content: ""; position: absolute; bottom: 2px; left: 50%; width: 26px; height: 3px; margin-left: -13px; border-radius: 3px; background: #fff; }
.fhead .sep { width: 1px; height: 13px; background: rgba(255,255,255,.35); }
.fback { position: absolute; top: calc(var(--sat) + 6px); inset-inline-start: 4px; z-index: 6; filter: drop-shadow(0 1px 3px rgba(0,0,0,.5)); }
.ftitle { position: absolute; top: calc(var(--sat) + 6px); left: 60px; right: 60px; height: 44px; z-index: 6; display: grid; place-items: center;
  font-size: 15.5px; font-weight: 600; text-shadow: 0 1px 3px rgba(0,0,0,.5); pointer-events: none; }

/* ---------- sheet (comments) ---------- */
.backdrop { position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.35); animation: fade .2s; }
.sheet { position: fixed; inset: auto 0 0 0; z-index: 51; height: 72%; background: #1a1a1a; border-radius: 14px 14px 0 0;
  display: flex; flex-direction: column; animation: up .28s cubic-bezier(.2,.9,.3,1); padding-bottom: var(--sab); }
.sheet.closing { animation: down .22s ease-in forwards; }
.backdrop.closing { animation: fade .22s reverse forwards; }
@keyframes up { from { transform: translateY(100%); } }
@keyframes down { to { transform: translateY(100%); } }
@keyframes fade { from { opacity: 0; } }
.sheet .sh-head { height: 48px; display: grid; grid-template-columns: 44px 1fr 44px; align-items: center; flex: none; border-bottom: 1px solid var(--line); }
.sheet .sh-head h3 { margin: 0; text-align: center; font-size: 14px; font-weight: 600; }
.sheet .sh-body { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 6px 0 16px; }
.cmt { display: flex; gap: 12px; padding: 10px 16px; }
.cmt .av { width: 34px; height: 34px; font-size: 13px; }
.cmt .c-main { flex: 1; min-width: 0; }
.cmt .c-name { font-size: 13px; color: var(--muted); font-weight: 600; }
.cmt .c-text { font-size: 14.5px; line-height: 1.55; margin-top: 2px; white-space: pre-line; word-break: break-word; -webkit-user-select: text; user-select: text; }
.cmt .c-sub { font-size: 12.5px; color: var(--muted); margin-top: 5px; display: flex; gap: 14px; }
.cmt .c-like { display: flex; flex-direction: column; align-items: center; gap: 1px; color: var(--muted); font-size: 12px; padding-top: 14px; direction: ltr; }
.cmt .c-like svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2; }
.sh-foot { flex: none; border-top: 1px solid var(--line); padding: 10px 16px; display: flex; align-items: center; justify-content: space-between;
  color: var(--muted); font-size: 12px; }
.sh-foot button { color: var(--fg2); font-size: 12.5px; font-weight: 600; display: flex; gap: 5px; align-items: center; background: var(--card2); padding: 6px 12px; border-radius: 30px; }
.sh-foot button svg { width: 14px; height: 14px; }
.spinner { width: 28px; height: 28px; margin: 40px auto; border: 3px solid rgba(255,255,255,.15); border-top-color: var(--red); border-radius: 50%; animation: spin .8s linear infinite; }

/* ---------- misc ---------- */
#sound { position: fixed; top: calc(var(--sat) + 62px); left: 50%; transform: translateX(-50%); z-index: 30; display: flex; align-items: center; gap: 6px;
  background: rgba(0,0,0,.6); padding: 7px 14px; border-radius: 30px; font-size: 13px; font-weight: 600; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
#sound[hidden] { display: none; }
#sound svg { width: 18px; height: 18px; }
#toast { position: fixed; top: 45%; left: 50%; transform: translate(-50%, -50%); z-index: 90; background: rgba(40,40,40,.92); padding: 11px 18px;
  border-radius: 8px; font-size: 14px; font-weight: 500; max-width: 80%; text-align: center; animation: fade .2s; }
#toast[hidden] { display: none; }
.locked { position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 30px; text-align: center; }
.locked svg { width: 60px; height: 60px; opacity: .8; }
.locked b { font-size: 18px; }
.locked p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.7; }

/* ================= round 2 ================= */
body { font-feature-settings: "tnum" 0; letter-spacing: 0; }
.pushin { animation: pushin .26s cubic-bezier(.2,.8,.2,1); }
.fadein { animation: fade .2s ease-out; }
@keyframes pushin { from { transform: translateX(-28px); opacity: 0; } }
.view { position: absolute; inset: 0; }
.icon-btn.spin svg { animation: spin .8s linear infinite; }
.topbar .p-refresh svg { width: 21px; height: 21px; }

/* story ring */
.sring { display: inline-grid; place-items: center; border-radius: 50%; flex: none; }
.sring.live { padding: 2.5px; background: linear-gradient(45deg, #fe2c55, #ff8a3d, #fe2c55); }
.sring.live.seen { background: rgba(255,255,255,.28); }
.sring.live > .av { border: 2.5px solid #000; }
.rail .r-av .sring.live > .av { width: 44px; height: 44px; border-width: 2px; }
.story .sring > .av { width: 62px; height: 62px; font-size: 22px; }
.story .sring:not(.live) { padding: 2.5px; background: rgba(255,255,255,.14); }
.story .sring:not(.live) > .av { border: 2.5px solid #000; }
.prof .p-av { border-radius: 50%; }
.prof .av.big { width: 96px; height: 96px; font-size: 36px; }
.prof .sring.live > .av.big { width: 92px; height: 92px; }
.prof .ttname { font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.prof .stats button { padding: 0 18px; position: relative; text-align: center; }
.prof .stats button + button::before, .prof .stats button + div::before { content: ""; position: absolute; inset-inline-start: 0; top: 7px; height: 12px; width: 1px; background: var(--line); }
.prof .stats b { display: block; font-size: 17px; font-weight: 700; direction: ltr; }
.prof .stats span { font-size: 13px; color: var(--muted); }
.pbtns { display: flex; gap: 6px; margin-top: 16px; }
.btn-follow { height: 42px; min-width: 150px; padding: 0 22px; border-radius: 6px; background: var(--red); font-weight: 600; font-size: 15px;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; transition: background .15s; }
.btn-follow.on { background: #2f2f2f; }
.btn-follow svg { width: 19px; height: 19px; }
.btn-sq { width: 42px; height: 42px; border-radius: 6px; background: #2f2f2f; display: grid; place-items: center; }
.btn-sq svg { width: 20px; height: 20px; }
.btn-red { width: 100%; height: 46px; border-radius: 6px; background: var(--red); font-weight: 600; font-size: 15.5px; }
.btn-ghost { width: 100%; height: 44px; border-radius: 6px; background: #2f2f2f; font-weight: 500; font-size: 14.5px; margin-top: 8px; color: var(--fg2); }

/* pinned */
.tile .pin { position: absolute; top: 6px; inset-inline-start: 6px; z-index: 1; background: var(--red); color: #fff; font-size: 11.5px; font-weight: 600;
  padding: 2px 6px; border-radius: 3px; line-height: 1.4; }

/* photo nav */
.pnav { position: absolute; top: 34%; z-index: 4; width: 38px; height: 38px; border-radius: 50%; background: rgba(0,0,0,.35);
  display: grid; place-items: center; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); transition: opacity .15s; }
.pnav[hidden] { display: none; }
.pnav svg { width: 20px; height: 20px; stroke-width: 2.6; }
.pnav.prev { left: 10px; }
.pnav.next { right: 10px; }
.pnav:active { transform: scale(.92); }

/* feed header search */
.fhead .fsearch { position: absolute; inset-inline-end: 10px; top: 2px; width: 40px; height: 40px; display: grid; place-items: center; pointer-events: auto;
  filter: drop-shadow(0 1px 3px rgba(0,0,0,.4)); }
.fhead .fsearch svg { width: 25px; height: 25px; stroke-width: 2.4; }
.big-title { position: relative; }
.big-title .t-search { position: absolute; inset-inline-end: 6px; top: 8px; }

/* search page */
.sbar { position: sticky; top: 0; z-index: 5; background: #000; padding: 8px 12px; }
.sfield { display: flex; align-items: center; gap: 8px; height: 40px; background: #2f2f2f; border-radius: 6px; padding: 0 10px; color: var(--muted); }
.sfield > svg { width: 20px; height: 20px; flex: none; }
.sfield input { flex: 1; min-width: 0; background: none; border: 0; outline: 0; color: #fff; font: inherit; font-size: 15.5px; -webkit-user-select: text; user-select: text; }
.sfield input::-webkit-search-cancel-button { display: none; }
.sfield .sx { width: 22px; height: 22px; display: grid; place-items: center; background: rgba(255,255,255,.25); border-radius: 50%; color: #000; }
.sfield .sx svg { width: 13px; height: 13px; stroke-width: 3; }
.sec { padding: 14px 16px 8px; font-size: 15px; font-weight: 700; }
.sec small { color: var(--muted); font-weight: 500; font-size: 13px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 16px 8px; }
.chip { display: inline-flex; align-items: center; gap: 4px; height: 34px; padding: 0 12px; border-radius: 20px; background: #1f1f1f; font-size: 13.5px; font-weight: 600; }
.chip .hash { width: 20px; height: 20px; border-radius: 50%; background: #333; display: grid; place-items: center; font-size: 12px; }
.chip small { color: var(--muted); font-weight: 500; margin-inline-start: 4px; }

/* sheets */
.grab { width: 36px; height: 4px; border-radius: 3px; background: rgba(255,255,255,.25); margin: 8px auto 0; flex: none; }
.sheet .sh-head { height: 44px; border-bottom: 0; }
.cmt .author { color: var(--red); font-weight: 600; }
.ftabs { display: flex; border-bottom: 1px solid var(--line); flex: none; }
.ftabs button { flex: 1; height: 44px; font-size: 14px; color: var(--muted); font-weight: 600; position: relative; }
.ftabs button b { color: inherit; margin-inline-start: 3px; direction: ltr; display: inline-block; }
.ftabs button.on { color: #fff; }
.ftabs button.on::after { content: ""; position: absolute; bottom: -1px; left: 50%; width: 56px; margin-left: -28px; height: 2px; background: #fff; }
.frow { display: flex; align-items: center; gap: 12px; padding: 9px 16px; }
.frow:active { background: rgba(255,255,255,.04); }
.frow .av { width: 48px; height: 48px; font-size: 18px; }
.frow .who { flex: 1; min-width: 0; }
.frow .nm { font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.frow .sub { font-size: 13px; color: var(--muted); text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fbtn { height: 32px; min-width: 88px; padding: 0 14px; border-radius: 4px; background: var(--red); font-weight: 600; font-size: 13.5px; }
.fbtn.on { background: #2f2f2f; color: var(--fg2); }
.sheet.alias { height: auto; max-height: 80%; }
.alias-box { padding: 14px 16px 20px; }
.alias-who { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.alias-who .av { width: 48px; height: 48px; font-size: 18px; }
.alias-who b { display: block; font-size: 15px; text-align: right; }
.alias-who span { font-size: 13px; color: var(--muted); }
.alias-in { width: 100%; height: 46px; border-radius: 6px; border: 1px solid #3a3a3a; background: #111; color: #fff; font: inherit; font-size: 16px;
  padding: 0 14px; outline: 0; margin-bottom: 12px; -webkit-user-select: text; user-select: text; }
.alias-in:focus { border-color: #666; }

/* story viewer */
.sv { position: absolute; inset: 0; background: #000; overflow: hidden; touch-action: none; }
.sv-stage { position: absolute; inset: 0; display: grid; place-items: center; }
.sv-stage img, .sv-stage video { width: 100%; height: 100%; object-fit: contain; }
.sv-bars { position: absolute; top: calc(var(--sat) + 8px); left: 8px; right: 8px; z-index: 6; display: flex; gap: 3px; }
.sv-bars i { flex: 1; height: 2.5px; border-radius: 2px; background: rgba(255,255,255,.3); overflow: hidden; }
.sv-bars b { display: block; height: 100%; width: 0; background: #fff; }
.sv-head { position: absolute; top: calc(var(--sat) + 16px); left: 6px; right: 6px; z-index: 6; display: flex; align-items: center; justify-content: space-between; }
.sv-who { display: flex; align-items: center; gap: 8px; padding: 4px 6px; text-shadow: 0 1px 3px rgba(0,0,0,.5); }
.sv-who .av { width: 34px; height: 34px; font-size: 13px; }
.sv-who b { font-size: 14.5px; }
.sv-who .sv-time { font-size: 13px; color: var(--fg2); }
.sv-x svg { filter: drop-shadow(0 1px 3px rgba(0,0,0,.5)); }
.sv-tap { position: absolute; top: 0; bottom: 0; z-index: 4; }
.sv-prev { inset-inline-start: 0; width: 34%; }
.sv-next { inset-inline-end: 0; width: 66%; }
.sv-foot { position: absolute; bottom: calc(var(--sab) + 18px); left: 14px; right: 14px; z-index: 5; font-size: 14.5px; line-height: 1.5; text-shadow: 0 1px 3px rgba(0,0,0,.6); pointer-events: none; }
.sv-foot .m-music { display: flex; align-items: center; gap: 6px; margin-top: 8px; font-size: 13px; }
.sv-foot .m-music svg { width: 14px; height: 14px; }

/* ================= round 3: iPhone-safe controls, comments like TikTok ================= */
/* شريط التعليقات تحت (زي تيك توك) يبعد الأزرار عن منطقة سحب الآيفون */
.feed.with-cbar { bottom: calc(50px + var(--sab)); }
.cbar { position: absolute; inset: auto 0 0 0; z-index: 7; height: calc(50px + var(--sab)); padding: 0 12px var(--sab);
  background: #000; border-top: 1px solid rgba(255,255,255,.08); display: flex; align-items: center; }
.cbar button { flex: 1; height: 38px; display: flex; align-items: center; gap: 8px; padding: 0 14px; border-radius: 20px;
  background: #1f1f1f; color: var(--muted); font-size: 14.5px; }
.cbar button svg { width: 19px; height: 19px; }
.cbar button b { margin-inline-start: auto; font-weight: 600; color: var(--fg2); direction: ltr; }

/* شريط التقديم: منطقة لمس أكبر ومرفوعة شوي */
.bar { height: 26px; bottom: 0; }
.bar i, .bar::before { bottom: 6px; }
.bar::before { bottom: 6px; }
.bar i { position: relative; z-index: 1; margin-bottom: 6px; }
.bar.drag i, .bar.drag::before { height: 4px; }
.bar.drag i::after { content: ""; position: absolute; inset-inline-end: -7px; top: 50%; width: 14px; height: 14px; margin-top: -7px; border-radius: 50%; background: #fff; }
.bar i { direction: ltr; }
.bar { direction: ltr; }
.scrub { display: none; position: absolute; left: 0; right: 0; bottom: 70px; z-index: 5; text-align: center; font-size: 26px; font-weight: 700;
  direction: ltr; color: rgba(255,255,255,.65); text-shadow: 0 2px 8px rgba(0,0,0,.5); pointer-events: none; }
.scrub b { color: #fff; }
.slide.scrubbing .scrub { display: block; }
.slide.scrubbing .meta, .slide.scrubbing .rail, .slide.scrubbing .shade { opacity: 0; transition: opacity .15s; }
.meta, .rail { transition: opacity .15s; }
.rail { bottom: 26px; }
.meta { bottom: 24px; }
.slide.has-dots .meta { bottom: 32px; }

/* خط وأحجام أقرب لتيك توك */
.meta .m-user { font-size: 17px; font-weight: 600; }
.meta .m-desc { font-size: 15px; line-height: 1.4; }
.meta .m-music { font-size: 14px; }
.rail .r-btn { font-size: 12.5px; font-weight: 600; }
.fhead button { font-size: 17px; font-weight: 600; }
.fhead { gap: 26px; }

/* التعليقات */
.sheet.cmts .sh-head h3 { font-size: 13.5px; font-weight: 600; }
.cmt { gap: 10px; padding: 9px 16px; }
.cmt .av { width: 34px; height: 34px; }
.cmt .c-name { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 13px; color: rgba(255,255,255,.55); font-weight: 600; }
.cmt .creator { color: #fe2c55; font-size: 11.5px; font-weight: 700; background: rgba(254,44,85,.12); padding: 1px 6px; border-radius: 3px; }
.cmt .pinned { color: var(--muted); font-size: 11.5px; font-weight: 600; background: rgba(255,255,255,.08); padding: 1px 6px; border-radius: 3px; }
.cmt .c-text { font-size: 15px; line-height: 1.45; margin-top: 3px; color: #fff; }
.cmt .c-sub { gap: 16px; font-size: 13px; margin-top: 6px; }
.cmt .c-reply { font-weight: 600; }
.cmt .c-liked { display: inline-flex; align-items: center; gap: 5px; margin-top: 7px; font-size: 12px; color: var(--muted);
  background: rgba(255,255,255,.06); padding: 3px 8px 3px 6px; border-radius: 20px; }
.cmt .c-liked .av.mini { width: 16px; height: 16px; font-size: 8px; border: 0; }
.cmt .c-liked i svg { width: 12px; height: 12px; color: var(--red); }
.cmt .c-like.al { color: var(--red); }
.cmt.by-author > .c-main > .c-name > span:first-child { color: #fff; }
.c-replies { margin-top: 4px; }
.cmt.reply { padding: 8px 0 2px; }
.cmt.reply .av { width: 24px; height: 24px; font-size: 10px; }
.cmt.reply .c-text { font-size: 14.5px; }
.cmt.reply .c-like { padding-top: 8px; }
.c-more { display: inline-flex; align-items: center; gap: 6px; margin-top: 10px; font-size: 13px; font-weight: 600; color: var(--muted); }
.c-more i { display: inline-block; width: 22px; height: 1px; background: rgba(255,255,255,.25); }
.c-more svg { width: 15px; height: 15px; }
.c-more.loading { opacity: .5; }

.acc .sub2 { margin-top: 1px; font-size: 12.5px; }

/* ================= round 4 ================= */
#nav a { font-size: 10px; font-weight: 600; gap: 3px; color: rgba(255,255,255,.55); }
#nav a svg { width: 26px; height: 26px; }
#nav a .f { display: none; }
#nav a.on .f { display: block; }
#nav a.on .o { display: none; }
#nav a.on { color: #fff; }

/* صورة الحساب بالكامل */
.avview { position: fixed; inset: 0; z-index: 80; background: rgba(0,0,0,.94); display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 10px; animation: fade .2s; padding: 20px; }
.avview.closing { animation: fade .2s reverse forwards; }
.avview .av-x { position: absolute; top: calc(var(--sat) + 10px); inset-inline-end: 8px; }
.av-big { width: min(78vw, 320px); height: min(78vw, 320px); border-radius: 50%; overflow: hidden; background: linear-gradient(135deg, #ff4d6d, #7b2ff7);
  display: grid; place-items: center; font-size: 90px; font-weight: 700; box-shadow: 0 10px 40px rgba(0,0,0,.6); animation: pop .3s; }
.av-big img { width: 100%; height: 100%; object-fit: cover; -webkit-touch-callout: default; }
.av-name { margin-top: 14px; font-size: 18px; font-weight: 700; }
.av-user { font-size: 14px; color: var(--muted); }
.av-btns { display: flex; gap: 28px; margin-top: 26px; }
.av-btns button { display: flex; flex-direction: column; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 600; color: var(--fg2); }
.av-btns svg { width: 50px; height: 50px; padding: 13px; border-radius: 50%; background: #2a2a2a; color: #fff; }
.sheet.pick { height: auto; }
.pick-row { width: 100%; display: flex; align-items: center; gap: 14px; padding: 15px 20px; font-size: 15.5px; font-weight: 600; }
.pick-row svg { width: 24px; height: 24px; }
.pick-row:active { background: rgba(255,255,255,.05); }

/* ================= round 5 ================= */
:root { --num: "TikTok Sans", -apple-system, "SF Pro Text", "Helvetica Neue", Arial, sans-serif; }
.rail .r-btn span, .prof .stats b, .tile .views, .cmt .c-like span, .ftabs b, .cbar b, .scrub, .pcount,
.sv-time, .acc .sub span[dir="ltr"], .prof .handle, .chip small {
  font-family: var(--num); font-variant-numeric: normal; }
.rail .r-btn span { font-size: 13px; font-weight: 600; letter-spacing: -.1px; text-shadow: 0 0 2px rgba(0,0,0,.35); }
.prof .stats b { font-size: 18px; font-weight: 700; letter-spacing: -.2px; }
.tile .views { font-size: 13px; font-weight: 600; }
/* قلب التعليق: أحمر لو صاحب الحساب حاط لايك */
.cmt .c-like svg { width: 18px; height: 18px; stroke-width: 1.9; transition: color .15s; }
.cmt .c-like.al { color: var(--red); }
.cmt .c-like.al svg { stroke: var(--red); }
.cmt .c-like.al span { color: var(--muted); }
.mini-spin { display: inline-block; width: 12px; height: 12px; border: 2px solid rgba(255,255,255,.2); border-top-color: #fff; border-radius: 50%;
  animation: spin .7s linear infinite; }
.tabs button svg { width: 23px; height: 23px; }

/* صور وملصقات التعليقات */
.cmt .c-media { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.cmt .c-media button { display: block; padding: 0; border: 0; background: rgba(255,255,255,.06); border-radius: 8px;
  overflow: hidden; cursor: zoom-in; max-width: min(62vw, 220px); }
.cmt .c-media .cm-img { width: min(62vw, 220px); max-height: 300px; aspect-ratio: 3/4; }
.cmt .c-media.multi .cm-img { width: min(29vw, 105px); max-height: 140px; aspect-ratio: 1; }
.cmt .c-media .cm-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cmt .c-media .cm-stk { background: none; border-radius: 0; width: 96px; height: 96px; aspect-ratio: auto !important; }
.cmt .c-media .cm-stk img { width: 100%; height: 100%; object-fit: contain; display: block; }
.cmt.reply .c-media .cm-img { width: min(54vw, 180px); }
.cmt.reply .c-media .cm-stk { width: 80px; height: 80px; }
.cmt .c-media .broken { min-width: 70px; min-height: 70px; cursor: default; }
.cmt .c-media .broken img { display: none; }
.cmt .c-media .broken::after { content: 'الصورة ما تفتح'; display: grid; place-items: center; height: 100%; min-height: 70px;
  padding: 6px; font-size: 11px; color: var(--muted); }
.imgview { justify-content: center; }
.imgview .iv-img { max-width: 100vw; max-height: calc(100vh - 170px); object-fit: contain; -webkit-touch-callout: default; }
