/* NivInsta v3 — Instagram web (desktop + mobile web) faithful reproduction. Light + dark, LTR + RTL. */
*{box-sizing:border-box;margin:0;padding:0}
:root{
  --bg:#fff;--bg2:#fff;--tx:#000;--tx2:#737373;--sep:#dbdbdb;--sep2:#efefef;--hl:#efefef;--hl2:#dbdbdb;
  --hover:rgba(0,0,0,.05);--blue:#0095f6;--blue2:#1877f2;--link:#00376b;--red:#ff3040;--btn2:#efefef;--btn2h:#dbdbdb;
  --modal:#fff;--overlay:rgba(0,0,0,.65);--shadow:0 4px 12px rgba(0,0,0,.15);--ring:#c7c7c7;--input:#efefef;
  --side-w:244px;--font:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,sans-serif;
}
[data-theme="dark"]{
  --bg:#000;--bg2:#000;--tx:#f5f5f5;--tx2:#a8a8a8;--sep:#262626;--sep2:#262626;--hl:#262626;--hl2:#363636;
  --hover:rgba(255,255,255,.1);--link:#e0f1ff;--btn2:#363636;--btn2h:#262626;--modal:#262626;--ring:#363636;--input:#262626;
  --shadow:0 4px 12px rgba(0,0,0,.6)
}
html{-webkit-text-size-adjust:100%;color-scheme:light}
[data-theme="dark"]{color-scheme:dark}
body{font-family:var(--font);font-size:14px;line-height:18px;color:var(--tx);background:var(--bg);min-height:100vh;overflow-y:scroll}
body.lock{overflow:hidden}
a{color:inherit;text-decoration:none}
button{font:inherit;color:inherit;background:none;border:0;cursor:pointer;padding:0}
input,textarea{font:inherit;color:inherit}
img,video{display:block}
svg{display:block}
.hidden{display:none!important}
.sr{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0)}
.ic{width:24px;height:24px;display:block;flex:none}
.ic svg{width:100%;height:100%}

/* ---------------- sidebar ---------------- */
.side{position:fixed;top:0;bottom:0;inset-inline-start:0;width:var(--side-w);border-inline-end:1px solid var(--sep);
  background:var(--bg);display:flex;flex-direction:column;padding:8px 12px 20px;z-index:40;transition:width .2s ease}
.side-logo{display:flex;align-items:center;height:73px;padding:25px 12px 16px;margin-bottom:19px}
.side-logo .wm{width:103px;height:23px;color:var(--tx)}
.side-logo .wm svg{width:100%;height:100%}
.side-logo .glyph{display:none;width:24px;height:24px}
.side-items{flex:1;display:flex;flex-direction:column}
.nav{display:flex;align-items:center;gap:16px;padding:12px;margin:2px 0;border-radius:8px;transition:background .15s;
  font-size:16px;line-height:20px;white-space:nowrap;position:relative;width:100%;text-align:start}
.nav:hover{background:var(--hover)}
.nav:hover .ic{transform:scale(1.05)}
.nav .ic{transition:transform .15s;flex:none}
.nav.on{font-weight:700}
.nav .lbl{overflow:hidden;text-overflow:ellipsis}
.nav .av24{width:24px;height:24px;border-radius:50%;object-fit:cover;object-position:50% 22%}
.nav.on .av24{outline:2px solid var(--tx);outline-offset:1px}
.side-bottom{display:flex;flex-direction:column}
/* collapsed rail (tablet widths or when a drawer is open) */
body.rail .side,.side.rail{width:72px}
body.rail .side .lbl,.side.rail .lbl{display:none}
body.rail .side .wm,.side.rail .wm{display:none}
body.rail .side .glyph,.side.rail .glyph{display:block}

/* ---------------- drawer (search / notifications) ---------------- */
.drawer{position:fixed;top:0;bottom:0;inset-inline-start:72px;width:397px;background:var(--bg);z-index:39;
  border-start-end-radius:16px;border-end-end-radius:16px;box-shadow:4px 0 24px rgba(0,0,0,.15);
  transform:translateX(-110%);transition:transform .3s cubic-bezier(.2,.8,.2,1);display:flex;flex-direction:column;overflow:hidden}
