

  :root{
    --blue:#1877F2;
    --bg:#F0F2F5; --card:#FFFFFF; --text:#050505; --sec:#65676B;
    --bubble:#F0F2F5; --divider:#CED0D4; --icon:#65676B; --chipbg:#E4E6EB;
    --pillbg:#FFFFFF; --pillshadow:0 1px 2px rgba(0,0,0,.2);
  }
  body.dark{
    --bg:#18191A; --card:#242526; --text:#E4E6EB; --sec:#B0B3B8;
    --bubble:#3A3B3C; --divider:#3E4042; --icon:#B0B3B8; --chipbg:#3A3B3C;
    --pillbg:#3A3B3C; --pillshadow:0 1px 2px rgba(0,0,0,.5);
  }
  *{box-sizing:border-box; -webkit-tap-highlight-color:transparent;}
  html,body{margin:0;padding:0;}
  body{
    background:var(--bg); color:var(--text);
    font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,sans-serif;
    padding-top:env(safe-area-inset-top);
    padding-bottom:env(safe-area-inset-bottom);
  }
  [contenteditable]{outline:none;}
  body.edit [contenteditable="true"]:focus{outline:1.5px dashed var(--blue); outline-offset:2px; border-radius:4px;}
  img{display:block;}
  svg{display:block;}

  /* ---------- top bar ---------- */
  .topbar{
    background:var(--card);
    display:flex; align-items:center; justify-content:space-between;
    padding:8px 14px 4px 14px;
  }
  .fblogo{
    color:var(--blue); font-size:28px; font-weight:800; letter-spacing:-0.7px;
    font-family:Helvetica,Arial,sans-serif; user-select:none;
  }
  .topicons{display:flex; gap:10px;}
  .chip{
    width:38px;height:38px;border-radius:50%;
    background:var(--chipbg); display:flex;align-items:center;justify-content:center;
  }
  .chip svg{width:20px;height:20px;fill:var(--text);}

  /* ---------- tabs ---------- */
  .tabs{
    background:var(--card); display:flex;
    border-bottom:1px solid var(--divider);
  }
  .tab{
    flex:1; display:flex; align-items:center; justify-content:center;
    padding:10px 0 9px 0; position:relative;
  }
  .tab svg{width:26px;height:26px;fill:var(--icon);}
  .tab.active svg{fill:var(--blue);}
  .tab.active::after{
    content:""; position:absolute; left:12%; right:12%; bottom:0;
    height:3px; background:var(--blue); border-radius:2px 2px 0 0;
  }

  /* ---------- post card ---------- */
  .card{background:var(--card); margin-top:8px;}
  .posthead{display:flex; align-items:flex-start; padding:12px 16px 0 16px;}
  .avatar{border-radius:50%; object-fit:cover; background:#ccc; flex:none;}
  .posthead .avatar{width:40px;height:40px;}
  .phinfo{flex:1; margin-left:10px; min-width:0;}
  .pname{font-size:16.5px; font-weight:600; line-height:1.25;}
  .psub{font-size:13px; color:var(--sec); display:flex; align-items:center; gap:4px; margin-top:1px;}
  .psub svg{width:12px;height:12px;fill:var(--sec);}
  .editedmark{display:none;}
  .editedmark b{font-weight:700; color:var(--text);}
  body.show-edited .editedmark{display:inline;}
  .phactions{display:flex; align-items:center; gap:14px; color:var(--sec); padding-top:4px;}
  .phactions svg{width:20px;height:20px;fill:var(--sec);}
  .ptext{padding:8px 16px 10px 16px; font-size:17px; line-height:1.4; white-space:pre-wrap; word-wrap:break-word;}
  .pimgwrap{position:relative;}
  .pimg{width:100%; max-height:70vh; object-fit:cover;}

  /* stats */
  .stats{
    display:flex; align-items:center; justify-content:space-between;
    padding:10px 16px; font-size:14px; color:var(--sec);
  }
  .reactions{display:flex; align-items:center; gap:6px;}
  .ricons{display:flex;}
  .ricon{
    width:18px;height:18px;border-radius:50%;
    display:flex;align-items:center;justify-content:center;
    border:1.5px solid var(--card);
  }
  .ricon+.ricon{margin-left:-4px;}
  .ricon.like{background:var(--blue);}
  .ricon.love{background:linear-gradient(#FF6680,#E41E3F);}
  .ricon svg{width:10px;height:10px;fill:#fff;}
  .rstats span[contenteditable]{min-width:8px; display:inline-block;}

  /* action buttons */
  .actions{
    display:flex; border-top:1px solid var(--divider);
    margin:0 12px; padding:2px 0;
  }
  .abtn{
    flex:1; display:flex; align-items:center; justify-content:center; gap:6px;
    padding:9px 0; color:var(--sec); font-size:14px; font-weight:600;
    border-radius:6px; user-select:none;
  }
  .abtn svg{width:19px;height:19px;fill:var(--sec);}

  /* ---------- comments ---------- */
  .comments{padding:4px 16px 10px 16px;}
  .csort{
    display:flex; align-items:center; gap:4px; padding:8px 0 10px 0;
    font-size:14px; font-weight:600; color:var(--sec);
  }
  .csort svg{width:14px;height:14px;fill:var(--sec);}
  .comment{display:flex; margin-bottom:12px; position:relative;}
  .comment .avatar{width:32px;height:32px; margin-top:2px;}
  .comment.reply{margin-left:42px;}
  .comment.reply .avatar{width:26px;height:26px;}
  .cbody{margin-left:8px; min-width:0; max-width:calc(100% - 60px);}
  .bubble{
    background:var(--bubble); border-radius:18px; padding:8px 12px;
    position:relative; display:inline-block; min-width:60px;
  }
  .cname{font-size:14.5px; font-weight:600; line-height:1.3;}
  .ctext{font-size:17px; line-height:1.38; word-wrap:break-word; white-space:pre-wrap;}
  .likepill{
    position:absolute; right:-8px; bottom:-10px;
    background:var(--pillbg); border-radius:11px; box-shadow:var(--pillshadow);
    display:flex; align-items:center; gap:3px; padding:2px 6px 2px 3px;
    font-size:12px; color:var(--sec);
  }
  .likepill .rc{
    width:16px;height:16px;border-radius:50%;
    display:flex;align-items:center;justify-content:center; flex:none;
  }
  .likepill .rc+.rc{margin-left:-4px;}
  .likepill .rc.like{background:var(--blue);}
  .likepill .rc.love{background:linear-gradient(#FF6680,#E41E3F);}
  .likepill .rc svg{width:9px;height:9px;fill:#fff;}
  .likepill .rc.emo{font-size:13px;background:none;}
  .rstack{display:flex;align-items:center;}
  .likepill.hidden{display:none;}
  /* author badge (like FB's "Author" tag on creator comments) */
  .cnamerow{display:flex;align-items:center;gap:5px;}
  .abadge{
    display:inline-flex;align-items:center;gap:3px; flex:none;
    background:var(--chipbg); color:var(--sec);
    font-size:10.5px;font-weight:600;border-radius:9px;padding:1.5px 6px;
  }
  .abadge svg{width:9px;height:9px;fill:var(--sec);}
  /* comment images */
  .cimg{max-width:62%;max-height:220px;width:auto;object-fit:cover;border-radius:14px;margin-top:6px;display:block;}
  /* profile post images */
  .pvimg{width:100%;border-radius:10px;margin:2px 0 8px 0;display:block;}
  .cmeta{
    display:flex; gap:16px; font-size:13px; color:var(--sec);
    margin:5px 0 0 12px;
  }
  .cmeta b{font-weight:600; cursor:default;}
  /* comment edit controls */
  .editbar{
    position:absolute; right:0; top:-6px; display:none; gap:6px;
  }
  body.edit .editbar{display:flex;}
  .mini{
    width:26px;height:26px;border-radius:50%; border:none;
    background:var(--chipbg); color:var(--sec); font-size:13px; line-height:1;
    display:flex;align-items:center;justify-content:center; opacity:.85;
  }
  .addcomment{display:none; margin:2px 0 10px 0;}
  body.edit .addcomment{display:block;}
  .addcomment button, .addbtn{
    border:1.5px dashed var(--sec); background:none; color:var(--sec);
    border-radius:18px; padding:7px 14px; font-size:13px; font-weight:600;
  }

  /* comment input bar */
  .cinput{
    position:sticky; bottom:0; background:var(--card);
    border-top:1px solid var(--divider);
    display:flex; align-items:center; gap:8px; padding:8px 12px calc(8px + env(safe-area-inset-bottom)) 12px;
  }
  .cinput .avatar{width:32px;height:32px;}
  .cfield{
    flex:1; display:flex; align-items:center;
    background:var(--bubble); border-radius:18px; padding:0 4px 0 14px;
  }
  .cfield input{
    flex:1; border:none; background:none; outline:none;
    font-size:15px; color:var(--text); padding:9px 0;
    font-family:inherit; min-width:0;
  }
  .cfield input::placeholder{color:var(--sec);}
  #cSend, #cPhotoBtn{
    border:none; background:none; padding:6px 6px; flex:none;
    display:flex; align-items:center;
  }
  #cSend svg{width:20px;height:20px;fill:var(--blue);}
  #cPhotoBtn svg{width:20px;height:20px;fill:var(--sec);}
  #cPhotoPreview{
    width:26px;height:26px;border-radius:6px;object-fit:cover;
    flex:none;display:none;margin-right:2px;
  }

  /* interactive likes */
  .abtn.liked{color:var(--blue);}
  .abtn.liked svg{fill:var(--blue);}
  .j-clike.liked{color:var(--blue);}
  body.film .abtn, body.film .j-clike, body.film .j-creply{cursor:pointer;}

  /* ---------- profile view ---------- */
  #profileView{display:none;}
  body.view-profile #profileView{display:block;}
  body.view-profile .topbar, body.view-profile .tabs,
  body.view-profile #feedView, body.view-profile .cinput{display:none;}

  .pv-top{
    position:sticky; top:0; z-index:40; background:var(--card);
    display:flex; align-items:center; gap:12px; padding:10px 14px;
    border-bottom:1px solid var(--divider);
  }
  .pv-top .navbtn{border:none;background:none;padding:4px;margin:-4px;}
  .pv-top svg{width:24px;height:24px;fill:var(--text);}
  .pv-topname{flex:1; font-size:17px; font-weight:700; white-space:nowrap; overflow:hidden; text-overflow:ellipsis;}
  .pv-cover{height:150px; background:#8aa; background-size:cover; background-position:center;}
  .pv-head{background:var(--card); padding:0 16px 14px 16px;}
  .pv-avatar{
    width:110px;height:110px;border-radius:50%;
    border:4px solid var(--card); margin-top:-55px;
    object-fit:cover; background:#ccc;
  }
  .pv-name{font-size:24px; font-weight:800; margin-top:8px; line-height:1.2;}
  .pv-bio{font-size:15px; margin-top:3px;}
  .pv-friends{font-size:15px; color:var(--sec); margin-top:4px;}
  .pv-friends b{color:var(--text);}
  .pv-btns{display:flex; gap:8px; margin-top:12px;}
  .pbtn2{
    flex:1; border:none; border-radius:8px; padding:9px 0;
    font-size:15px; font-weight:600; background:var(--chipbg); color:var(--text);
  }
  .pbtn2.primary{background:var(--blue); color:#fff;}
  .pv-sec{background:var(--card); margin-top:8px; padding:12px 16px;}
  .pv-sect{font-size:17px; font-weight:700; margin-bottom:10px;}
  .inforow{display:flex; align-items:flex-start; gap:10px; margin-bottom:11px; font-size:15px; position:relative;}
  .inforow svg{width:20px;height:20px;fill:var(--sec);flex:none; margin-top:1px;}
  .inforow .itext{flex:1;}
  .inforow .mini{position:absolute; right:0; top:0; display:none;}
  body.edit .inforow .mini{display:flex;}
  .fgrid{display:grid; grid-template-columns:repeat(3,1fr); gap:8px;}
  .fcell img{width:100%; aspect-ratio:1; border-radius:8px; object-fit:cover; background:#ccc;}
  .fcell div{font-size:12.5px; font-weight:600; margin-top:4px; line-height:1.2;}
  .seeall{
    margin-top:12px; width:100%; border:none; background:var(--chipbg);
    color:var(--text); border-radius:8px; padding:8px 0; font-weight:600; font-size:14px;
  }
  .pv-post{border-top:1px solid var(--divider); padding-top:12px; margin-top:12px; position:relative;}
  .pv-post .posthead{padding:0;}
  .pv-post .ptext{padding:8px 0 10px 0;}
  .pv-post .stats{padding:10px 0;}
  .pv-post .actions{margin:0;}
  .pv-post .editbar{top:0;}
  .pv-editonly{display:none; margin-top:12px;}
  body.edit .pv-editonly{display:block;}

  /* ---------- edit UI ---------- */
  #gear{
    position:fixed; right:14px; bottom:76px; z-index:60;
    width:48px;height:48px;border-radius:50%; border:none;
    background:var(--blue); color:#fff; box-shadow:0 3px 10px rgba(0,0,0,.3);
    font-size:22px; display:flex;align-items:center;justify-content:center;
  }
  body.film #gear, body.locked #gear{display:none;}
  .install-float{
    position:fixed; left:14px; bottom:76px; z-index:60;
    border:none; background:var(--blue); color:#fff;
    font-weight:700; font-size:14px; font-family:inherit;
    padding:10px 16px; border-radius:22px;
    box-shadow:0 3px 10px rgba(0,0,0,.3);
    display:flex; align-items:center; gap:7px;
  }
  .install-float svg{width:17px;height:17px;fill:#fff;}
  .install-float.hidden{display:none;}
  /* native in-post CTA (like FB app-ad attachment) */
  .postcta{
    display:flex; align-items:center; justify-content:space-between; gap:10px;
    background:var(--bubble); border-radius:8px;
    margin:4px 16px 10px 16px; padding:10px 12px;
  }
  .postcta.hidden{display:none;}
  .ctanote{
    display:inline-flex; align-items:center; gap:5px;
    font-size:12.5px; color:var(--sec); font-weight:600; min-width:0;
  }
  .ctanote svg{width:14px;height:14px;flex:none;}
  .ctabtn{
    border:none; background:var(--blue); color:#fff; flex:none;
    font-weight:700; font-size:14px; font-family:inherit;
    padding:8px 14px; border-radius:6px;
  }
  /* install CTA inside a comment */
  .ccta{margin:8px 0 2px 0; padding:10px 12px; justify-content:flex-start; gap:12px;}
  .ccta .ctanote{font-size:12px;}
  .ccta .ctabtn{font-size:15.5px; padding:11px 22px; order:-1;}
  #panel{
    position:fixed; left:0; right:0; bottom:0; z-index:70;
    background:var(--card); border-radius:16px 16px 0 0;
    box-shadow:0 -4px 24px rgba(0,0,0,.35);
    padding:14px 16px calc(18px + env(safe-area-inset-bottom)) 16px;
    transform:translateY(110%); transition:transform .25s ease;
    max-height:78vh; overflow-y:auto;
  }
  #panel.open{transform:translateY(0);}
  .prow{display:flex; align-items:center; justify-content:space-between; margin-bottom:12px; gap:10px; flex-wrap:wrap;}
  .plabel{font-size:14px; font-weight:600;}
  .seg{display:flex; background:var(--bubble); border-radius:8px; padding:3px;}
  .seg button{
    border:none; background:none; color:var(--sec); font-size:13px; font-weight:600;
    padding:6px 12px; border-radius:6px;
  }
  .seg button.on{background:var(--blue); color:#fff;}
  .pbtn{
    border:none; background:var(--bubble); color:var(--text);
    font-size:13px; font-weight:600; padding:9px 14px; border-radius:8px;
  }
  .pbtn.primary{background:var(--blue); color:#fff;}
  .pbtn.danger{color:#E41E3F;}
  .profbtns{display:flex; flex-wrap:wrap; gap:8px; width:100%;}
  .phint{font-size:12.5px; color:var(--sec); line-height:1.45; margin-top:6px;}
  #panelClose{
    position:absolute; right:12px; top:10px; border:none; background:var(--bubble);
    width:30px;height:30px;border-radius:50%; color:var(--sec); font-size:15px;
  }
  .ptitle{font-size:16px; font-weight:700; margin:0 0 14px 0;}
  #editHint{
    position:fixed; left:50%; transform:translateX(-50%);
    bottom:calc(20px + env(safe-area-inset-bottom));
    background:rgba(0,0,0,.75); color:#fff; font-size:12.5px;
    padding:8px 14px; border-radius:20px; z-index:50; white-space:nowrap;
    opacity:0; pointer-events:none; transition:opacity .3s;
  }
  #editHint.show{opacity:1;}
  #fileInput{display:none;}


/* text size control */
:root{--fs:1;}
.ptext{font-size:calc(17px * var(--fs));}
.ctext{font-size:calc(17px * var(--fs));}
.pname{font-size:calc(16.5px * var(--fs));}
.cname{font-size:calc(14.5px * var(--fs));}

/* wheel mini-game */
.wheel-bubble{background:linear-gradient(160deg,#2a1250,#4a1d7a 55%,#7b2ff7);border-radius:16px;padding:14px 14px 16px;color:#fff;text-align:center;position:relative;}
.wheel-bubble .cname{color:#fff;}
.wheel-bubble .cnamerow{justify-content:center;}
.wheel-title{font-size:16px;font-weight:800;margin:2px 0 10px;color:#ffe9a8;text-shadow:0 1px 2px rgba(0,0,0,.4);}
.wheel-wrap{position:relative;width:210px;max-width:80%;margin:0 auto;aspect-ratio:1/1;}
.wheel-svg{width:100%;height:100%;display:block;transform-origin:50% 50%;transition:transform 4s cubic-bezier(.12,.66,.14,1);filter:drop-shadow(0 6px 16px rgba(0,0,0,.45));}
.wheel-hub{position:absolute;top:50%;left:50%;width:46px;height:46px;transform:translate(-50%,-50%);border-radius:50%;background:radial-gradient(circle at 35% 30%,#fff,#ffd21e 62%,#e6a700);color:#5a2b00;font-weight:900;font-size:12px;display:flex;align-items:center;justify-content:center;box-shadow:0 2px 8px rgba(0,0,0,.4),inset 0 0 0 3px #fff;pointer-events:none;z-index:2;}
.wheel-ptr{position:absolute;top:-4px;left:50%;transform:translateX(-50%);width:0;height:0;border-left:13px solid transparent;border-right:13px solid transparent;border-top:24px solid #ff2d55;z-index:3;filter:drop-shadow(0 2px 3px rgba(0,0,0,.5));}
.wheel-spin{margin-top:16px;display:inline-flex;align-items:center;justify-content:center;gap:9px;border:none;cursor:pointer;background:linear-gradient(180deg,#ffe86b,#ff9d00 70%,#ff7a00);color:#5a2b00;font-weight:900;font-size:18px;text-transform:uppercase;letter-spacing:.5px;padding:16px 34px;border-radius:32px;box-shadow:0 7px 0 #b96b00,0 12px 22px rgba(255,140,0,.5), inset 0 0 0 3px rgba(255,255,255,.4);animation:wspinpulse 1.4s ease-in-out infinite;transition:transform .08s;}
.wheel-spin .wheel-spin-ic{font-size:21px;line-height:1;}
.wheel-spin:active{transform:translateY(4px);box-shadow:0 3px 0 #b96b00,0 6px 12px rgba(0,0,0,.35), inset 0 0 0 3px rgba(255,255,255,.4);}
.wheel-spin.spinning{opacity:.7;cursor:default;animation:none;}
@keyframes wspinpulse{0%,100%{transform:translateY(0) scale(1);box-shadow:0 7px 0 #b96b00,0 12px 22px rgba(255,140,0,.45), inset 0 0 0 3px rgba(255,255,255,.4);}50%{transform:translateY(-2px) scale(1.04);box-shadow:0 9px 0 #b96b00,0 16px 32px rgba(255,165,0,.72), inset 0 0 0 3px rgba(255,255,255,.55);}}
.wheel-pop{position:fixed;inset:0;z-index:9998;background:rgba(10,4,25,.72);-webkit-backdrop-filter:blur(3px);backdrop-filter:blur(3px);display:none;align-items:center;justify-content:center;padding:20px;}
.wheel-pop.show{display:flex;animation:wpopfade .25s ease;}
.wheel-pop-card{position:relative;width:min(340px,90vw);background:linear-gradient(165deg,#2a1250,#5a1d8a 60%,#8a2be2);border-radius:22px;padding:28px 22px 22px;text-align:center;color:#fff;box-shadow:0 18px 50px rgba(0,0,0,.55),inset 0 0 0 2px rgba(255,255,255,.12);animation:wpopin .5s cubic-bezier(.18,.9,.28,1.3);}
@keyframes wpopfade{from{opacity:0}to{opacity:1}}
@keyframes wpopin{0%{transform:translateY(60px) scale(.7);opacity:0}100%{transform:none;opacity:1}}
.wheel-pop-emoji{font-size:46px;line-height:1;margin-bottom:6px;}
.wheel-pop-title{font-size:20px;font-weight:800;color:#ffe9a8;}
.wheel-pop-prize{font-size:26px;font-weight:900;margin:8px 0 18px;text-shadow:0 2px 6px rgba(0,0,0,.4);}
.wheel-pop-amt{color:#ffd21e;}
.wheel-pop .wheel-claim{width:100%;display:flex;justify-content:center;align-items:center;background:linear-gradient(180deg,#22e06a,#0aa84c);color:#fff;font-size:17px;font-weight:800;border:none;border-radius:14px;padding:15px;cursor:pointer;box-shadow:0 8px 20px rgba(10,168,76,.5);animation:wclaim 1.3s ease-in-out infinite;}
.wheel-pop .wheel-claim span{color:#fff;}
@keyframes wclaim{0%,100%{transform:scale(1)}50%{transform:scale(1.045)}}
.wheel-pop-note{display:flex;align-items:center;justify-content:center;gap:6px;font-size:12px;opacity:.85;margin-top:12px;}
.wheel-pop-note svg{width:15px;height:15px;}
.wheel-pop-x{position:absolute;top:8px;right:11px;background:transparent;border:none;color:rgba(255,255,255,.6);font-size:18px;cursor:pointer;line-height:1;}
.wheel-inpost{margin:10px 16px 4px;}
.wheel-edit{margin-top:14px;display:block;text-align:left;background:rgba(0,0,0,.2);border-radius:12px;padding:12px;}
.we-hd{color:#ffe9a8;font-weight:800;font-size:12px;margin:2px 0 8px;text-transform:uppercase;letter-spacing:.5px;}
.we-hd:not(:first-child){margin-top:12px;border-top:1px solid rgba(255,255,255,.15);padding-top:12px;}
.we-row{display:flex;align-items:center;gap:8px;margin-bottom:7px;}
.we-lab{flex:0 0 44%;color:#fff;font-size:11.5px;font-weight:600;opacity:.92;}
.we-row input,.we-row select{flex:1;min-width:0;padding:7px 9px;border-radius:8px;border:1px solid rgba(255,255,255,.4);background:rgba(255,255,255,.16);color:#fff;font-size:12.5px;font-weight:700;box-sizing:border-box;}
.we-seg{display:flex;flex-wrap:wrap;gap:6px;margin-bottom:8px;}
.wheel-seg-inp{width:calc(33.33% - 4px);padding:7px 4px;border-radius:8px;border:1px solid rgba(255,255,255,.4);background:rgba(255,255,255,.16);color:#fff;font-size:12px;font-weight:700;text-align:center;box-sizing:border-box;}
.wheel-edit input::placeholder{color:rgba(255,255,255,.6);font-weight:600;}
body.film .wheel-edit, body.locked .wheel-edit{display:none !important;}

#fb-splash{position:fixed;top:0;left:0;right:0;bottom:0;width:100%;height:100%;z-index:2147483000;display:flex;flex-direction:column;align-items:center;justify-content:center;background:#ffffff;transition:opacity .4s ease;}#fb-splash.gone{opacity:0 !important;pointer-events:none !important;}#fb-splash svg{width:76px !important;height:76px !important;display:block;}#fb-splash .fb-splash-bar{position:relative;width:150px;height:4px;margin-top:22px;border-radius:4px;background:rgba(0,0,0,.09);overflow:hidden;}#fb-splash .fb-splash-bar i{position:absolute;top:0;left:0;height:100%;width:45%;border-radius:4px;background:#1877f2;animation:fbspbar 1.05s ease-in-out infinite;}@keyframes fbspbar{0%{left:-45%}100%{left:100%}}
