(()=>{
  const BUILD='V249337-hard-preview-feed-visible-final';
  const TOKEN='OKITHAKI_PUBLIC_BETA_TOKEN_SERVER_ONLY_2026';
  const $=id=>document.getElementById(id);
  const esc=s=>String(s??'').replace(/[&<>"']/g,m=>({'&':'&amp;','<':'&lt;','>':'&gt;','"':'&quot;',"'":'&#39;'}[m]));
  const apiBase=()=>{try{if(location.protocol.startsWith('http'))return location.origin;}catch{} return 'https://ok-ithaki.gr';};
  const api=p=>apiBase()+p;
  const room=()=>localStorage.getItem('ith_room')||'ithaki-phone-test';
  const device=()=>localStorage.getItem('ith_device')||'';
  const nick=()=>localStorage.getItem('ith_name')||'Μέλος';
  function setVh(){try{const vv=window.visualViewport;const h=Math.max(360,Math.floor((vv&&vv.height)||window.innerHeight||document.documentElement.clientHeight||720));document.documentElement.style.setProperty('--ith-vh337',h+'px');}catch{}}
  function injectCss(){
    if($('ithClean337Css')) return;
    const st=document.createElement('style'); st.id='ithClean337Css'; st.textContent=`
      :root{--ith-vh337:100dvh;--ith-feed-gap337:0px;--ith-top-safe337:max(8px,env(safe-area-inset-top,0px));}
      #ithBookBtn335,.bookBtn335,#localDoveBtn,.localDoveBtn,.doveIcon,.doveMark,.pigeonBtn,.pigeonButton,#pigeonBtn,.pigeonFloating,[class*="pigeon" i],[id*="pigeon" i]{display:none!important;visibility:hidden!important;pointer-events:none!important;width:0!important;height:0!important;overflow:hidden!important;opacity:0!important}
      .athenaTop337{position:fixed!important;top:var(--ith-top-safe337)!important;left:50%!important;transform:translateX(-50%)!important;z-index:2147483647!important;width:118px!important;height:64px!important;pointer-events:none!important;display:block!important}
      .athenaTop337:before,.athenaTop337:after{content:""!important;position:absolute!important;top:0!important;width:28px!important;height:34px!important;background:linear-gradient(145deg,#ffdf7a,#6b3b12)!important;border:1px solid rgba(255,230,150,.75)!important;box-shadow:0 8px 22px rgba(0,0,0,.35)!important;clip-path:polygon(50% 0,100% 100%,0 100%)!important;opacity:.96!important}
      .athenaTop337:before{left:18px!important;transform:rotate(-18deg)!important}.athenaTop337:after{right:18px!important;transform:rotate(18deg)!important}
      #ithBookBtn337{position:absolute!important;top:12px!important;left:50%!important;transform:translateX(-50%)!important;z-index:2147483647!important;width:56px!important;height:48px!important;border-radius:18px!important;border:1px solid rgba(255,223,122,.75)!important;background:radial-gradient(circle at 35% 18%,rgba(255,255,220,.85),rgba(255,216,105,.46) 42%,rgba(10,18,34,.96))!important;color:#fff8df!important;font-size:26px!important;font-weight:1000!important;display:grid!important;place-items:center!important;box-shadow:0 16px 40px rgba(0,0,0,.48)!important;pointer-events:auto!important}
      .bookModal337{position:fixed!important;inset:0!important;z-index:2147483647!important;display:none!important;place-items:center!important;background:rgba(0,0,0,.76)!important;backdrop-filter:blur(12px)!important;padding:12px!important;box-sizing:border-box!important}.bookModal337.show{display:grid!important}.bookPanel337{width:min(840px,100%)!important;max-height:92dvh!important;display:flex!important;flex-direction:column!important;gap:10px!important;border-radius:28px!important;background:linear-gradient(155deg,#05111d,#102238 62%,#05070c)!important;border:1px solid rgba(255,217,110,.30)!important;box-shadow:0 28px 100px rgba(0,0,0,.72)!important;color:#edf7ff!important;padding:14px!important;box-sizing:border-box!important}.bookTop337{display:flex!important;align-items:center!important;gap:8px!important}.bookTop337 b{color:#ffda73!important;font-size:18px!important}.bookPanel337 input{width:100%!important;box-sizing:border-box!important;border-radius:14px!important;border:1px solid rgba(255,255,255,.14)!important;background:rgba(255,255,255,.07)!important;color:#fff!important;padding:11px!important}.bookGrid337{display:grid!important;grid-template-columns:1fr 1fr 110px!important;gap:8px!important}.bookList337{flex:1 1 auto!important;min-height:0!important;max-height:58dvh!important;overflow-y:auto!important;overflow-x:hidden!important;-webkit-overflow-scrolling:touch!important;display:grid!important;gap:8px!important;padding-right:4px!important}.bookRow337{display:grid!important;grid-template-columns:1fr 1fr auto!important;gap:8px!important;align-items:center!important;border-radius:16px!important;background:rgba(255,255,255,.055)!important;border:1px solid rgba(255,255,255,.08)!important;padding:8px!important}.bookBtnSmall337{border:0!important;border-radius:14px!important;padding:10px 12px!important;background:rgba(255,255,255,.10)!important;color:#fff!important;font-weight:900!important}.bookGold337{background:linear-gradient(180deg,#ffda73,#b7791f)!important;color:#1a1204!important}.bookDanger337{background:rgba(255,77,77,.22)!important;color:#ffd1d1!important}
      body[data-page="feed"]{background:#000!important;overflow:hidden!important;overscroll-behavior:none!important}
      body[data-page="feed"] #nav,body[data-page="feed"] .nav,body[data-page="feed"] .bottomNav{opacity:.18!important;transition:opacity .15s!important}body[data-page="feed"] #nav:hover,body[data-page="feed"] .nav:hover{opacity:.88!important}
      body[data-page="feed"] #feedPage{position:fixed!important;inset:0!important;width:100vw!important;height:var(--ith-vh337,100dvh)!important;min-height:var(--ith-vh337,100dvh)!important;max-height:var(--ith-vh337,100dvh)!important;padding:0!important;margin:0!important;overflow:hidden!important;background:#000!important;border:0!important;border-radius:0!important;box-sizing:border-box!important;z-index:1!important;transform:none!important}
      body[data-page="feed"] #feedPage .feedToolbar332,body[data-page="feed"] #feedPage .feedSearchBar,body[data-page="feed"] #feedPage [id^="feedSearchBarV"],body[data-page="feed"] #feedPage [id^="feedTopBar"],body[data-page="feed"] #feedPage .oldFeedBar,body[data-page="feed"] #feedPage .feedPreviewHeader,body[data-page="feed"] #feedPage .feedOverlayLineV249298,body[data-page="feed"] #feedPage .feedOverlayLineV249299,body[data-page="feed"] #feedPage .feedOverlayLineV249301,body[data-page="feed"] #feedPage .feedOverlayLineV249302{display:none!important;visibility:hidden!important;pointer-events:none!important;height:0!important;min-height:0!important;max-height:0!important;overflow:hidden!important}
      body[data-page="feed"] #feedPage .feedList,body[data-page="feed"] #feedPage #ithCleanFeed332,body[data-page="feed"] #feedPage #ithCleanFeed335,body[data-page="feed"] #feedPage [id^="ithakiTikTokFeedList"]{position:absolute!important;inset:0!important;width:100vw!important;height:var(--ith-vh337,100dvh)!important;min-height:var(--ith-vh337,100dvh)!important;max-height:var(--ith-vh337,100dvh)!important;overflow-y:auto!important;overflow-x:hidden!important;scroll-snap-type:y mandatory!important;scroll-padding:0!important;-webkit-overflow-scrolling:touch!important;overscroll-behavior-y:contain!important;background:#000!important;margin:0!important;padding:0!important;box-sizing:border-box!important;z-index:2!important;display:block!important;transform:none!important}
      body[data-page="feed"] #feedPage .feedList>*{position:relative!important;width:100vw!important;height:var(--ith-vh337,100dvh)!important;min-height:var(--ith-vh337,100dvh)!important;max-height:var(--ith-vh337,100dvh)!important;margin:0!important;padding:0!important;border:0!important;border-radius:0!important;background:#000!important;box-shadow:none!important;overflow:hidden!important;scroll-snap-align:start!important;scroll-snap-stop:always!important;display:block!important;box-sizing:border-box!important;transform:none!important;contain:layout paint!important}
      body[data-page="feed"] #feedPage .postMediaWrap,body[data-page="feed"] #feedPage .mediaInline,body[data-page="feed"] #feedPage .tiktokScreen,body[data-page="feed"] #feedPage .mediaFrame,body[data-page="feed"] #feedPage .videoWrap,body[data-page="feed"] #feedPage .mediaWrap{position:absolute!important;inset:0!important;width:100%!important;height:100%!important;min-height:100%!important;max-height:100%!important;margin:0!important;padding:0!important;border:0!important;border-radius:0!important;overflow:hidden!important;background:#000!important;display:block!important;transform:none!important}
      body[data-page="feed"] #feedPage video,body[data-page="feed"] #feedPage img.feedImage,body[data-page="feed"] #feedPage .postMediaWrap img,body[data-page="feed"] #feedPage .mediaInline img,body[data-page="feed"] #feedPage .postMediaWrap video,body[data-page="feed"] #feedPage .mediaInline video,body[data-page="feed"] #feedPage video.feedVideo{position:absolute!important;inset:0!important;width:100%!important;height:100%!important;min-height:100%!important;max-height:100%!important;object-fit:cover!important;object-position:center center!important;background:#000!important;border-radius:0!important;margin:0!important;padding:0!important;border:0!important;display:block!important;filter:none!important;opacity:1!important;transform:none!important}
      body[data-page="feed"] #feedPage button[class*="full" i],body[data-page="feed"] #feedPage button[id*="full" i],body[data-page="feed"] #feedPage button[class*="zoom" i],body[data-page="feed"] #feedPage button[id*="zoom" i],body[data-page="feed"] #feedPage button[title*="full" i],body[data-page="feed"] #feedPage button[title*="μεγ" i],body[data-page="feed"] #feedPage button[aria-label*="full" i],body[data-page="feed"] #feedPage button[aria-label*="μεγ" i],body[data-page="feed"] #feedPage .fullscreenIcon,body[data-page="feed"] #feedPage .fullScreenIcon,body[data-page="feed"] #feedPage .zoomBtn,body[data-page="feed"] #feedPage .magnify{display:none!important;visibility:hidden!important;pointer-events:none!important;width:0!important;height:0!important;min-width:0!important;min-height:0!important;opacity:0!important;overflow:hidden!important}
      body[data-page="feed"] #feedPage .leftActions,body[data-page="feed"] #feedPage .feedGoldCardActions,body[data-page="feed"] #feedPage .pollPostActions{position:absolute!important;right:8px!important;top:50%!important;left:auto!important;bottom:auto!important;transform:translateY(-50%)!important;z-index:25!important;display:flex!important;flex-direction:column!important;gap:10px!important;background:rgba(0,0,0,.20)!important;padding:6px 4px!important;border-radius:18px!important;border:1px solid rgba(255,255,255,.08)!important;opacity:.92!important}
      body[data-page="feed"] #feedPage .actionIcon,body[data-page="feed"] #feedPage .feedGoldCardActions .btn{width:46px!important;height:46px!important;min-width:46px!important;min-height:46px!important;border-radius:16px!important;display:grid!important;place-items:center!important;background:rgba(0,0,0,.34)!important;color:#fff!important;opacity:1!important;visibility:visible!important;pointer-events:auto!important}
      body[data-page="feed"] #feedPage .postHead{position:absolute!important;left:10px!important;right:76px!important;top:70px!important;z-index:20!important;background:rgba(0,0,0,.26)!important;border-radius:18px!important;padding:8px 10px!important;border:1px solid rgba(255,255,255,.08)!important;backdrop-filter:blur(8px)!important}
      body[data-page="feed"] #feedPage .textClamp,body[data-page="feed"] #feedPage .pollAsText,body[data-page="feed"] #feedPage .postTextOverlayV249332{position:absolute!important;left:12px!important;right:72px!important;bottom:76px!important;z-index:24!important;max-height:22dvh!important;overflow-y:auto!important;padding:10px 12px!important;border-radius:18px!important;background:linear-gradient(180deg,rgba(0,0,0,.02),rgba(0,0,0,.50))!important;color:#fff!important;line-height:1.42!important;white-space:pre-wrap!important;border:1px solid rgba(255,255,255,.08)!important;backdrop-filter:blur(6px)!important}.textClamp:empty,.pollAsText:empty{display:none!important}
      #previewModal.show,.previewModal.show{position:fixed!important;inset:0!important;z-index:2147483646!important;display:flex!important;align-items:flex-start!important;justify-content:center!important;overflow-y:auto!important;overflow-x:hidden!important;-webkit-overflow-scrolling:touch!important;padding:max(14px,env(safe-area-inset-top)) 10px max(18px,env(safe-area-inset-bottom))!important;background:rgba(0,0,0,.78)!important;box-sizing:border-box!important}#previewModal button.zoom,#previewModal .zoomBtn,#previewModal .magnify,#previewModal [data-action="zoom"],#previewModal [title*="μεγ"],#previewModal [title*="zoom" i],#previewModal [title*="full" i],#previewModal [class*="fullscreen" i]{display:none!important;visibility:hidden!important;pointer-events:none!important}#ithPreviewCancel337{position:fixed!important;top:max(10px,env(safe-area-inset-top))!important;left:10px!important;z-index:2147483647!important;border:0!important;border-radius:16px!important;background:rgba(255,80,80,.90)!important;color:#fff!important;font-weight:1000!important;padding:10px 14px!important;box-shadow:0 12px 30px rgba(0,0,0,.34)!important}
      .friendReady337{position:fixed!important;inset:0!important;z-index:2147483647!important;display:none!important;align-items:center!important;justify-content:center!important;background:rgba(0,0,0,.70)!important;backdrop-filter:blur(10px)!important;padding:14px!important;box-sizing:border-box!important}.friendReady337.show{display:flex!important}.friendCard337{width:min(440px,100%)!important;border-radius:26px!important;border:1px solid rgba(255,217,110,.35)!important;background:linear-gradient(150deg,#07131f,#12263d)!important;color:#fff!important;box-shadow:0 28px 80px rgba(0,0,0,.60)!important;padding:16px!important;box-sizing:border-box!important}.friendCard337 h3{margin:0 0 8px!important;color:#ffda73!important}.friendCard337 p{margin:0 0 12px!important;opacity:.90!important;line-height:1.42!important}.friendActions337{display:grid!important;gap:8px!important}.friendActions337 button{border:0!important;border-radius:16px!important;padding:13px 14px!important;font-weight:1000!important;color:#fff!important;background:rgba(255,255,255,.10)!important}.friendActions337 .send{background:linear-gradient(135deg,#36f0a0,#ffda73)!important;color:#071321!important}.friendActions337 .cancel{background:rgba(255,80,80,.22)!important;color:#ffdada!important}
    `; document.head.appendChild(st);
  }
  function ensureBook(){
    injectCss(); let wrap=$('athenaTop337'); if(!wrap){wrap=document.createElement('div');wrap.id='athenaTop337';wrap.className='athenaTop337';wrap.innerHTML='<button id="ithBookBtn337" type="button" title="Βιβλίο Μετάφρασης">📚</button>';document.body.appendChild(wrap);}
    const b=$('ithBookBtn337'); if(b&&!b.__bound337){b.__bound337=1;['click','pointerup','touchend'].forEach(ev=>b.addEventListener(ev,e=>{try{e.preventDefault();e.stopPropagation()}catch{} openBook();},{passive:false}));}
    if(!$('ithBookModal337')){ const m=document.createElement('div'); m.id='ithBookModal337'; m.className='bookModal337'; m.innerHTML=`<div class="bookPanel337"><div class="bookTop337"><b>📚 Βιβλίο Μετάφρασης</b><button class="bookBtnSmall337" id="bookExport337" type="button" style="margin-left:auto">Export</button><button class="bookBtnSmall337 bookDanger337" id="bookClose337" type="button">Κλείσιμο</button></div><div class="bookGrid337"><input id="bookSrc337" placeholder="Λέξη / φράση"><input id="bookDst337" placeholder="Μετάφραση"><button class="bookBtnSmall337 bookGold337" id="bookSave337" type="button">Save</button></div><div style="display:flex;gap:8px;align-items:center"><input id="bookPair337" value="el->en" placeholder="el->en" style="max-width:130px"><button class="bookBtnSmall337" id="bookImport337" type="button">Import</button><input id="bookFile337" type="file" accept="application/json" style="display:none"></div><div id="bookStatus337" style="opacity:.85;font-size:13px">Λεξικό ΙΘΑΚΗΣ · αποθήκευση τοπικά και server όταν απαντά.</div><div id="bookList337" class="bookList337"></div></div>`; m.addEventListener('click',e=>{ if(e.target===m) closeBook(); }); document.body.appendChild(m); $('bookClose337').onclick=closeBook; $('bookSave337').onclick=saveRow; $('bookExport337').onclick=exportRows; $('bookImport337').onclick=()=>$('bookFile337').click(); $('bookFile337').onchange=importRows; }
  }
  function rows(){ try{return JSON.parse(localStorage.getItem('ith_translation_book_v249337')||localStorage.getItem('ith_translation_book_v249335')||'[]')}catch{return[]} }
  function setRows(r){ localStorage.setItem('ith_translation_book_v249337', JSON.stringify(r.slice(-3000))); }
  function renderRows(){ ensureBook(); const box=$('bookList337'); const r=rows().slice().reverse(); box.innerHTML = r.length ? r.map((x,i)=>`<div class="bookRow337"><div><b>${esc(x.source)}</b><br><small>${esc(x.pair||'el->en')}</small></div><div>${esc(x.target)}</div><button class="bookBtnSmall337 bookDanger337" data-del="${i}">×</button></div>`).join('') : '<div style="opacity:.8;padding:10px">Δεν υπάρχουν αποθηκευμένες λέξεις ακόμη.</div>'; box.querySelectorAll('[data-del]').forEach(btn=>btn.onclick=()=>{ const all=rows(); all.splice(all.length-1-Number(btn.dataset.del),1); setRows(all); renderRows(); }); }
  async function saveRow(){ const source=$('bookSrc337').value.trim(), target=$('bookDst337').value.trim(), pair=$('bookPair337').value.trim()||'el->en'; if(!source||!target) return; const all=rows(); all.push({source,target,pair,ts:Date.now()}); setRows(all); $('bookSrc337').value=''; $('bookDst337').value=''; renderRows(); try{const [src_lang,dst_lang]=pair.split('->'); await fetch(api('/api/bridge/dictionary/add'),{method:'POST',headers:{'Content-Type':'application/json','X-ITHAKI-TOKEN':TOKEN},body:JSON.stringify({source,target,src_lang:src_lang||'el',dst_lang:dst_lang||'en',kind:'word'})}); $('bookStatus337').textContent='Αποθηκεύτηκε τοπικά και στάλθηκε στον server.';}catch{ $('bookStatus337').textContent='Αποθηκεύτηκε τοπικά. Ο server δεν απάντησε τώρα.'; }}
  function exportRows(){ const blob=new Blob([JSON.stringify(rows(),null,2)],{type:'application/json'}); const a=document.createElement('a'); a.href=URL.createObjectURL(blob); a.download='ithaki_translation_book_v249337.json'; a.click(); setTimeout(()=>URL.revokeObjectURL(a.href),500); }
  function importRows(){ const f=$('bookFile337').files&&$('bookFile337').files[0]; if(!f)return; const rd=new FileReader(); rd.onload=()=>{ try{ const arr=JSON.parse(rd.result); if(Array.isArray(arr)){ setRows(rows().concat(arr)); renderRows(); }}catch(e){alert('Δεν διαβάστηκε JSON');} }; rd.readAsText(f); }
  function openBook(){ ensureBook(); renderRows(); $('ithBookModal337').classList.add('show'); return false; }
  function closeBook(){ $('ithBookModal337')?.classList.remove('show'); return false; }
  function cleanPreview(){ const pm=$('previewModal'); if(!pm) return; if(pm.classList.contains('show')){ if(!$('ithPreviewCancel337')){ const b=document.createElement('button'); b.id='ithPreviewCancel337'; b.type='button'; b.textContent='Άκυρο'; b.onclick=()=>{pm.classList.remove('show');pm.innerHTML='';b.remove();return false}; document.body.appendChild(b); } pm.querySelectorAll('button,.btn,[title],[aria-label]').forEach(el=>{ const t=((el.textContent||'')+' '+(el.title||'')+' '+(el.getAttribute('aria-label')||'')).toLowerCase(); if(t.includes('🔍')||t.includes('zoom')||t.includes('μεγ')||t.includes('full')) el.style.setProperty('display','none','important'); }); } else { $('ithPreviewCancel337')?.remove(); } }
  function cleanFeed(){ setVh(); injectCss(); ensureBook(); const feed=$('feedPage'); if(!feed) return; try{feed.style.setProperty('height','var(--ith-vh337,100dvh)','important');feed.style.setProperty('max-height','var(--ith-vh337,100dvh)','important');feed.style.setProperty('padding','0','important');feed.style.setProperty('overflow','hidden','important');}catch{} const list=feed.querySelector('.feedList')||feed.querySelector('#ithCleanFeed335')||feed.querySelector('#ithCleanFeed332')||feed.querySelector('[id^="ithakiTikTokFeedList"]'); if(list){ list.id='ithCleanFeed337'; ['height','min-height','max-height'].forEach(k=>list.style.setProperty(k,'var(--ith-vh337,100dvh)','important')); list.style.setProperty('padding','0','important');list.style.setProperty('margin','0','important');list.style.setProperty('scroll-snap-type','y mandatory','important'); [...list.children].forEach(card=>{ if(card.nodeType!==1) return; card.classList.add('ithFullCard337'); ['height','min-height','max-height'].forEach(k=>card.style.setProperty(k,'var(--ith-vh337,100dvh)','important')); card.style.setProperty('margin','0','important');card.style.setProperty('padding','0','important');card.style.setProperty('border-radius','0','important');card.style.setProperty('overflow','hidden','important');card.style.setProperty('scroll-snap-align','start','important'); card.querySelectorAll('video').forEach(v=>{ try{v.controls=false;v.removeAttribute('controls');v.setAttribute('playsinline','');v.setAttribute('webkit-playsinline','');v.preload='metadata';v.style.setProperty('object-fit','cover','important');v.style.setProperty('height','100%','important');v.style.setProperty('width','100%','important'); if(!v.__ith337Click){v.__ith337Click=1;v.addEventListener('click',()=>{try{v.paused?v.play().catch(()=>{}):v.pause()}catch{}});} }catch{} }); card.querySelectorAll('img').forEach(im=>{ try{im.style.setProperty('object-fit','cover','important');im.style.setProperty('height','100%','important');im.style.setProperty('width','100%','important');}catch{} }); card.querySelectorAll('button[class*="full" i],button[id*="full" i],button[class*="zoom" i],button[id*="zoom" i],button[title*="full" i],button[title*="μεγ" i],.fullscreenIcon,.fullScreenIcon,.zoomBtn,.magnify').forEach(x=>{try{x.style.setProperty('display','none','important')}catch{}}); }); } }
  async function fetchFriendIds(){ const d=device(); if(!d) return new Set(); try{const r=await fetch(api('/api/social/member_lists?room_id='+encodeURIComponent(room())+'&device_id='+encodeURIComponent(d)),{cache:'no-store'}); const j=await r.json(); return new Set((j.friends||[]).map(x=>String(x.device_id||x.id||'')).filter(Boolean));}catch{return new Set();} }
  function personName(id){ try{const p=window.ITH&&window.ITH.v249231PersonById?window.ITH.v249231PersonById(id):null; return (p&&(p.nickname||p.name))||'το μέλος';}catch{return 'το μέλος';} }
  function ensureFriendModal(){ if($('friendReady337')) return; const m=document.createElement('div');m.id='friendReady337';m.className='friendReady337';m.innerHTML=`<div class="friendCard337"><h3>🤝 Πρώτα φιλία</h3><p id="friendReadyText337">Για επικοινωνία χρειάζεται αποδοχή φιλίας.</p><div class="friendActions337"><button class="send" id="friendReadySend337" type="button">Στείλε αίτημα φιλίας</button><button id="friendReadyBell337" type="button">Άνοιξε ειδοποιήσεις / αιτήματα</button><button class="cancel" id="friendReadyCancel337" type="button">Άκυρο</button></div></div>`;document.body.appendChild(m); $('friendReadyCancel337').onclick=()=>m.classList.remove('show'); $('friendReadyBell337').onclick=()=>{m.classList.remove('show'); try{window.ITH&&window.ITH.notifyCenter&&window.ITH.notifyCenter()}catch{}}; }
  function showFriendReady(id,mode){ ensureFriendModal(); const m=$('friendReady337'); $('friendReadyText337').innerHTML=`Για να ${mode==='video'?'κάνεις βιντεοκλήση':mode==='voice'?'κάνεις φωνητική κλήση':'στείλεις μήνυμα'} με <b>${esc(personName(id))}</b>, πρέπει πρώτα να γίνει αποδοχή φιλίας.`; $('friendReadySend337').onclick=async()=>{ try{ if(window.ITH&&window.ITH.sendFriendProposal) await window.ITH.sendFriendProposal(id); else await fetch(api('/api/social/friend/request'),{method:'POST',headers:{'Content-Type':'application/json','X-ITHAKI-TOKEN':TOKEN},body:JSON.stringify({room_id:room(),from_id:device(),from_name:nick(),to_id:id,to_name:personName(id)})}); $('friendReadyText337').innerHTML='Το αίτημα φιλίας στάλθηκε. Το άλλο μέλος θα δει κουμπί Αποδοχή / Απόρριψη.'; }catch(e){$('friendReadyText337').textContent='Δεν στάλθηκε τώρα: '+(e&&e.message?e.message:e);} }; m.classList.add('show'); return false; }
  function wrapFriends(){ if(window.__ith337FriendWrap) return; window.__ith337FriendWrap=1; const tryWrap=()=>{ if(!window.ITH) return; const oldChoose=window.ITH.chooseCommunicationContactV249230; if(oldChoose&&!oldChoose.__ith337){ const n=async function(id,mode='message'){id=String(id||''); if(!id) return false; const ids=await fetchFriendIds(); if(!ids.has(id)) return showFriendReady(id,mode); return oldChoose.call(window.ITH,id,mode);}; n.__ith337=1; window.ITH.chooseCommunicationContactV249230=n; window.chooseCommunicationContactV249230=n; } const oldAction=window.ITH.v249231AvatarAction; if(oldAction&&!oldAction.__ith337){ const a=async function(id,action){ if(['message','video','voice'].includes(String(action||''))){ const ids=await fetchFriendIds(); if(!ids.has(String(id||''))) return showFriendReady(String(id||''), action==='message'?'message':action); } return oldAction.call(window.ITH,id,action);}; a.__ith337=1; window.ITH.v249231AvatarAction=a; window.v249231AvatarAction=a; } } ; tryWrap(); setTimeout(tryWrap,500); setTimeout(tryWrap,1500); }
  function wrap(){ if(window.__ith337Wrapped) return; window.__ith337Wrapped=1; window.ITH=window.ITH||{}; ['openTranslationBookV249313','openTranslationBookV249315','openTranslationBookV249316','openTranslationBookV249318','openTranslationBookV249319','openTranslationBookV249324','openTranslationBookV249332','openTranslationBookV249335','openTranslationBookV249337'].forEach(k=>{window.ITH[k]=openBook; window[k]=openBook;}); const oldPage=(window.ITH&&window.ITH.page)?window.ITH.page.bind(window.ITH):(window.page?window.page.bind(window):null); if(oldPage){ const p=function(id){ const r=oldPage(id); setTimeout(()=>{ if(id==='feed') cleanFeed(); cleanPreview(); wrapFriends();},80); setTimeout(()=>{ if(id==='feed') cleanFeed(); cleanPreview();},450); return r; }; window.page=p; window.ITH.page=p; } const oldLoad=(window.ITH&&window.ITH.loadFeed)?window.ITH.loadFeed.bind(window.ITH):(window.loadFeed?window.loadFeed.bind(window):null); if(oldLoad){ const l=function(){ const r=oldLoad(); [80,350,900,1800].forEach(t=>setTimeout(cleanFeed,t)); return r; }; window.loadFeed=l; window.ITH.loadFeed=l; } window.ITH.cleanFeedV249337=cleanFeed; window.ITH.openTranslationBookV249337=openBook; window.ITH.showFriendReadyV249337=showFriendReady; }
  function install(){ setVh(); injectCss(); ensureBook(); ensureFriendModal(); wrap(); wrapFriends(); cleanPreview(); if(document.body?.dataset?.page==='feed') cleanFeed(); const mo=new MutationObserver(()=>{ ensureBook(); wrapFriends(); if(document.body?.dataset?.page==='feed') cleanFeed(); cleanPreview(); }); mo.observe(document.documentElement,{childList:true,subtree:true,attributes:true,attributeFilter:['class','style','data-page']}); setInterval(()=>{setVh();ensureBook();wrapFriends();if(document.body?.dataset?.page==='feed')cleanFeed();cleanPreview();},1200); }
  window.addEventListener('resize',setVh); window.visualViewport&&window.visualViewport.addEventListener('resize',setVh); window.addEventListener('orientationchange',()=>setTimeout(setVh,300));
  if(document.readyState==='loading') document.addEventListener('DOMContentLoaded',install,{once:true}); else install();
})();


/* V249337 extra hard override - preview scroll, no fullscreen icon, clear feed viewport */
(()=>{
  const BUILD='V249337-extra-hard-visible';
  const $=id=>document.getElementById(id);
  function vh(){try{const h=Math.max(360,Math.floor((window.visualViewport&&window.visualViewport.height)||window.innerHeight||document.documentElement.clientHeight||720));document.documentElement.style.setProperty('--ith-vh337',h+'px');return h;}catch{return 720}}
  function css(){
    if($('ithHard337Css'))return;
    const st=document.createElement('style');st.id='ithHard337Css';st.textContent=`
      :root{--ith-vh337:100dvh;--ith-top337:max(8px,env(safe-area-inset-top,0px));}
      body:before{content:'V249337'!important;position:fixed!important;top:2px!important;right:6px!important;z-index:2147483647!important;color:#ffdf7a!important;background:rgba(0,0,0,.55)!important;border:1px solid rgba(255,223,122,.4)!important;border-radius:9px!important;padding:2px 6px!important;font:800 10px system-ui!important;pointer-events:none!important}
      #ithBookBtn337{position:fixed!important;top:calc(var(--ith-top337) + 10px)!important;left:50%!important;transform:translateX(-50%)!important;z-index:2147483647!important;width:74px!important;height:44px!important;border-radius:18px!important;border:1px solid rgba(255,224,130,.88)!important;background:linear-gradient(180deg,rgba(255,225,112,.98),rgba(94,57,10,.95))!important;color:#160c03!important;font-weight:1000!important;font-size:15px!important;box-shadow:0 12px 38px rgba(0,0,0,.55)!important;display:flex!important;align-items:center!important;justify-content:center!important;gap:3px!important;pointer-events:auto!important}
      .athenaTop337{position:fixed!important;top:calc(var(--ith-top337) + 0px)!important;left:50%!important;transform:translateX(-50%)!important;z-index:2147483646!important;width:136px!important;height:62px!important;pointer-events:none!important}.athenaTop337:before,.athenaTop337:after{content:''!important;position:absolute!important;top:2px!important;width:24px!important;height:34px!important;background:linear-gradient(145deg,#ffe48a,#7b470b)!important;clip-path:polygon(50% 0,100% 100%,0 100%)!important;filter:drop-shadow(0 8px 14px rgba(0,0,0,.55))!important}.athenaTop337:before{left:18px!important;transform:rotate(-18deg)!important}.athenaTop337:after{right:18px!important;transform:rotate(18deg)!important}
      [id*='pigeon' i],[class*='pigeon' i],[id*='dove' i],[class*='dove' i],#localDoveBtn,.pigeonFloating,.doveMark{display:none!important;visibility:hidden!important;opacity:0!important;pointer-events:none!important;width:0!important;height:0!important;overflow:hidden!important}
      /* FEED: one true full screen list, no gaps from old styles */
      #feedPage{position:fixed!important;inset:0!important;width:100vw!important;height:var(--ith-vh337,100dvh)!important;min-height:var(--ith-vh337,100dvh)!important;max-height:var(--ith-vh337,100dvh)!important;margin:0!important;padding:0!important;background:#000!important;overflow:hidden!important;border:0!important;border-radius:0!important;box-sizing:border-box!important;z-index:5!important;transform:none!important;}
      #feedPage .feedToolbar332,#feedPage .feedSearchBar,#feedPage [id^='feedSearchBar'],#feedPage [id^='feedTopBar'],#feedPage .oldFeedBar,#feedPage .feedPreviewHeader{display:none!important;height:0!important;min-height:0!important;max-height:0!important;overflow:hidden!important;pointer-events:none!important;visibility:hidden!important}
      #feedPage .feedList,#feedPage [id^='ithCleanFeed'],#feedPage [id^='ithFeedList'],#feedPage [id^='ithakiTikTokFeedList']{position:absolute!important;inset:0!important;width:100vw!important;height:var(--ith-vh337,100dvh)!important;min-height:var(--ith-vh337,100dvh)!important;max-height:var(--ith-vh337,100dvh)!important;margin:0!important;padding:0!important;overflow-y:auto!important;overflow-x:hidden!important;background:#000!important;scroll-snap-type:y mandatory!important;scroll-padding:0!important;-webkit-overflow-scrolling:touch!important;box-sizing:border-box!important;display:block!important;transform:none!important;}
      #feedPage .feedList>*,#feedPage [id^='ithCleanFeed']>*,#feedPage [id^='ithFeedList']>*,#feedPage [id^='ithakiTikTokFeedList']>*,#feedPage article,#feedPage .feedSlideV249314,#feedPage .videoSlideV249314,#feedPage .feedSlideV249315,#feedPage .videoSlideV249315,#feedPage .feedTikTokSlideV249307,#feedPage .slide310,#feedPage .videoPost310,#feedPage .feedVideoPost309,#feedPage .v249305VideoPost,#feedPage .mediaPost{width:100vw!important;height:var(--ith-vh337,100dvh)!important;min-height:var(--ith-vh337,100dvh)!important;max-height:var(--ith-vh337,100dvh)!important;margin:0!important;padding:0!important;border:0!important;border-radius:0!important;box-shadow:none!important;background:#000!important;overflow:hidden!important;scroll-snap-align:start!important;scroll-snap-stop:always!important;box-sizing:border-box!important;transform:none!important;}
      #feedPage video,#feedPage img,#feedPage .postMediaWrap,#feedPage .mediaInline,#feedPage .videoFrameV249316,#feedPage .mediaFrame,#feedPage .videoWrap,#feedPage .mediaWrap{position:absolute!important;inset:0!important;width:100%!important;height:100%!important;min-height:100%!important;max-height:100%!important;margin:0!important;padding:0!important;border:0!important;border-radius:0!important;background:#000!important;overflow:hidden!important;object-fit:cover!important;object-position:center center!important;box-sizing:border-box!important;}
      #feedPage video::-webkit-media-controls-fullscreen-button{display:none!important;opacity:0!important;width:0!important;height:0!important}
      #feedPage video::-webkit-media-controls-enclosure{overflow:hidden!important}
      #feedPage .mediaOpenBtn,#feedPage .fullScreenIcon,#feedPage .fullscreenIcon,#feedPage .zoomBtn,#feedPage .magnify,#feedPage button[class*='full' i],#feedPage button[id*='full' i],#feedPage button[title*='full' i],#feedPage button[title*='μεγ' i],#feedPage button[class*='zoom' i],#feedPage button[id*='zoom' i],#feedPage a[class*='full' i],#feedPage a[class*='zoom' i]{display:none!important;visibility:hidden!important;opacity:0!important;pointer-events:none!important;width:0!important;height:0!important;overflow:hidden!important}
      /* PREVIEW: true scroll, buttons always reachable */
      #previewModal.show,.previewModal.show{position:fixed!important;inset:0!important;width:100vw!important;height:var(--ith-vh337,100dvh)!important;max-height:var(--ith-vh337,100dvh)!important;display:block!important;overflow-y:auto!important;overflow-x:hidden!important;-webkit-overflow-scrolling:touch!important;overscroll-behavior:contain!important;padding:calc(var(--ith-top337) + 10px) 10px calc(env(safe-area-inset-bottom,0px) + 24px)!important;background:rgba(0,0,0,.84)!important;z-index:2147483645!important;box-sizing:border-box!important;align-items:unset!important;justify-content:unset!important;}
      #previewModal.show .previewBox,#previewModal.show .mediaViewer,#previewModal.show .previewScrollable{width:min(760px,calc(100vw - 20px))!important;max-width:calc(100vw - 20px)!important;min-height:0!important;height:auto!important;max-height:none!important;margin:0 auto 24px auto!important;padding:12px 12px 86px 12px!important;border-radius:22px!important;background:#07111e!important;box-sizing:border-box!important;overflow:visible!important;display:block!important;}
      #previewModal.show .row:first-child{position:sticky!important;top:0!important;z-index:2147483646!important;background:rgba(7,17,30,.96)!important;border-radius:16px!important;padding:8px!important;backdrop-filter:blur(8px)!important;}
      #previewModal.show #previewStage,#previewModal.show .previewStage{height:min(48vh,430px)!important;min-height:220px!important;max-height:48vh!important;overflow:hidden!important;border-radius:18px!important;background:#000!important;display:grid!important;place-items:center!important;margin:10px 0!important;}
      #previewModal.show #previewStage video,#previewModal.show .previewStage video,#previewModal.show #previewStage img,#previewModal.show .previewStage img{width:100%!important;height:100%!important;object-fit:contain!important;background:#000!important;position:relative!important;inset:auto!important;}
      #previewModal.show textarea,#previewModal.show input,#previewModal.show select{max-width:100%!important;box-sizing:border-box!important}
      #previewModal.show .progress,#previewModal.show #progressText,#previewModal.show .previewFileCard,#previewModal.show #previewStudioMount,#previewModal.show textarea,#previewModal.show .anonymousRow{display:block!important;visibility:visible!important;}
      #previewModal.show .row:last-child,#previewModal.show .callActions{position:sticky!important;bottom:0!important;z-index:2147483646!important;background:rgba(7,17,30,.98)!important;border-radius:18px!important;padding:10px!important;display:flex!important;gap:8px!important;flex-wrap:wrap!important;box-shadow:0 -10px 30px rgba(0,0,0,.36)!important;}
      #ithPreviewCancel337{position:fixed!important;top:calc(var(--ith-top337) + 8px)!important;left:10px!important;z-index:2147483647!important;border:0!important;border-radius:16px!important;background:#d83b3b!important;color:#fff!important;font-weight:1000!important;padding:11px 15px!important;box-shadow:0 12px 30px rgba(0,0,0,.45)!important;}
      #previewModal [title*='full' i],#previewModal [title*='zoom' i],#previewModal [title*='μεγ' i],#previewModal [class*='fullscreen' i],#previewModal [class*='zoom' i],#previewModal .magnify{display:none!important;visibility:hidden!important;opacity:0!important;pointer-events:none!important;}
    `;document.head.appendChild(st);
  }
  function ensureTop(){css(); if(!$('athenaTop337')){const e=document.createElement('div');e.id='athenaTop337';e.className='athenaTop337';document.body.appendChild(e)} if(!$('ithBookBtn337')){const b=document.createElement('button');b.id='ithBookBtn337';b.type='button';b.innerHTML='📚<span style="font-size:12px">Λεξικό</span>';b.onclick=(ev)=>{ev.preventDefault();ev.stopPropagation();try{(window.ITH&&window.ITH.openTranslationBookV249337?window.ITH.openTranslationBookV249337:window.openTranslationBookV249337||window.openTranslationBookV249336||function(){alert('Λεξικό')})()}catch(e){alert('Λεξικό')}};document.body.appendChild(b)} }
  function cleanPreview(){const pm=$('previewModal'); if(!pm)return; const show=pm.classList.contains('show')||String(pm.innerHTML||'').trim().length>20; if(show){pm.classList.add('show'); if(!$('ithPreviewCancel337')){const b=document.createElement('button');b.id='ithPreviewCancel337';b.textContent='Άκυρο';b.type='button';b.onclick=()=>{try{if(window.ITH&&window.ITH.closePreview)window.ITH.closePreview();else{pm.classList.remove('show');pm.innerHTML='';}}catch{pm.classList.remove('show');pm.innerHTML='';} b.remove(); return false};document.body.appendChild(b)} pm.querySelectorAll('video').forEach(v=>{try{v.setAttribute('playsinline','');v.setAttribute('webkit-playsinline','');v.controls=true;v.setAttribute('controlsList','nodownload nofullscreen noremoteplayback');v.disablePictureInPicture=true;v.disableRemotePlayback=true;}catch{}}); pm.querySelectorAll('button,.btn,a,[title],[aria-label]').forEach(el=>{const t=((el.textContent||'')+' '+(el.title||'')+' '+(el.getAttribute('aria-label')||'')+' '+(el.className||'')+' '+(el.id||'')).toLowerCase(); if(t.includes('fullscreen')||t.includes('full screen')||t.includes('zoom')||t.includes('μεγέθυν')||t.includes('μεγενθ')||t.includes('⛶')||t.includes('🔍')){try{el.style.setProperty('display','none','important')}catch{}}});}else $('ithPreviewCancel337')?.remove();}
  function cleanFeed(){vh();css();ensureTop();const feed=$('feedPage');if(!feed)return;try{Object.assign(feed.dataset,{v249337:'1'});feed.style.setProperty('height','var(--ith-vh337,100dvh)','important');feed.style.setProperty('max-height','var(--ith-vh337,100dvh)','important');feed.style.setProperty('padding','0','important');feed.style.setProperty('overflow','hidden','important')}catch{} const lists=feed.querySelectorAll('.feedList,[id^="ithCleanFeed"],[id^="ithFeedList"],[id^="ithakiTikTokFeedList"]'); lists.forEach(list=>{try{list.id=list.id||'ithFeedList337';list.style.setProperty('height','var(--ith-vh337,100dvh)','important');list.style.setProperty('max-height','var(--ith-vh337,100dvh)','important');list.style.setProperty('padding','0','important');list.style.setProperty('margin','0','important')}catch{}}); feed.querySelectorAll('article,.card,.mediaPost,[class*="Slide"],[class*="Post"]').forEach(card=>{if(!card.querySelector('video,img'))return;try{card.style.setProperty('height','var(--ith-vh337,100dvh)','important');card.style.setProperty('min-height','var(--ith-vh337,100dvh)','important');card.style.setProperty('max-height','var(--ith-vh337,100dvh)','important');card.style.setProperty('margin','0','important');card.style.setProperty('padding','0','important');card.style.setProperty('overflow','hidden','important');card.style.setProperty('scroll-snap-align','start','important')}catch{}}); feed.querySelectorAll('video').forEach(v=>{try{v.pause();v.controls=false;v.removeAttribute('controls');v.setAttribute('playsinline','');v.setAttribute('webkit-playsinline','');v.setAttribute('controlsList','nodownload nofullscreen noremoteplayback');v.disablePictureInPicture=true;v.disableRemotePlayback=true;v.style.setProperty('object-fit','cover','important');v.style.setProperty('width','100%','important');v.style.setProperty('height','100%','important');if(!v.__ith337Click){v.__ith337Click=1;v.addEventListener('click',ev=>{ev.preventDefault();ev.stopPropagation();try{v.paused?v.play().catch(()=>{}):v.pause()}catch{}},{capture:true});}}catch{}}); feed.querySelectorAll('button,a,div,span').forEach(el=>{const t=((el.textContent||'')+' '+(el.title||'')+' '+(el.getAttribute('aria-label')||'')+' '+(el.className||'')+' '+(el.id||'')).toLowerCase(); if(t.includes('⛶')||t.includes('fullscreen')||t.includes('full screen')||t.includes('zoom')||t.includes('μεγέθυν')||t.includes('μεγενθ')){try{el.style.setProperty('display','none','important');el.style.setProperty('pointer-events','none','important')}catch{}}});}
  function loop(){ensureTop();cleanPreview();cleanFeed();}
  function boot(){vh();css();ensureTop();loop();[50,150,350,800,1600,2600].forEach(t=>setTimeout(loop,t));setInterval(loop,350); const mo=new MutationObserver(loop);mo.observe(document.documentElement,{childList:true,subtree:true,attributes:true}); window.addEventListener('resize',()=>{vh();loop()}); window.visualViewport&&window.visualViewport.addEventListener('resize',()=>{vh();loop()});}
  if(document.readyState==='loading')document.addEventListener('DOMContentLoaded',boot,{once:true});else boot();
})();