[dir="rtl"] .drawer{transform:translateX(110%);box-shadow:-4px 0 24px rgba(0,0,0,.15)}
.drawer.open{transform:none!important}
.dr-head{padding:12px 14px 0 24px;font-size:24px;line-height:30px;font-weight:600;margin:12px 0 36px}
[dir="rtl"] .dr-head{padding:12px 24px 0 14px}
.dr-search{margin:0 16px 24px;position:relative}
.dr-search input{width:100%;height:40px;border:0;outline:0;border-radius:8px;background:var(--input);padding:3px 36px 3px 16px;font-size:16px}
[dir="rtl"] .dr-search input{padding:3px 16px 3px 36px}
.dr-search .clr{position:absolute;inset-inline-end:12px;top:12px;width:16px;height:16px;border-radius:50%;background:#c7c7c7;color:#fff;font-size:11px;line-height:16px;text-align:center}
.dr-sep{border-top:1px solid var(--sep);margin:0 0 12px}
.dr-sub{display:flex;justify-content:space-between;padding:4px 24px 8px;font-size:16px;font-weight:600}
.dr-sub button{color:var(--blue);font-size:14px;font-weight:600}
.dr-list{flex:1;overflow-y:auto;padding-bottom:12px}
.dr-row{display:flex;align-items:center;gap:12px;padding:8px 24px;width:100%;text-align:start}
.dr-row:hover{background:var(--hover)}
.dr-row img,.dr-row .tro{width:44px;height:44px;border-radius:50%;object-fit:cover;flex:none;background:var(--hl)}
.dr-row .tro{display:flex;align-items:center;justify-content:center;border:1px solid var(--sep);background:var(--bg)}
.dr-row .tro svg{width:22px;height:22px}
.dr-row b{font-weight:600;display:block}
.dr-row span{color:var(--tx2);display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:280px}
.dr-row .nt{color:var(--tx)}
.dr-empty{color:var(--tx2);text-align:center;margin-top:120px;font-weight:600}

/* ---------------- main ---------------- */
.main{margin-inline-start:var(--side-w);min-height:100vh;transition:margin .2s}
body.rail .main{margin-inline-start:72px}
.prof{max-width:975px;margin:0 auto;padding:30px 20px 0}
.ph{display:flex;margin-bottom:44px}
.ph-av{flex:1 1 0;display:flex;justify-content:center;margin-inline-end:30px;min-width:0}
.ph-av .avbox{width:150px;height:150px;border-radius:50%;overflow:hidden;background:var(--hl);cursor:pointer;position:relative}
.ph-av img{width:100%;height:100%;object-fit:cover;object-position:50% 22%}
.ph-info{flex:2 1 30px;min-width:0;display:flex;flex-direction:column}
.ph-row{display:flex;align-items:center;flex-wrap:wrap;margin-bottom:20px;gap:8px}
.ph-user{font-size:20px;line-height:25px;font-weight:400;display:flex;align-items:center;gap:6px;margin-inline-end:12px;min-width:0}
.vbadge{width:18px;height:18px;flex:none;display:inline-block}
.vbadge.s12{width:12px;height:12px}
.vbadge.s14{width:14px;height:14px}
.btn{height:32px;padding:0 16px;border-radius:8px;font-size:14px;font-weight:600;line-height:18px;display:inline-flex;align-items:center;gap:6px;transition:background .15s}
.btn.pri{background:var(--blue);color:#fff}
.btn.pri:hover{background:var(--blue2)}
.btn.sec{background:var(--btn2)}
.btn.sec:hover{background:var(--btn2h)}
.btn .chev{width:12px;height:12px;transition:transform .2s}
.icbtn{width:32px;height:32px;display:inline-flex;align-items:center;justify-content:center;border-radius:8px}
.icbtn:hover{background:var(--hover)}
.ph-stats{display:flex;gap:40px;font-size:16px;line-height:20px;margin-bottom:20px}
.ph-stats b{font-weight:600}
.ph-stats a{cursor:pointer}
.ph-name{font-weight:600}
.ph-cat{color:var(--tx2)}
.ph-bio{white-space:pre-line}
.ph-link{display:inline-flex;align-items:center;gap:4px;color:var(--link);font-weight:600;margin-top:2px;width:max-content}
.ph-link:hover{text-decoration:underline}
.ph-link svg{width:12px;height:12px}
.ph-mob-actions{display:none}
/* highlights */
.hls{display:flex;gap:0;overflow-x:auto;scrollbar-width:none;margin-bottom:44px;padding:0 4px}
.hls::-webkit-scrollbar{display:none}
.hl{display:flex;flex-direction:column;align-items:center;width:115px;flex:none;padding:0 15px;cursor:pointer}
.hl-ring{width:87px;height:87px;border-radius:50%;padding:4px;border:1px solid var(--ring);background:var(--bg);transition:transform .15s}
.hl:active .hl-ring{transform:scale(.96)}
.hl-ring img{width:100%;height:100%;border-radius:50%;object-fit:cover;background:var(--hl)}
.hl-n{font-size:12px;font-weight:600;line-height:16px;margin-top:15px;max-width:85px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;text-align:center}
/* tabs */
.tabs{display:flex;justify-content:center;gap:60px;border-top:1px solid var(--sep)}
.tab{display:flex;align-items:center;gap:6px;height:52px;font-size:12px;font-weight:600;letter-spacing:1px;color:var(--tx2);
  text-transform:uppercase;border-top:1px solid transparent;margin-top:-1px}
.tab .ic{width:12px;height:12px}
.tab.on{color:var(--tx);border-top-color:var(--tx)}
/* grid */
.grid{display:grid;grid-template-columns:repeat(3,1fr);gap:4px}
.cell{position:relative;height:0;padding-bottom:133.3333%;background:var(--hl);cursor:pointer;overflow:hidden}
.grid.reels .cell{padding-bottom:177.7778%}
.cell img{position:absolute;inset:0;width:100%;height:100%;object-fit:cover}
.cell .badge{position:absolute;top:8px;inset-inline-end:8px;width:22px;height:22px;color:#fff;filter:drop-shadow(0 0 1.5px rgba(0,0,0,.45))}
.cell .badge svg{width:100%;height:100%}
.cell .views{position:absolute;bottom:10px;inset-inline-start:10px;color:#fff;font-weight:600;display:flex;align-items:center;gap:4px;
  filter:drop-shadow(0 0 2px rgba(0,0,0,.5))}
.cell .views svg{width:16px;height:16px}
.cell .ov{position:absolute;inset:0;background:rgba(0,0,0,.3);color:#fff;display:flex;align-items:center;justify-content:center;gap:30px;
  font-size:16px;font-weight:700;opacity:0;transition:opacity .1s}
.cell:hover .ov{opacity:1}
.cell .ov span{display:flex;align-items:center;gap:7px}
.cell .ov svg{width:19px;height:19px}
.empty{padding:60px 0 100px;text-align:center}
.empty .eic{width:62px;height:62px;border:2px solid var(--tx);border-radius:50%;display:flex;align-items:center;justify-content:center;margin:0 auto 16px}
.empty .eic svg{width:34px;height:34px}
.empty h3{font-size:30px;line-height:36px;font-weight:800}
/* footer */
.foot{padding:52px 16px 52px;text-align:center;color:var(--tx2);font-size:12px;line-height:16px}
.foot-links{display:flex;flex-wrap:wrap;justify-content:center;gap:0 16px;margin-bottom:16px}
.foot-links a:hover{text-decoration:underline}
.foot-row{display:flex;justify-content:center;align-items:center;gap:16px}
.foot select{appearance:none;-webkit-appearance:none;border:0;background:transparent;color:var(--tx2);font:inherit;cursor:pointer;padding-inline-end:14px;
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M21 17.502a.997.997 0 0 1-.707-.293L12 8.913l-8.293 8.296a1 1 0 1 1-1.414-1.414l9-9.004a1.03 1.03 0 0 1 1.414 0l9 9.004A1 1 0 0 1 21 17.502Z' fill='%23737373' transform='rotate(180 12 12)'/%3E%3C/svg%3E");
  background-repeat:no-repeat;background-size:10px;background-position:right center}
[dir="rtl"] .foot select{background-position:left center}

/* ---------------- post modal (desktop) ---------------- */
.pm{position:fixed;inset:0;z-index:100;background:var(--overlay);display:flex;align-items:center;justify-content:center;
  opacity:0;transition:opacity .15s}
.pm.show{opacity:1}
.pm-x{position:absolute;top:10px;inset-inline-end:10px;width:40px;height:40px;display:flex;align-items:center;justify-content:center;color:#fff;z-index:3}
.pm-x svg{width:18px;height:18px}
.pm-nav{position:absolute;top:50%;margin-top:-16px;width:32px;height:32px;border-radius:50%;background:#fff;color:#000;
  display:flex;align-items:center;justify-content:center;z-index:3;box-shadow:0 0 5px rgba(0,0,0,.1)}
[data-theme="dark"] .pm-nav{background:#fff}
.pm-nav svg{width:16px;height:16px}
.pm-nav.prev{left:24px}.pm-nav.next{right:24px}
.pm-mtop{display:none}
.pm-box{display:flex;background:var(--modal);border-radius:4px;overflow:hidden;max-height:calc(100vh - 48px);transform:scale(1.02);transition:transform .15s}
.pm.show .pm-box{transform:none}
[data-theme="dark"] .pm-box{background:#000}
.pm-media{background:#000;position:relative;flex:none;display:flex;align-items:center}
.pm-side{display:flex;flex-direction:column;min-width:0;background:var(--bg);border-inline-start:1px solid var(--sep2)}
.pm-head{display:flex;align-items:center;gap:12px;height:60px;padding:0 4px 0 16px;border-bottom:1px solid var(--sep2);flex:none}
[dir="rtl"] .pm-head{padding:0 16px 0 4px}
.av32{width:32px;height:32px;border-radius:50%;object-fit:cover;object-position:50% 22%;flex:none;background:var(--hl)}
.av32r{padding:2px;width:36px;height:36px;border-radius:50%;background:linear-gradient(45deg,#ffd600,#ff7a00,#ff0069,#d300c5,#7638fa);flex:none}
.av32r img{width:32px;height:32px;border:2px solid var(--bg);border-radius:50%;object-fit:cover;object-position:50% 22%}
.pm-head .who{display:flex;align-items:center;gap:4px;flex:1;min-width:0;font-weight:600}
.pm-head .who .dot{color:var(--tx);margin:0 2px;font-weight:400}
.pm-head .fol{color:var(--blue);font-weight:600}
.pm-head .fol.ing{color:var(--tx)}
.pm-head .fol:hover{color:var(--link)}
.pm-scroll{flex:1;overflow-y:auto;padding:16px 16px 0;min-height:0;overscroll-behavior:contain}
.cm{display:flex;gap:16px;margin-bottom:16px;align-items:flex-start}
.cm .body{flex:1;min-width:0;overflow-wrap:anywhere}
.cm .u{font-weight:600;margin-inline-end:4px}
.cm .txt{white-space:pre-wrap}
.cm .txt a{color:var(--link)}
.cm .txt a:hover{text-decoration:underline}
[data-theme="dark"] .cm .txt a{color:#e0f1ff}
.cm .meta{display:flex;gap:12px;color:var(--tx2);font-size:12px;line-height:16px;margin-top:8px}
.cm .meta button{font-weight:600;color:var(--tx2)}
.cm .ch{width:12px;height:12px;margin-top:12px;color:var(--tx2);flex:none}
.cm .ch.on{color:var(--red)}
.cm .ch svg{width:12px;height:12px}
.ln{display:block;min-height:18px}
.cm .txt .ln:first-child{display:inline}
.pm-act{border-top:1px solid var(--sep2);padding:6px 16px 0;flex:none}
.acts{display:flex;align-items:center;margin:0 -8px}
.acts .a{padding:8px;display:flex;color:var(--tx)}
.acts .a .ic{width:24px;height:24px}
.acts .a:hover{color:var(--tx2)}
.acts .sp{flex:1;display:flex;justify-content:center}
.acts .a.liked{color:var(--red)}
.acts .a.liked:hover{color:var(--red)}
.pop{animation:pop .45s cubic-bezier(.17,.89,.32,1.28)}
@keyframes pop{0%{transform:scale(1)}25%{transform:scale(1.2)}50%{transform:scale(.95)}100%{transform:scale(1)}}
.likes{font-weight:600;padding:0 0 0;margin:2px 0 4px}
.likes button{font-weight:600}
.pdate{color:var(--tx2);font-size:12px;line-height:16px;margin-bottom:16px}
.pm-add{display:flex;align-items:center;gap:12px;border-top:1px solid var(--sep2);padding:6px 16px;min-height:53px;flex:none}
.pm-add .emo{color:var(--tx)}
.pm-add textarea{flex:1;border:0;outline:0;resize:none;height:18px;max-height:80px;background:transparent;line-height:18px}
.pm-add textarea::placeholder{color:var(--tx2)}
.pm-add .send{color:var(--blue);font-weight:600}
.pm-add .send:disabled{opacity:.3;cursor:default}
.pm-mobcap{display:none}
.pm-dots2{display:none}

/* ---------------- carousel (shared) ---------------- */
.car{position:relative;width:100%;height:100%;background:#000;direction:ltr;user-select:none;-webkit-user-select:none}
.car-track{display:flex;width:100%;height:100%;overflow-x:auto;overflow-y:hidden;scroll-snap-type:x mandatory;overscroll-behavior-x:contain;
  scrollbar-width:none;-webkit-overflow-scrolling:touch;touch-action:pan-x pan-y pinch-zoom}
.car-track::-webkit-scrollbar{display:none}
.car-track.dragging{scroll-snap-type:none;cursor:grabbing}
.car-slide{flex:0 0 100%;width:100%;height:100%;scroll-snap-align:center;scroll-snap-stop:always;position:relative;display:flex;align-items:center;justify-content:center;overflow:hidden}
.car-slide img{width:100%;height:100%;object-fit:contain;-webkit-user-drag:none;pointer-events:none}
.car-slide.light{background:#fff}
.car-arrow{position:absolute;top:50%;margin-top:-15px;width:30px;height:30px;border-radius:50%;background:rgba(255,255,255,.85);color:#262626;
  display:flex;align-items:center;justify-content:center;z-index:4;box-shadow:0 0 6px rgba(0,0,0,.12);transition:opacity .2s,transform .12s}
.car-arrow:hover{background:#fff}
.car-arrow:active{transform:scale(.92)}
.car-arrow svg{width:12px;height:12px}
.car-arrow.prev{left:8px}.car-arrow.next{right:8px}
.car-arrow.off{opacity:0;pointer-events:none}
.car-dots{position:absolute;bottom:15px;left:0;right:0;display:flex;justify-content:center;gap:4px;z-index:3;pointer-events:none}
.car-dots i{width:6px;height:6px;border-radius:50%;background:#fff;opacity:.4;transition:opacity .25s,transform .25s}
.car-dots i.on{opacity:1}
.car-dots i.sm{transform:scale(.67)}
.car-dots i.xs{transform:scale(.4)}
.burst{position:absolute;left:50%;top:50%;width:96px;height:96px;margin:-48px 0 0 -48px;pointer-events:none;z-index:5;opacity:0;color:#fff;filter:drop-shadow(0 0 8px rgba(0,0,0,.25))}
.burst svg{width:100%;height:100%}
.burst.go{animation:burst 1s ease-out}
@keyframes burst{0%{opacity:0;transform:scale(0)}15%{opacity:.95;transform:scale(1.2)}30%{transform:scale(.95)}45%,80%{opacity:.95;transform:scale(1)}100%{opacity:0;transform:scale(.2) translateY(-60px)}}

/* ---------------- video player chrome (posts + reels) ---------------- */
.vp{position:relative;width:100%;height:100%;display:flex;align-items:center;justify-content:center;background:#000;cursor:pointer}
.vp video{width:100%;height:100%;object-fit:contain;background:#000}
.vp .bigplay{position:absolute;left:50%;top:50%;width:80px;height:80px;margin:-40px 0 0 -40px;border-radius:50%;background:rgba(0,0,0,.5);
  display:flex;align-items:center;justify-content:center;color:#fff;opacity:0;transform:scale(.8);transition:opacity .15s,transform .15s;pointer-events:none}
.vp .bigplay svg{width:34px;height:34px;margin-left:5px}
.vp.paused .bigplay{opacity:1;transform:none}
.vp .mute{position:absolute;bottom:16px;inset-inline-end:16px;width:28px;height:28px;border-radius:50%;background:rgba(38,38,38,.85);color:#fff;
  display:flex;align-items:center;justify-content:center;z-index:3}
.vp .mute svg{width:12px;height:12px}
.vp .scrub{position:absolute;left:0;right:0;bottom:0;height:14px;z-index:2;display:flex;align-items:flex-end;cursor:pointer}
.vp .scrub i{display:block;height:3px;width:100%;background:rgba(255,255,255,.3);position:relative;transition:height .12s}
.vp .scrub i b{position:absolute;left:0;top:0;bottom:0;background:#fff;width:0}
.vp .scrub:hover i,.vp .scrub.drag i{height:6px}
.vp .vlabel{position:absolute;top:12px;left:12px;right:12px;color:#fff;font-size:12px;font-weight:600;text-shadow:0 1px 3px rgba(0,0,0,.6);pointer-events:none;
  opacity:0;transition:opacity .3s}
.vp:hover .vlabel{opacity:.95}

/* ---------------- reels page ---------------- */
.reels{position:relative;height:100vh;overflow:hidden}
.rfeed{height:100vh;overflow-y:auto;scroll-snap-type:y mandatory;scrollbar-width:none;overscroll-behavior:contain}
.rfeed::-webkit-scrollbar{display:none}
.ritem{height:100vh;scroll-snap-align:start;scroll-snap-stop:always;display:flex;justify-content:center;align-items:center;padding:16px 0;gap:0}
.rwrap{display:flex;align-items:flex-end;height:100%}
.rcard{position:relative;height:100%;aspect-ratio:9/16;background:#000;border-radius:8px;overflow:hidden;max-width:calc(100vw - 32px)}
.rcard .vp,.rcard .car{border-radius:0}
.rcard .vp video{object-fit:contain}
.rcard .vp .scrub{bottom:0}
.rtopmute{position:absolute;top:16px;inset-inline-end:16px;width:32px;height:32px;border-radius:50%;background:rgba(38,38,38,.6);color:#fff;display:flex;align-items:center;justify-content:center;z-index:6}
.rtopmute svg{width:14px;height:14px}
.rinfo{position:absolute;left:0;right:0;bottom:0;padding:48px 16px 18px;color:#fff;z-index:5;
  background:linear-gradient(to bottom,rgba(0,0,0,0),rgba(0,0,0,.55));pointer-events:none}
.rinfo>*{pointer-events:auto}
.ruser{display:flex;align-items:center;gap:8px;font-weight:600;margin-bottom:10px}
.ruser img{width:32px;height:32px;border-radius:50%;object-fit:cover;object-position:50% 22%;border:1px solid rgba(255,255,255,.2)}
.ruser .fbtn{border:1px solid rgba(255,255,255,.4);border-radius:8px;padding:5px 12px;font-weight:600;font-size:14px;line-height:18px;margin-inline-start:6px}
.ruser .fbtn:hover{background:rgba(255,255,255,.1)}
.rcap{font-size:14px;line-height:18px;max-height:18px;overflow:hidden;display:flex;gap:6px;cursor:pointer}
.rcap .t{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0}
.rcap .more{color:rgba(255,255,255,.7);flex:none}
.rcap.open{max-height:42vh;overflow-y:auto;display:block;white-space:pre-wrap}
.rcap.open .t{white-space:pre-wrap;overflow:visible}
.rcap.open .more{display:none}
.rcap a{text-decoration:underline}
.raudio{display:flex;align-items:center;gap:6px;margin-top:10px;font-size:12px;line-height:16px;overflow:hidden;white-space:nowrap}
.raudio svg{width:12px;height:12px;flex:none}
.raudio .mq{overflow:hidden;flex:1;mask-image:linear-gradient(90deg,#000 80%,transparent)}
.raudio .mq .in{display:inline-flex;animation:mq 10s linear infinite}
.raudio .mq .in span{padding-inline-end:48px;white-space:nowrap}
.rcard .car-dots{bottom:auto;top:18px}
@keyframes mq{to{transform:translateX(-50%)}}
[dir="rtl"] .raudio .mq .in{animation-name:mqr}
@keyframes mqr{to{transform:translateX(50%)}}
.racts{display:flex;flex-direction:column;align-items:center;gap:20px;padding:0 0 4px;margin-inline-start:16px;width:48px;flex:none}
.racts .ra{display:flex;flex-direction:column;align-items:center;gap:4px;color:var(--tx);font-size:12px;line-height:16px}
.racts .ra .ic{width:24px;height:24px;transition:transform .1s}
.racts .ra:hover .ic{opacity:.6}
.racts .ra.liked{color:var(--red)}
.racts .ra.liked i{color:var(--tx)}
.racts .ra i{font-style:normal}
.racts .aud{width:24px;height:24px;border-radius:6px;border:2px solid var(--tx);overflow:hidden}
.racts .aud img{width:100%;height:100%;object-fit:cover;object-position:50% 22%}
.rnav{position:fixed;inset-inline-end:24px;top:50%;transform:translateY(-50%);display:flex;flex-direction:column;gap:12px;z-index:20}
.rnav button{width:48px;height:48px;border-radius:50%;background:var(--btn2);display:flex;align-items:center;justify-content:center;transition:opacity .2s}
.rnav button:hover{background:var(--btn2h)}
.rnav button.off{opacity:0;pointer-events:none}
.rnav svg{width:20px;height:20px}
.rclose{position:fixed;top:16px;inset-inline-end:24px;z-index:21;width:40px;height:40px;display:flex;align-items:center;justify-content:center;border-radius:50%}
.rclose:hover{background:var(--hover)}
.rclose svg{width:18px;height:18px}
.rtitle{position:fixed;top:20px;inset-inline-start:calc(var(--side-w) + 24px);z-index:21;display:flex;align-items:center;gap:10px;font-weight:600;font-size:16px}
body.rail .rtitle{inset-inline-start:96px}
.rtitle img{width:32px;height:32px;border-radius:50%;object-fit:cover;border:1px solid var(--sep)}
.rcom{width:0;overflow:hidden;transition:width .25s ease;height:100%;flex:none}
.ritem.cm-open .rcom{width:356px;margin-inline-start:16px}
.rcom-in{width:340px;height:100%;background:var(--bg);border:1px solid var(--sep);border-radius:8px;display:flex;flex-direction:column;box-shadow:var(--shadow)}
.rcom-h{display:flex;align-items:center;justify-content:space-between;padding:16px;font-weight:600;font-size:16px}
.rcom-h button svg{width:16px;height:16px}
.rcom .pm-scroll{padding-top:4px}
.rcom .pm-add{border-top:1px solid var(--sep2)}

/* ---------------- dialogs / menus ---------------- */
.dlg{position:fixed;inset:0;z-index:300;background:var(--overlay);display:flex;align-items:center;justify-content:center;animation:fade .1s}
@keyframes fade{from{opacity:0}}
.dlg-box{width:400px;max-width:calc(100vw - 40px);background:var(--modal);border-radius:12px;overflow:hidden;animation:zoomin .1s ease-out}
@keyframes zoomin{from{transform:scale(1.1);opacity:0}}
.dlg-box button,.dlg-box a{display:block;width:100%;min-height:48px;padding:4px 8px;border-top:1px solid var(--sep);font-size:14px;line-height:18px;text-align:center}
.dlg-box>:first-child{border-top:0}
.dlg-box .red{color:#ed4956;font-weight:700}
.dlg-box .b{font-weight:700}
.dlg-title{padding:16px;text-align:center;font-weight:600;font-size:16px;border-bottom:1px solid var(--sep)}
.menu{position:fixed;z-index:310;width:266px;background:var(--modal);border-radius:16px;box-shadow:0 4px 12px rgba(0,0,0,.15);padding:8px;animation:fade .12s}
[data-theme="dark"] .menu{background:#262626}
.menu button,.menu a{display:flex;align-items:center;gap:12px;width:100%;padding:16px;border-radius:8px;text-align:start}
.menu button:hover,.menu a:hover{background:var(--hover)}
.menu .ic{width:18px;height:18px}
.menu hr{border:0;border-top:6px solid var(--hl);margin:8px -8px}
.menu .sw{margin-inline-start:auto;width:40px;height:24px;border-radius:12px;background:var(--hl2);position:relative;transition:background .2s}
.menu .sw::after{content:"";position:absolute;top:3px;inset-inline-start:3px;width:18px;height:18px;border-radius:50%;background:#fff;transition:transform .2s cubic-bezier(.3,.7,.4,1)}
.menu .sw.on{background:var(--tx)}
.menu .sw.on::after{transform:translateX(16px);background:var(--bg)}
[dir="rtl"] .menu .sw.on::after{transform:translateX(-16px)}
.create-box{width:min(740px,calc(100vw - 40px));height:min(782px,calc(100vh - 80px));background:var(--modal);border-radius:12px;display:flex;flex-direction:column;overflow:hidden;animation:zoomin .12s}
.create-box .dlg-title{font-weight:600}
.create-in{flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:16px;font-size:20px;line-height:25px}
.create-in svg{width:96px;height:77px}
.toast{position:fixed;bottom:24px;left:50%;transform:translate(-50%,20px);background:#262626;color:#fff;padding:12px 16px;border-radius:8px;z-index:400;opacity:0;transition:opacity .2s,transform .2s;pointer-events:none;font-size:14px}
[data-theme="dark"] .toast{background:#efefef;color:#000}
.toast.show{opacity:1;transform:translate(-50%,0)}

/* ---------------- mobile top + bottom bars ---------------- */
.mtop,.mbar{display:none}

/* ---------------- responsive ---------------- */
@media (max-width:1263px){
  .side{width:72px}.side .lbl,.side .wm{display:none}.side .glyph{display:block}
  .main{margin-inline-start:72px}
  .rtitle{inset-inline-start:96px}
}
@media (max-width:1000px){
  .pm-nav.prev{left:8px}.pm-nav.next{right:8px}
}
@media (max-width:767px){
  body{overflow-y:auto}
  .side,.drawer{display:none}
  .main,body.rail .main{margin-inline-start:0;padding-bottom:50px}
  .mtop{display:flex;position:sticky;top:0;z-index:30;height:44px;align-items:center;justify-content:space-between;padding:0 16px;
    background:var(--bg);border-bottom:1px solid var(--sep)}
  .mtop .mt-user{display:flex;align-items:center;gap:4px;font-size:16px;font-weight:600;position:absolute;left:50%;transform:translateX(-50%)}
  .mtop .ic{width:24px;height:24px}
  .mbar{display:flex;position:fixed;left:0;right:0;bottom:0;height:50px;z-index:60;background:var(--bg);border-top:1px solid var(--sep);
    justify-content:space-around;align-items:center;padding-bottom:env(safe-area-inset-bottom)}
  .mbar .nav{width:auto;padding:12px;margin:0}
  .mbar .lbl{display:none}
  .prof{padding:0}
  .ph{padding:16px 16px 0;margin-bottom:14px;align-items:center}
  .ph-av{flex:none;margin-inline-end:28px}
  .ph-av .avbox{width:77px;height:77px}
  .ph-row{margin-bottom:12px}
  .ph-info{flex:1}
  .ph-row{display:none}
  .ph-stats{display:flex;justify-content:space-around;gap:0;margin:0;font-size:14px;line-height:18px;text-align:center}
  .ph-stats li,.ph-stats a{display:flex;flex-direction:column;align-items:center}
  .ph-stats b{font-size:16px;line-height:20px}
  .ph-bio-wrap{padding:0 16px 16px}
  .ph-mob-actions{display:flex;gap:6px;padding:0 16px 20px}
  .ph-mob-actions .btn{flex:1;justify-content:center}
  .ph-mob-actions .icbtn{background:var(--btn2);width:34px;height:32px}
  .hls{margin-bottom:12px;padding:0 0 10px}
  .hl{width:auto;padding:0 8px}
  .hl:first-child{padding-inline-start:16px}
  .hl-ring{width:64px;height:64px;padding:3px}
  .hl-n{margin-top:6px;font-weight:400}
  .hls{border-bottom:0}
  body.inreels .mtop{display:none}
  .tabs{gap:0}
  .tab{flex:1;justify-content:center;height:44px}
  .tab .ic{width:24px;height:24px}
  .tab span.t{display:none}
  .tab.on{color:var(--blue);border-top:1px solid var(--tx)}
  .grid{gap:2px}
  .cell .ov{display:none}
  .foot{padding:24px 16px 72px}
  /* post page */
  .pm{background:var(--bg);display:block;overflow-y:auto;z-index:70;bottom:50px}
  .pm-x,.pm-nav{display:none}
  .pm-mtop{display:flex;position:sticky;top:0;z-index:5;height:44px;align-items:center;justify-content:center;background:var(--bg);border-bottom:1px solid var(--sep);font-weight:600;font-size:16px}
  .pm-mtop button{position:absolute;inset-inline-start:8px;top:6px;width:32px;height:32px;display:flex;align-items:center;justify-content:center}
  [dir="rtl"] .pm-mtop button svg{transform:scaleX(-1)}
  .pm-box{flex-direction:column;max-height:none;border-radius:0;transform:none!important;background:var(--bg)}
  .pm-media{width:100vw!important;height:auto!important}
  .pm-media .frame{width:100vw!important}
  .pm-side{display:contents}
  .pm-head{order:-1;border-bottom:0;height:56px;padding:0 4px 0 12px}
  .pm-scroll{order:3;padding:0 16px;overflow:visible;flex:none}
  .pm-scroll .cm:first-child{display:none}
  .pm-mobcap{display:block;order:2;padding:0 16px 8px}
  .pm-mobcap .clamp{display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;white-space:pre-wrap}
  .pm-mobcap .clamp.open{display:block;-webkit-line-clamp:unset}
  .pm-mobcap .morebtn{color:var(--tx2)}
  .pm-mobcap .u{font-weight:600;margin-inline-end:4px}
  .pm-act{order:1;border-top:0;padding:4px 16px 0}
  .pm-dots2{display:flex;gap:4px;justify-content:center}
  .pm-dots2 i{width:6px;height:6px;border-radius:50%;background:var(--hl2);transition:background .2s}
  .pm-dots2 i.on{background:var(--blue)}
  .pm-media .car-dots{display:none}
  .pm-add{order:4}
  .pdate{margin-bottom:8px}
  .car-arrow{display:none}
  /* reels mobile */
  .reels,.rfeed{height:calc(100vh - 50px);height:calc(100dvh - 50px)}
  .ritem{height:calc(100vh - 50px);height:calc(100dvh - 50px);padding:0}
  .rwrap{width:100%;position:relative}
  .rcard{width:100%;height:100%;aspect-ratio:auto;border-radius:0;max-width:none}
  .racts{position:absolute;inset-inline-end:8px;bottom:24px;z-index:7;margin:0}
  .racts .ra{color:#fff;filter:drop-shadow(0 0 2px rgba(0,0,0,.5))}
  .racts .ra.liked i{color:#fff}
  .racts .aud{border-color:#fff}
  .rinfo{padding-inline-end:72px}
  .rnav,.rtitle{display:none}
  .rclose{color:#fff;top:8px;inset-inline-end:8px;background:rgba(0,0,0,.3)}
  .ritem.cm-open .rcom{position:absolute;left:0;right:0;bottom:0;width:auto;height:70%;margin:0;z-index:20}
  .rcom-in{width:100%;border-radius:12px 12px 0 0}
  body.inreels{background:#000}
  body.inreels .mbar{background:#000;border-top-color:#262626;color:#fff}
}
.mstats{display:none}
.ph-bio-wrap.mob{display:none}
@media (max-width:767px){.ph-bio-wrap.desk{display:none}.ph-bio-wrap.mob{display:block}}
.ph-stats{list-style:none}.mstats{list-style:none}
.vbadge .vb{width:100%;height:100%}

/* ===================== v4: Instagram web 2026 layout (icon rail, new header, 4-column grid) ===================== */
:root{--blue:#4a5df9;--blue2:#3b4ee6;--tx:#0c1014;--btn2:#f0f2f5;--btn2h:#e4e6eb;--tab-off:#737373;--rail:72px}
[data-theme="dark"]{--bg:#0c1014;--bg2:#0c1014;--tx:#f5f5f5;--tx2:#a8a8a8;--sep:#2a2f35;--sep2:#25292f;--hl:#25292f;--hl2:#363a40;
  --hover:rgba(255,255,255,.08);--btn2:#25292f;--btn2h:#30353c;--modal:#25292f;--ring:#363a40;--input:#25292f;--tab-off:#8e8e8e;--link:#a9b4ff}
[data-theme="dark"] .pm-box{background:#0c1014}
[data-theme="dark"] .menu{background:#25292f}
.side{width:var(--rail)!important;padding:0 12px 18px;align-items:center}
.side .lbl,.side .wm{display:none!important}
.side .glyph{display:block!important;width:24px;height:24px}
.side-logo{height:auto;padding:12px;margin:30px 0 82px;justify-content:center;border-radius:8px}
.side-logo:hover{background:var(--hover)}
.side-items,.side-bottom{flex:none;align-items:center;width:100%}
.side-bottom{margin-top:auto}
.side .nav{width:48px;height:48px;padding:12px;margin:6px 0;justify-content:center;gap:0}
.side .nav.more{margin-top:96px}
.main,body.rail .main{margin-inline-start:var(--rail)!important}
.drawer{inset-inline-start:var(--rail)}
.rtitle,body.rail .rtitle{inset-inline-start:calc(var(--rail) + 24px)!important}
.prof{max-width:none;padding:42px 20px 0}
.ph{max-width:730px;margin:0 auto;align-items:flex-start}
.ph-av{flex:none;margin-inline-end:24px;justify-content:flex-start}
.ph-av .avbox{width:175px;height:175px;padding:3px;background:linear-gradient(45deg,#ffd600,#ff7a00 25%,#ff0069 55%,#d300c5 80%,#7638fa)}
.ph-av .avbox img{border-radius:50%;border:4px solid var(--bg);display:block}
.ph-info{padding-top:14px;flex:1;min-width:0}
.ph-row{margin:0;gap:10px;flex-wrap:nowrap}
.ph-user{font-size:24px;line-height:30px;font-weight:700;margin:0;gap:6px}
.ph-user .vbadge{width:20px;height:20px}
.ph-row .icbtn.opt .ic{width:20px;height:20px}
.ph-full{font-size:16px;line-height:20px;margin-top:6px}
.ph-stats{margin:12px 0 0;gap:18px;font-size:16px;line-height:20px}
.ph-stats b{font-weight:600}
.ph-bio-wrap .ph-name{display:none}
.ph-bio-wrap.desk{margin-top:22px}
.ph-cat{color:var(--tx2)}
.ph-actions{display:flex;gap:10px;max-width:730px;margin:28px auto 0}
.ph-actions .btn{flex:1;justify-content:center;height:46px;border-radius:12px;font-size:15px}
.ph-actions .btn.sq{flex:none;width:46px;padding:0}
.ph-actions .btn.sq .ic{width:20px;height:20px}
.btn.pri{background:var(--blue)}
.btn.pri:hover{background:var(--blue2)}
.hls{max-width:760px;margin:30px auto 0;padding:0;justify-content:flex-start}
.tabs{max-width:845px;margin:36px auto 0;border-top:0;gap:0}
.tab{flex:1;justify-content:center;height:56px;border:0;margin:0;position:relative;color:var(--tab-off)}
.tab .ic{width:24px;height:24px}
.tab .t{display:none}
.tab.on{color:var(--tx);border:0}
.tab.on::after{content:"";position:absolute;left:50%;bottom:0;width:66px;margin-left:-33px;height:2px;border-radius:1px;background:currentColor}
.grid{max-width:1368px;margin:0 auto;grid-template-columns:repeat(4,1fr);gap:2px}
.grid.reels{grid-template-columns:repeat(4,1fr)}
@media (max-width:1180px){.grid,.grid.reels{grid-template-columns:repeat(3,1fr)}}
.cell .badge{top:10px;inset-inline-end:10px;width:22px;height:22px}
.pm-head .fol{color:var(--blue)}
.pm-add .send{color:var(--blue)}
.dr-sub button{color:var(--blue)}
@media (max-width:767px){
  .side{display:none!important}
  .main,body.rail .main{margin-inline-start:0!important}
  .prof{padding:0}
  .ph{padding:16px 16px 0;align-items:center;margin:0}
  .ph-av{margin-inline-end:24px}
  .ph-av .avbox{width:88px;height:88px;padding:2px}
  .ph-av .avbox img{border-width:3px}
  .ph-info{padding-top:0}
  .ph-row,.ph-full{display:none}
  .ph-stats{margin:0;gap:0}
  .ph-bio-wrap .ph-name{display:block}
  .ph-bio-wrap.mob{padding:12px 16px 0}
  .ph-actions{padding:0 16px;margin:14px 0 0;gap:6px}
  .ph-actions .btn{height:34px;border-radius:8px;font-size:14px}
  .ph-actions .btn.sq{width:34px}
  .hls{margin:16px 0 0;padding:0 0 4px}
  .tabs{margin:14px 0 0}
  .tab{height:46px}
  .tab.on::after{width:100%;left:0;margin:0;height:1px}
  .grid,.grid.reels{grid-template-columns:repeat(3,1fr);gap:2px}
}
.side{border-inline-end:0}
.hls-wrap{position:relative;max-width:730px;margin:30px auto 0}
.hls-wrap .hls{max-width:none;margin:0;scroll-behavior:smooth}
.hl{width:104px;padding:0 10px}
.hls-btn{position:absolute;top:31px;width:26px;height:26px;border-radius:50%;background:#fff;color:#262626;box-shadow:0 0 5px rgba(0,0,0,.25);
  display:flex;align-items:center;justify-content:center;z-index:2;transition:opacity .2s}
.hls-btn svg{width:12px;height:12px}
.hls-btn.next{inset-inline-end:-6px}.hls-btn.prev{inset-inline-start:-6px}
[dir="rtl"] .hls-btn svg{transform:scaleX(-1)}
.hls-btn.off{opacity:0;pointer-events:none}
@media (max-width:767px){.hls-wrap{margin:16px 0 0}.hls-btn{display:none}.hl{width:auto;padding:0 8px}}
