

// ===== OK ITHAKI V249345 SELECTOR FEED FIX =====
(function(){
  if(window.__ITHAKI_V249345_REAL_CODE__) return; window.__ITHAKI_V249345_REAL_CODE__=1;
  const BUILD='V249345';
  const GOLD='#d8aa45', GOLD2='#ffd978', BG='#03070d';
  const $=(id)=>document.getElementById(id);
  const room=()=>{try{return (typeof state!=='undefined'&&state.room)||localStorage.getItem('ith_room')||'ithaki-phone-test'}catch{return 'ithaki-phone-test'}};
  const dev=()=>{try{return (typeof state!=='undefined'&&state.device)||localStorage.getItem('ith_device')||'dev_web'}catch{return 'dev_web'}};
  const apiBase=()=>{try{return (typeof state!=='undefined'&&state.api)||location.origin}catch{return location.origin}};
  const api=async(path,opt={})=>{const res=await fetch(apiBase()+path,Object.assign({headers:{'Content-Type':'application/json'}},opt)); if(!res.ok){let t='';try{t=await res.text()}catch{}; throw new Error(t||res.status)} return res.json()};
  const esc=(s)=>String(s??'').replace(/[&<>"']/g,m=>({'&':'&amp;','<':'&lt;','>':'&gt;','"':'&quot;',"'":'&#39;'}[m]));
  function toast(msg){try{if(window.ITH&&ITH.notifyAppEvent)ITH.notifyAppEvent(msg);else if(window.toast)window.toast(msg);else console.log(msg)}catch{}}
  function setVH(){try{document.documentElement.style.setProperty('--ith-vh339',(window.visualViewport?window.visualViewport.height:window.innerHeight)+'px')}catch{}}
  function injectCss(){
    if($('ithV249345Css')) return;
    const st=document.createElement('style'); st.id='ithV249345Css'; st.textContent=`
      :root{--ith-vh339:100dvh;--ith-gold339:${GOLD};--ith-bottom339:calc(env(safe-area-inset-bottom,0px) + 78px);--ith-top339:calc(env(safe-area-inset-top,0px) + 10px)}
      body{background:#000!important}
      #ithBuild339{position:fixed;right:8px;top:calc(env(safe-area-inset-top,0px) + 2px);z-index:2147483000;font:800 10px/1 system-ui;color:#ffd978;background:rgba(0,0,0,.45);border:1px solid rgba(255,217,120,.35);border-radius:999px;padding:4px 7px;pointer-events:none}
      .ithTopBrand339{position:fixed;left:10px;top:var(--ith-top339);z-index:2147482000;display:flex;align-items:center;gap:7px;padding:5px 8px;border-radius:18px;background:linear-gradient(135deg,rgba(0,0,0,.50),rgba(0,0,0,.18));border:1px solid rgba(255,217,120,.22);backdrop-filter:blur(10px);-webkit-backdrop-filter:blur(10px);pointer-events:none}.ithTopBrand339 img{width:34px;height:34px;object-fit:cover;border-radius:10px}.ithTopBrand339 b{font-size:18px;color:#fff;letter-spacing:.02em}.ithTopBrand339 span{display:block;color:#d8aa45;font-size:11px;font-weight:900;margin-top:-3px}.ithBook339{position:fixed;top:var(--ith-top339);left:50%;transform:translateX(-50%);z-index:2147482001;height:44px;min-width:118px;border-radius:999px;border:1px solid rgba(255,217,120,.62);background:rgba(4,10,18,.72);color:#fff2c8;font-weight:950;font-size:15px;display:flex;align-items:center;justify-content:center;gap:8px;box-shadow:0 10px 34px rgba(0,0,0,.38), inset 0 0 0 1px rgba(255,255,255,.06);backdrop-filter:blur(12px);-webkit-backdrop-filter:blur(12px)}.ithBook339:active{transform:translateX(-50%) scale(.96)}
      .ithFeature339{position:fixed;left:10px;top:calc(var(--ith-top339) + 56px);z-index:2147482000;display:flex;gap:7px}.ithFeature339 button{border-radius:999px;border:1px solid rgba(255,217,120,.46);background:rgba(4,10,18,.66);color:#ffe7a7;font-weight:900;font-size:12px;padding:8px 10px;backdrop-filter:blur(10px);-webkit-backdrop-filter:blur(10px)}
      /* TikTok-style clean Feed. One post per screen. No fullscreen icon. */
      #feedPage{position:fixed!important;inset:0!important;height:var(--ith-vh339)!important;max-height:var(--ith-vh339)!important;width:100vw!important;background:#000!important;overflow:hidden!important;padding:0!important;margin:0!important;box-sizing:border-box!important;z-index:1!important}
      #feedPage.active,#feedPage.show{display:block!important}.page#feedPage{padding:0!important}
      #feedPage .feedList,#feedPage [id^="ithCleanFeed"],#feedPage [id^="ithFeedList"],#feedPage [class*="feedList" i]{height:var(--ith-vh339)!important;max-height:var(--ith-vh339)!important;width:100vw!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;overscroll-behavior-y:contain!important;-webkit-overflow-scrolling:touch!important;gap:0!important;box-sizing:border-box!important}
      #feedPage .feedList>*{scroll-snap-align:start!important;scroll-snap-stop:always!important;box-sizing:border-box!important}
      #feedPage .post:has(video),#feedPage article:has(video),#feedPage .mediaPost:has(video),#feedPage .videoPost:has(video),#feedPage .feedItem:has(video){height:var(--ith-vh339)!important;min-height:var(--ith-vh339)!important;max-height:var(--ith-vh339)!important;width:100vw!important;margin:0!important;padding:0!important;border:0!important;border-radius:0!important;background:#000!important;overflow:hidden!important;position:relative!important;box-shadow:none!important;display:block!important}
      #feedPage .post:has(video)::after,#feedPage article:has(video)::after{content:'';position:absolute;left:0;right:0;bottom:-34px;height:34px;background:#000;pointer-events:none;z-index:1}
      #feedPage video,#feedPage .postMediaWrap video,#feedPage .mediaInline video,#feedPage .videoFrameV249316 video,#feedPage .mediaFrame video,#feedPage .videoWrap video,#feedPage .mediaWrap video{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!important;background:#000!important;border:0!important;border-radius:0!important;margin:0!important;padding:0!important;display:block!important;z-index:0!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 [class*="fullscreen" i],#feedPage [class*="full-screen" i],#feedPage [class*="zoom" i],#feedPage [class*="magnif" i],#feedPage [id*="fullscreen" i],#feedPage [id*="zoom" i],#feedPage [title*="full" i],#feedPage [title*="zoom" i],#feedPage [title*="μεγ" i],#feedPage .mediaOpenBtn,#feedPage .fullScreenIcon,#feedPage .fullscreenIcon,#feedPage .zoomBtn,#feedPage .magnify{display:none!important;visibility:hidden!important;opacity:0!important;pointer-events:none!important;width:0!important;height:0!important;overflow:hidden!important}
      #feedPage .postHead:has(+ .postMediaWrap video),#feedPage .postActions,#feedPage .feedTopBar{background:transparent!important;border:0!important}
      #feedPage .feedActionRail339{position:absolute!important;right:10px!important;top:42%!important;transform:translateY(-50%)!important;z-index:20!important;display:flex!important;flex-direction:column!important;gap:13px!important}.feedActionRail339 button{width:52px;height:52px;border-radius:50%;border:1px solid rgba(255,255,255,.75);background:rgba(0,0,0,.45);color:#fff;font-size:22px;display:grid;place-items:center;box-shadow:0 12px 30px rgba(0,0,0,.38)}.feedActionRail339 small{display:block;text-align:center;color:#fff;font-size:11px;margin-top:2px;text-shadow:0 2px 6px #000}.feedCaption339{position:absolute;left:18px;right:88px;bottom:calc(var(--ith-bottom339) + 88px);z-index:20;color:#fff;text-shadow:0 2px 12px #000}.feedCaption339 b{font-size:17px}.feedCaption339 p{font-size:16px;line-height:1.25;margin:6px 0}.feedCaption339 .tag{color:#ffd978;font-weight:900}.feedHint339{position:absolute;left:14px;right:14px;bottom:calc(var(--ith-bottom339) + 8px);z-index:21;border-radius:18px;border:1px solid rgba(255,217,120,.44);background:linear-gradient(135deg,rgba(8,8,8,.78),rgba(27,18,5,.72));color:#fff2c8;display:flex;align-items:center;gap:12px;padding:12px 14px;box-shadow:0 16px 36px rgba(0,0,0,.34);backdrop-filter:blur(9px);-webkit-backdrop-filter:blur(9px)}.feedHint339 .cards{font-size:27px}.feedHint339 span{font-size:13px;line-height:1.25}.feedHint339 b{color:#ffd978}
      .ithSpecial339{height:var(--ith-vh339)!important;min-height:var(--ith-vh339)!important;max-height:var(--ith-vh339)!important;width:100vw!important;background:#000!important;display:grid!important;place-items:center!important;scroll-snap-align:start!important;scroll-snap-stop:always!important;box-sizing:border-box!important;padding:calc(env(safe-area-inset-top,0px) + 74px) 12px calc(var(--ith-bottom339) + 16px)!important;position:relative!important}.ithSpecialInner339{width:min(84vw,480px);max-height:68vh;border-radius:26px;border:1px solid rgba(255,217,120,.50);background:radial-gradient(circle at 50% 0,rgba(255,220,130,.20),transparent 35%),linear-gradient(160deg,#050505,#171006 60%,#030303);color:#fff4d3;text-align:center;padding:24px 18px 18px;box-shadow:0 22px 60px rgba(0,0,0,.55),0 0 42px rgba(216,170,69,.16);overflow:hidden}.ithSpecialInner339 img{width:74px;height:74px;object-fit:cover;border-radius:18px;border:1px solid rgba(255,217,120,.50);margin-bottom:8px}.ithSpecialInner339 h2{margin:4px 0 12px;font-size:clamp(28px,8vw,42px);line-height:.98;color:#e5bd66;font-family:Georgia,serif}.ithSpecialInner339 p{font-size:clamp(17px,4.8vw,24px);line-height:1.28;margin:12px auto;max-width:92%}.ithSpecialInner339 .shipLine{font-size:31px;color:#ffd978;margin:10px 0}.ithSpecialInner339 .next{font-size:12px;color:#d8aa45;margin-top:12px;font-weight:900}.ithSpecial339 .noDup{position:absolute;bottom:calc(var(--ith-bottom339) + 4px);font-size:11px;color:rgba(255,255,255,.55)}
      /* Preview: real scroll, buttons visible */
      #previewModal.show,.previewModal.show{position:fixed!important;inset:0!important;width:100vw!important;height:var(--ith-vh339)!important;max-height:var(--ith-vh339)!important;display:block!important;overflow-y:auto!important;overflow-x:hidden!important;-webkit-overflow-scrolling:touch!important;overscroll-behavior:contain!important;padding:calc(env(safe-area-inset-top,0px) + 10px) 10px calc(env(safe-area-inset-bottom,0px) + 28px)!important;background:rgba(0,0,0,.88)!important;z-index:2147483400!important;box-sizing:border-box!important;align-items:unset!important;justify-content:unset!important}.previewModal.show .previewBox,#previewModal.show .previewBox,#previewModal.show .mediaViewer{width:min(760px,calc(100vw - 20px))!important;max-width:calc(100vw - 20px)!important;height:auto!important;max-height:none!important;min-height:0!important;margin:0 auto 24px!important;padding:12px 12px 96px!important;border-radius:22px!important;background:#07111e!important;box-sizing:border-box!important;overflow:visible!important;display:block!important}.previewModal.show .row:first-child,#previewModal.show .row:first-child{position:sticky!important;top:0!important;z-index:2147483500!important;background:rgba(7,17,30,.96)!important;border-radius:16px!important;padding:8px!important;backdrop-filter:blur(8px)!important}.previewModal.show .row:last-child,#previewModal.show .row:last-child{position:sticky!important;bottom:0!important;z-index:2147483500!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}.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}#ithPreviewCancel339{position:fixed!important;top:calc(env(safe-area-inset-top,0px) + 8px)!important;left:10px!important;z-index:2147483600!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}
      /* Lighthouse / Wall */
      .ithModal339{position:fixed;inset:0;z-index:2147483300;background:#02060d;color:#fff;overflow-y:auto;-webkit-overflow-scrolling:touch}.ithModal339 .close{position:fixed;right:12px;top:calc(env(safe-area-inset-top,0px) + 12px);z-index:5;width:42px;height:42px;border-radius:50%;border:1px solid rgba(255,217,120,.5);background:rgba(0,0,0,.55);color:#fff;font-size:24px}.lightScreen339{min-height:var(--ith-vh339);background:radial-gradient(circle at 55% 28%,rgba(255,219,120,.18),transparent 11%),radial-gradient(circle at 70% 8%,rgba(90,130,255,.26),transparent 22%),linear-gradient(#050b18 0%,#071120 44%,#061018 60%,#020407 100%);position:relative;padding:calc(env(safe-area-inset-top,0px) + 64px) 14px calc(env(safe-area-inset-bottom,0px) + 120px);box-sizing:border-box;overflow:hidden}.lightScreen339:before{content:'';position:absolute;inset:0;background-image:radial-gradient(#fff 0.7px,transparent 0.8px),radial-gradient(rgba(255,255,255,.55) 0.6px,transparent .8px);background-size:37px 37px,71px 71px;opacity:.42}.lightTitle339{position:relative;text-align:center}.lightTitle339 h1{font:700 clamp(38px,10vw,56px)/1.05 Georgia,serif;margin:0;color:#fff}.lightTitle339 p{color:#ffd978;margin:8px 0}.lighthouseIsland339{position:relative;margin:42px auto 20px;width:min(80vw,430px);height:290px;border-radius:32px;background:radial-gradient(circle at 50% 18%,#fff0b0 0 3%,#ffd978 4%,transparent 18%),linear-gradient(transparent 0 56%,rgba(255,255,255,.09) 57%,rgba(0,0,0,.3) 74%,#03101a 75%);box-shadow:0 0 80px rgba(255,210,95,.22)}.lighthouseIsland339 .tower{position:absolute;left:50%;bottom:80px;transform:translateX(-50%);width:48px;height:142px;border-radius:18px 18px 4px 4px;background:linear-gradient(90deg,#80643d,#f7e2aa,#7a5c32);box-shadow:0 0 42px rgba(255,215,120,.45)}.lighthouseIsland339 .beam{position:absolute;left:50%;top:74px;width:78vw;height:60px;transform:translateX(-50%);background:linear-gradient(90deg,transparent,rgba(255,216,104,.45),transparent);filter:blur(5px)}.lightBtn339{position:relative;z-index:2;display:grid;place-items:center;margin:0 auto;width:148px;height:148px;border-radius:50%;border:1px solid rgba(255,229,150,.82);background:radial-gradient(circle,#ffd978,#ad761f);color:#fff;font-size:48px;box-shadow:0 0 0 10px rgba(255,217,120,.08),0 0 70px rgba(255,207,84,.45)}.lightStats339{position:relative;z-index:2;display:grid;grid-template-columns:repeat(3,1fr);gap:8px;margin:18px 0}.lightStats339 div{border:1px solid rgba(255,217,120,.28);border-radius:18px;background:rgba(0,0,0,.34);padding:10px;text-align:center}.lightStats339 b{display:block;color:#ffd978;font-size:20px}.liveStrip339{position:relative;z-index:2;border:1px solid rgba(255,217,120,.25);background:rgba(0,0,0,.32);border-radius:20px;padding:10px;margin-top:14px;color:#fff2c8}.lightDots339{position:absolute;inset:0;pointer-events:none}.lightDot339{position:absolute;width:9px;height:9px;border-radius:50%;background:#ffd978;box-shadow:0 0 16px #ffd978;animation:pulse339 1.8s infinite}@keyframes pulse339{50%{transform:scale(1.9);opacity:.55}}
      .wallScreen339{min-height:var(--ith-vh339);background:radial-gradient(circle at 0 20%,rgba(255,181,70,.18),transparent 22%),linear-gradient(135deg,#080705,#111 45%,#060606);padding:calc(env(safe-area-inset-top,0px) + 66px) 12px calc(env(safe-area-inset-bottom,0px) + 100px);box-sizing:border-box}.wallTitle339{text-align:center}.wallTitle339 h1{font-size:42px;margin:0;color:#fff}.wallTitle339 p{margin:6px 0 14px;color:#d8aa45}.wallList339{display:grid;gap:10px}.wallCard339{border:1px solid rgba(255,217,120,.22);background:rgba(8,8,8,.68);border-radius:18px;padding:12px;box-shadow:0 12px 30px rgba(0,0,0,.24)}.wallCard339 .meta{display:flex;justify-content:space-between;color:#d8aa45;font-size:12px}.wallCard339 p{font-size:16px;line-height:1.35}.wallCard339 button{border:0;background:transparent;color:#ffd978;font-weight:900}.wallComposer339{position:sticky;bottom:calc(env(safe-area-inset-bottom,0px) + 8px);display:flex;gap:8px;border:1px solid rgba(255,217,120,.34);background:rgba(0,0,0,.80);border-radius:18px;padding:8px;margin-top:14px}.wallComposer339 textarea{flex:1;min-height:48px;max-height:110px;border:0;outline:0;background:transparent;color:#fff;resize:vertical}.wallComposer339 button{width:48px;border-radius:14px;border:1px solid rgba(255,217,120,.50);background:#bd862b;color:#fff;font-size:22px}
    `; document.head.appendChild(st);
  }
  function ensureTop(){injectCss(); if(!$('ithBuild339')){const v=document.createElement('div');v.id='ithBuild339';v.textContent='V249345';document.body.appendChild(v)} if(!$('ithTopBrand339')){const b=document.createElement('div');b.id='ithTopBrand339';b.className='ithTopBrand339';b.innerHTML=`<img src="/ok_ithaki_ship_logo.png" onerror="this.style.display='none'"><div><b>OK</b><span>ITHAKI</span></div>`;document.body.appendChild(b)} if(!$('ithBook339')){const b=document.createElement('button');b.id='ithBook339';b.className='ithBook339';b.type='button';b.innerHTML='<span>📖</span><span>Λεξικό</span>';b.onclick=()=>{try{(window.ITH&&ITH.openTranslationBookV249338?ITH.openTranslationBookV249338:window.openTranslationBookV249338||window.openTranslationBookV249336||window.openTranslationBookV249324||function(){alert('Λεξικό')})()}catch{alert('Λεξικό')}};document.body.appendChild(b)} if(!$('ithFeature339')){const f=document.createElement('div');f.id='ithFeature339';f.className='ithFeature339';f.innerHTML='<button type="button" data-f="light">🕯️ Φάρος</button><button type="button" data-f="wall">🧱 Τοίχος</button>';f.onclick=e=>{const b=e.target.closest('button');if(!b)return;b.dataset.f==='light'?openLighthouse():openWall()};document.body.appendChild(f)} }
  function cleanupPreview(){const pm=$('previewModal'); if(!pm)return; const active=pm.classList.contains('show')||String(pm.innerHTML||'').trim().length>20; if(!active){$('ithPreviewCancel339')?.remove();return} pm.classList.add('show'); if(!$('ithPreviewCancel339')){const b=document.createElement('button');b.id='ithPreviewCancel339';b.textContent='Άκυρο';b.type='button';b.onclick=()=>{try{window.ITH&&ITH.closePreview?ITH.closePreview():(pm.innerHTML='',pm.classList.remove('show'))}catch{pm.innerHTML='';pm.classList.remove('show')} b.remove();};document.body.appendChild(b)} pm.querySelectorAll('video').forEach(v=>{try{v.setAttribute('playsinline','');v.setAttribute('webkit-playsinline','');v.setAttribute('controlsList','nodownload nofullscreen noremoteplayback');v.disablePictureInPicture=true;v.disableRemotePlayback=true}catch{}}); }
  function isVideoItem(el){try{return !!el.querySelector('video')}catch{return false}}
  function specialCard(kind,seq){const title=kind==='sofa'?'Σοφά Αφιλοσόφων':'Λόγια Ιθάκης'; const quote=kind==='sofa'?'Ηρεμία δεν είναι η απουσία τρικυμίας, αλλά η δύναμη μέσα στην τρικυμία.':'Ο προορισμός δεν είναι το τέλος, αλλά η πορεία.'; const next=kind==='sofa'?'Λόγια Ιθάκης':'Σοφά Αφιλοσόφων'; const d=document.createElement('section');d.className='ithSpecial339';d.dataset.specialSeq=seq;d.innerHTML=`<div class="ithSpecialInner339"><img src="/ok_ithaki_ship_logo.png" onerror="this.style.display='none'"><h2>${title}</h2><p>“${quote}”</p><div class="shipLine">⛵</div><div class="next">Επόμενη ειδική κάρτα: ${next}<br>Κάθε 7 βίντεο · χωρίς διπλότυπα</div></div><div class="noDup">OK ITHAKI ${BUILD}</div>`;return d;}
  function injectSpecialCards(list){ if(!list || list.__ithInjecting339) return; list.__ithInjecting339=1; try{list.querySelectorAll('.ithSpecial339').forEach(x=>x.remove()); const kids=[...list.children]; let vids=0, seq=0; kids.forEach(ch=>{if(isVideoItem(ch)){vids++; if(vids%7===0){seq++; const kind=(seq%2===1)?'sofa':'ithaki'; ch.insertAdjacentElement('afterend',specialCard(kind,seq));}}}); }catch(e){} finally{list.__ithInjecting339=0;} }
  function feedOverlays(card){ if(!card||card.__ithOverlay339||!card.querySelector('video'))return; card.__ithOverlay339=1; if(!card.querySelector('.feedActionRail339')){const rail=document.createElement('div');rail.className='feedActionRail339';rail.innerHTML='<div><button>♡</button><small>12.4K</small></div><div><button>💬</button><small>256</small></div><div><button>🔖</button><small>3.1K</small></div><div><button>↗</button><small>Κοιν.</small></div><div><button>👤</button><small>Μέλη</small></div>';card.appendChild(rail)} if(!card.querySelector('.feedCaption339')){const cap=document.createElement('div');cap.className='feedCaption339';cap.innerHTML='<b>@okithaki ✨</b><p>Ο προορισμός δεν είναι το τέλος,<br>αλλά η πορεία.</p><div class="tag">#OKITHAKI</div>';card.appendChild(cap)} if(!card.querySelector('.feedHint339')){const h=document.createElement('div');h.className='feedHint339';h.innerHTML='<div class="cards">🃏</div><span>Κάθε 7ο βίντεο εναλλάσσεται:<br><b>Σοφά Αφιλοσόφων / Λόγια Ιθάκης</b></span>';card.appendChild(h)} }
  function cleanFeed(){setVH();injectCss();ensureTop();const feed=$('feedPage');if(!feed)return; const lists=[...feed.querySelectorAll('.feedList,[id^="ithCleanFeed"],[id^="ithFeedList"],[class*="feedList" i]')]; if(!lists.length && feed.children.length) lists.push(feed); lists.forEach(list=>{try{list.style.setProperty('height','var(--ith-vh339)','important');list.style.setProperty('overflow-y','auto','important');list.style.setProperty('scroll-snap-type','y mandatory','important');injectSpecialCards(list)}catch{}}); feed.querySelectorAll('video').forEach(v=>{try{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')}catch{}}); feed.querySelectorAll('.post,article,.mediaPost,.videoPost,.feedItem').forEach(feedOverlays); feed.querySelectorAll('button,a,span,div').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('zoom')||t.includes('μεγέθυν')||t.includes('μεγενθ')){try{el.style.setProperty('display','none','important');el.style.setProperty('pointer-events','none','important')}catch{}}}); }
  function wsLive(onEvent){let ws=null; try{const u=new URL(apiBase().replace(/^http/,'ws')+'/ws/live_v249345'); ws=new WebSocket(u); ws.onopen=()=>ws.send(JSON.stringify({type:'hello',room_id:room(),device_id:dev()})); ws.onmessage=(ev)=>{try{const m=JSON.parse(ev.data); if(m.type&&m.type!=='ready'&&m.type!=='pong')onEvent&&onEvent(m)}catch{}}; ws.onclose=()=>setTimeout(()=>wsLive(onEvent),2500); setInterval(()=>{try{ws.readyState===1&&ws.send(JSON.stringify({type:'ping'}))}catch{}},25000); }catch(e){} return ws; }
  async function openLighthouse(){injectCss(); let root=$('ithLightModal339'); if(!root){root=document.createElement('div');root.id='ithLightModal339';root.className='ithModal339';document.body.appendChild(root)} root.innerHTML=`<button class="close">×</button><div class="lightScreen339"><div class="lightDots339"></div><div class="lightTitle339"><h1>Ο Φάρος</h1><p>Ένα φως ο καθένας, κάθε νύχτα · LIVE</p></div><div class="lighthouseIsland339"><div class="beam"></div><div class="tower"></div></div><button class="lightBtn339" id="lightBtn339">🕯️</button><div style="text-align:center;color:#ffd978;font-weight:900;margin-top:8px">Άναψε το φως σου απόψε<br><small>1 φως / άτομο / νύχτα</small></div><div class="lightStats339"><div><b id="lightLive339">0</b>ζωντανά</div><div><b id="lightTonight339">0</b>από τα μεσάνυχτα</div><div><b id="lightTouches339">0</b>αγγίγματα</div></div><div class="liveStrip339" id="lightActivity339">Ζωντανές αντιδράσεις σε πραγματικό χρόνο.</div></div>`; root.querySelector('.close').onclick=()=>root.remove(); root.querySelector('#lightBtn339').onclick=async()=>{try{const r=await api('/api/lighthouse/light_v249345',{method:'POST',body:JSON.stringify({room_id:room(),owner_token:dev()})}); if(r.message) toast(r.message); await loadLight();}catch(e){toast('Δεν άναψε το φως: '+e.message)}}; async function loadLight(){try{const d=await api(`/api/lighthouse/sky_v249345?room_id=${encodeURIComponent(room())}&owner_token=${encodeURIComponent(dev())}`); $('lightLive339')&&($('lightLive339').textContent=d.live_now||0); $('lightTonight339')&&($('lightTonight339').textContent=d.total_today||0); $('lightTouches339')&&($('lightTouches339').textContent=d.touches_today||0); const dots=root.querySelector('.lightDots339'); dots.innerHTML=''; (d.lights||[]).slice(0,80).forEach(l=>{const s=document.createElement('span');s.className='lightDot339';s.style.left=(l.x||50)+'%';s.style.top=(l.y||50)+'%';s.title='Άγγιγμα';s.onclick=async()=>{try{await api('/api/lighthouse/touch_v249345',{method:'POST',body:JSON.stringify({room_id:room(),owner_token:dev(),light_id:l.light_id})});}catch(e){}};dots.appendChild(s)});}catch(e){}} loadLight(); wsLive((m)=>{if(!$('ithLightModal339'))return; if(m.type==='lighthouse_light'||m.type==='lighthouse_touch'){const a=$('lightActivity339'); if(a)a.textContent=(m.type==='lighthouse_light'?'Νέο φως άναψε τώρα':'Κάποιος άγγιξε ένα φως')+' · LIVE'; loadLight();}}); }
  async function openWall(){injectCss(); let root=$('ithWallModal339'); if(!root){root=document.createElement('div');root.id='ithWallModal339';root.className='ithModal339';document.body.appendChild(root)} root.innerHTML=`<button class="close">×</button><div class="wallScreen339"><div class="wallTitle339"><h1>Τοίχος</h1><p>Ανώνυμα. Ειλικρινά. Ζωντανά.</p><div style="color:#9fd18a">● Ζωντανά τώρα: <b id="wallLive339">0</b></div></div><div class="wallList339" id="wallList339"></div><div class="wallComposer339"><textarea id="wallText339" placeholder="Γράψε ανώνυμα τη σκέψη σου..."></textarea><button id="wallSend339">➤</button></div></div>`; root.querySelector('.close').onclick=()=>root.remove(); root.querySelector('#wallSend339').onclick=async()=>{const t=$('wallText339')?.value.trim(); if(!t)return; try{await api('/api/wall/post_v249345',{method:'POST',body:JSON.stringify({room_id:room(),owner_token:dev(),text:t})}); $('wallText339').value=''; await loadWall();}catch(e){toast('Δεν στάλθηκε: '+e.message)}}; async function loadWall(){try{const d=await api(`/api/wall/list_v249345?room_id=${encodeURIComponent(room())}&limit=80`); $('wallLive339')&&($('wallLive339').textContent=d.live_now||0); const list=$('wallList339'); if(list) list.innerHTML=(d.posts||[]).map(p=>`<div class="wallCard339" data-post="${esc(p.post_id)}"><div class="meta"><b>🎭 Ανώνυμος</b><span>${new Date((p.created_at||0)*1000).toLocaleTimeString('el-GR',{hour:'2-digit',minute:'2-digit'})}</span></div><p>${esc(p.text)}</p><button data-like="${esc(p.post_id)}">♡ ${p.likes||0}</button></div>`).join('')||'<div class="wallCard339"><p>Γίνε ο πρώτος ανώνυμος ψίθυρος.</p></div>'; list.onclick=async(e)=>{const b=e.target.closest('[data-like]'); if(!b)return; try{const r=await api('/api/wall/like_v249345',{method:'POST',body:JSON.stringify({room_id:room(),owner_token:dev(),post_id:b.dataset.like})}); b.textContent='♡ '+(r.likes||0);}catch{}};}catch(e){}} loadWall(); wsLive((m)=>{if(!$('ithWallModal339'))return; if(m.type==='wall_post'||m.type==='wall_like')loadWall();}); }
  function friendGate(peer){ if(!peer)return; let box=$('ithFriendGate339'); if(!box){box=document.createElement('div');box.id='ithFriendGate339';box.style.cssText='position:fixed;inset:auto 12px calc(env(safe-area-inset-bottom,0px) + 92px) 12px;z-index:2147483200;background:rgba(4,10,18,.96);border:1px solid rgba(255,217,120,.42);border-radius:20px;color:#fff;padding:14px;box-shadow:0 18px 50px rgba(0,0,0,.45)';document.body.appendChild(box)} box.innerHTML=`<b>Πρώτα χρειάζεται φιλία</b><div style="margin:7px 0;color:#ffe4a1">Για μήνυμα / φωνητική / βίντεο στείλε αίτημα φιλίας.</div><button id="sendFriend339" style="border-radius:14px;border:0;background:#d8aa45;color:#111;font-weight:1000;padding:12px 14px">Στείλε αίτημα φιλίας</button> <button id="closeFriend339" style="border-radius:14px;border:1px solid #555;background:#111;color:#fff;padding:12px 14px">Άκυρο</button>`; $('closeFriend339').onclick=()=>box.remove(); $('sendFriend339').onclick=()=>{try{if(window.ITH&&ITH.sendFriendProposal)ITH.sendFriendProposal(peer);else if(window.ITH&&ITH.inviteContact)ITH.inviteContact(peer);toast('Στάλθηκε αίτημα φιλίας.')}catch(e){toast('Δεν στάλθηκε αίτημα.')}}; }
  function bindFriendGate(){document.addEventListener('click',(e)=>{const el=e.target.closest('[data-friend-required="1"],[data-peer-id],[data-menu-id]'); if(!el)return; const peer=el.dataset.peerId||el.dataset.menuId; if(!peer||peer===dev())return; /* only show if old code marks it; otherwise do not block */ if(el.dataset.friendRequired==='1'){e.preventDefault();e.stopPropagation();friendGate(peer)}},true)}
  function tick(){ensureTop();cleanupPreview();cleanFeed();}
  function boot(){setVH();injectCss();ensureTop();bindFriendGate(); tick(); [80,180,420,900,1600,2600,4200].forEach(t=>setTimeout(tick,t)); setInterval(tick,650); const mo=new MutationObserver(()=>tick()); mo.observe(document.documentElement,{childList:true,subtree:true,attributes:true}); window.addEventListener('resize',()=>{setVH();tick()}); if(window.visualViewport)window.visualViewport.addEventListener('resize',()=>{setVH();tick()}); window.ITH=window.ITH||{}; Object.assign(window.ITH,{openLighthouseV249345:openLighthouse,openAnonymousWallV249345:openWall,openWallV249345:openWall,showFriendGateV249345:friendGate}); }
  if(document.readyState==='loading')document.addEventListener('DOMContentLoaded',boot,{once:true});else boot();
})();
// ===== END OK ITHAKI V249345 REAL CODE =====
