@kangsicj/nexussync 1.5.0 → 1.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,11 +4,11 @@
4
4
  // @namespace https://github.com/kangsicj/NexusSync
5
5
  // @author kangsicj
6
6
  // @homepageURL https://github.com/kangsicj/NexusSync
7
- // @supportURL https://fairy.hada.io/@jinny
7
+ // @supportURL https://fairy.hada.io/@kangsicj
8
8
  // @icon https://cdn.jsdelivr.net/npm/@kangsicj/nexussync@latest/assets/icon.svg
9
9
  // @updateURL https://cdn.jsdelivr.net/npm/@kangsicj/nexussync@latest/dist/NexusSync.meta.js
10
10
  // @downloadURL https://cdn.jsdelivr.net/npm/@kangsicj/nexussync@latest/dist/NexusSync.user.js
11
- // @version 1.5.0
11
+ // @version 1.6.1
12
12
  // @description Watch any web video together in perfect sync: cinema mode, live AI subtitles & translation, chat bubbles with auto-translation, quick ink, cover, go-together to the next episode.
13
13
  // @description:ko 어떤 웹 영상이든 완벽한 싱크로 함께 보기: 시네마 모드, 실시간 AI 자막·번역, 자동 번역 말풍선 채팅, 잠깐 그리기, 가리기, 다음 화도 함께.
14
14
  // @match *://*/*
@@ -46,12 +46,12 @@
46
46
 
47
47
  // The version of the code that is actually running (the manager's metadata can lag
48
48
  // behind when an old copy is still installed).
49
- const NXU_VERSION = '1.5.0';
49
+ const NXU_VERSION = '1.6.1';
50
50
  // Rank used by the one-instance guard below and to tell newer builds apart in a room.
51
51
  // It is independent of the public version (1.0.0 is the first public release, after
52
52
  // private builds that reached ranks up to 10.2.0), so every older copy still installed
53
53
  // steps aside instead of this release.
54
- const NXU_RANK = '11.5.0';
54
+ const NXU_RANK = '11.6.1';
55
55
  const NXU_SESSION = Math.random().toString(36).slice(2, 10); // this page load // raise with every release
56
56
  // App icon (same artwork as assets/icon.svg / @icon), inlined so it shows offline too.
57
57
  const NXU_ICON = 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNTYgMjU2IiByb2xlPSJpbWciIGFyaWEtbGFiZWw9Ik5leHVzU3luYyI+PGRlZnM+PGxpbmVhckdyYWRpZW50IGlkPSJueGJnIiB4MT0iMCIgeTE9IjAiIHgyPSIxIiB5Mj0iMSI+PHN0b3Agb2Zmc2V0PSIwIiBzdG9wLWNvbG9yPSIjNWIyZWZmIi8+PHN0b3Agb2Zmc2V0PSIxIiBzdG9wLWNvbG9yPSIjZmY0ZmEzIi8+PC9saW5lYXJHcmFkaWVudD48cmFkaWFsR3JhZGllbnQgaWQ9Im54Z2xvdyIgY3g9IjAuODIiIGN5PSIwLjE0IiByPSIwLjciPjxzdG9wIG9mZnNldD0iMCIgc3RvcC1jb2xvcj0iIzdjZjlmZiIgc3RvcC1vcGFjaXR5PSIwLjU1Ii8+PHN0b3Agb2Zmc2V0PSIxIiBzdG9wLWNvbG9yPSIjN2NmOWZmIiBzdG9wLW9wYWNpdHk9IjAiLz48L3JhZGlhbEdyYWRpZW50PjxsaW5lYXJHcmFkaWVudCBpZD0ibnhwbGF5IiB4MT0iMCIgeTE9IjAiIHgyPSIxIiB5Mj0iMSI+PHN0b3Agb2Zmc2V0PSIwIiBzdG9wLWNvbG9yPSIjZmZmZmZmIi8+PHN0b3Agb2Zmc2V0PSIxIiBzdG9wLWNvbG9yPSIjZmZlM2YxIi8+PC9saW5lYXJHcmFkaWVudD48Y2xpcFBhdGggaWQ9Im54ciI+PHJlY3Qgd2lkdGg9IjI1NiIgaGVpZ2h0PSIyNTYiIHJ4PSI1OCIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNueHIpIj48cmVjdCB3aWR0aD0iMjU2IiBoZWlnaHQ9IjI1NiIgZmlsbD0idXJsKCNueGJnKSIvPjxyZWN0IHdpZHRoPSIyNTYiIGhlaWdodD0iMjU2IiBmaWxsPSJ1cmwoI254Z2xvdykiLz48ZyBmaWxsPSJub25lIiBzdHJva2U9IiNmZmZmZmYiIHN0cm9rZS13aWR0aD0iMTUiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCI+PHBhdGggZD0iTTYwIDExNiBBNzAgNzAgMCAwIDEgMTc4IDcyIi8+PHBhdGggZD0iTTE5NiAxNDAgQTcwIDcwIDAgMCAxIDc4IDE4NCIvPjwvZz48cGF0aCBkPSJNMTg2IDUwIEwyMDAgOTIgTDE1NyA4NiBaIiBmaWxsPSIjZmZmZmZmIi8+PHBhdGggZD0iTTcwIDIwNiBMNTYgMTY0IEw5OSAxNzAgWiIgZmlsbD0iI2ZmZmZmZiIvPjxwYXRoIGQ9Ik0xMTAgOTIgUTEwNCA4OCAxMDQgOTYgTDEwNCAxNjAgUTEwNCAxNjggMTEwIDE2NCBMMTYyIDEzMiBRMTY4IDEyOCAxNjIgMTI0IFoiIGZpbGw9InVybCgjbnhwbGF5KSIvPjwvZz48L3N2Zz4=';
@@ -673,7 +673,7 @@
673
673
  rotateDenied: '📱 Motion access was declined, so tilting cannot switch to landscape. Use the ↻ button in cinema mode.', menuRotate: 'Tilt-to-landscape for videos on/off (iPhone)',
674
674
  canvas: 'Canvas', bookmark: 'Bookmark', bookmarkTitle: 'Bookmark the current position', chat: 'Chat', aiSub: 'AI Sub', aiSubTitle: 'Live subtitles & translation (Alt+Shift+T)',
675
675
  subLog: 'Sub Log', debug: 'Debug', hideOnSite: 'Hide on this site', hideOnSiteTitle: 'Hide the floating button on this site (restore with Alt+Shift+N or the userscript menu)',
676
- hiddenOnSite: '🙈 Hidden on this site · Alt+Shift+N to show', shownOnSite: '⚙️ Button shown on this site',
676
+ hiddenOnSite: '🙈 ⚙️ button hidden on this site · turn it back on in Settings or with Alt+Shift+N', shownOnSite: '⚙️ Button shown on this site',
677
677
  roomChat: 'Room Chat', chatLog: 'Chat history', chatCleared: '🧹 Chat history cleared', nickname: 'Nickname (optional)', chatPlaceholder: 'Message…', newMessages: 'New', latest: 'Latest',
678
678
  subHistory: 'Subtitle History', export: 'Export', clear: 'Clear', logCleared: '🧹 Subtitle history cleared', logExported: '💾 Subtitle history exported',
679
679
  createRoom: 'Create a room', copyPin: 'Copy PIN', enterPin: 'Enter PIN', joinRoom: 'Join Room', viewerMode: 'Viewer mode (follow without controlling)',
@@ -696,6 +696,7 @@
696
696
  setReactionsHint: 'Tap a slot, then pick an emoji (or type any emoji). Add or remove slots (1–16).', setReactionsReset: 'Back to the default reactions', setPlayback: 'Playback', setAutoNext: 'Next episode automatically',
697
697
  setTogether: 'Watching together', setRecvReact: 'Show others’ reactions', setRecvNudge: 'Receive nudges (shake)', setRecvInk: 'Show others’ sketches', setRecvChat: 'Show chat bubbles', setRecvPing: 'Show pointers',
698
698
  setPeople: 'People in this room', setMute: 'Hide', setUnmute: 'Show', setMutedHint: 'Hidden people’s messages, reactions and sketches are not shown on this device (only for this room).',
699
+ setAutoCinemaSw: 'Auto cinema on this site', setAdGuardSw: 'Ad guard', setHideFab: 'Hide the ⚙️ button on this site', setHideFabHelp: 'On: the floating ⚙️ button no longer appears on this site. To bring it back, turn this switch off — or press Alt+Shift+N, or use the userscript manager’s menu.', setAvatarPh: 'Type any emoji not in the list', setAvatarReset: 'No avatar',
699
700
  setAdvanced: 'Advanced', setAvatarCustom: 'Any emoji or initials', setAvatarPhoto: 'Photo', setAvatarClear: 'Remove', setAvatarFail: 'Could not use this picture.', setSlotAdd: '+ Add a slot', setSlotRemove: '- Remove this slot', setEmojiPh: 'Any emoji', setNobody: 'Nobody else is here yet.',
700
701
  speakerLanguage: 'Spoken language', speakerHelp: 'The language spoken in the video or by you. Recognition only understands this language.',
701
702
  subtitleLanguage: 'Translate subtitles to', audioSource: 'Audio source', audioAuto: 'Auto (video audio when possible + mic)', audioMic: 'Microphone only',
@@ -713,6 +714,8 @@
713
714
  subUsingMicFallback: 'The video sound could not be heard directly — listening through the microphone (turn the speakers up).',
714
715
  subTabShareEnded: 'Tab audio sharing stopped, so subtitles were turned off.',
715
716
  subHearVideo: '🎧 Listening to the video', subHearMic: '🎧 Listening through the microphone', subVideoSilent: '🔇 No sound reaches the subtitles from this video',
717
+ subDiagCopy: 'Copy a problem report', subDiagCopied: '🔬 Report copied — paste it in your message', subDiagInDebug: '🔬 Report written to the debug console (Settings → Advanced → Debug)',
718
+ subNoTrackInput: '⚠️ This browser’s speech engine cannot listen to the video sound directly — it only hears the microphone (play the sound through speakers, not headphones), or add a free Groq key in AI Sub → Advanced.', subIssueNoTrack: 'The speech engine only hears the microphone here', subNoService: '⚠️ This browser has no working speech recognition service (it works in Chrome). Add a free Groq or an OpenAI key in AI Sub → Advanced to use AI recognition instead.', subNoServiceKey: '⚠️ This browser has no working speech recognition service — switching to AI recognition with your key.',
716
719
  subIssueNet: '⚠️ Speech service connection is unstable — retrying', subIssueNoResult: '⚠️ Sound arrives but no words are recognised', subSiteBlocksSpeech: 'This site does not allow the browser’s speech recognition. Add an OpenAI or Groq key (AI subtitles → Advanced) to use AI subtitles here.', subSiteBlocksSpeechKey: 'This site blocks the browser’s speech recognition — switching to cloud recognition with your key.', subTryMic: '🎤 Listen through the mic', subTryKey: '🔑 Use an AI recognition key', subShareTab: '🎬 Connect tab sound', subTabNotShared: 'Tab audio was not shared. Choose this tab and turn on “Share tab audio”.',
717
720
  subPosition: 'Subtitle position', posVideo: 'Over the video', posScreen: 'Bottom of the screen', subSize: 'Size', subOpacity: 'Opacity',
718
721
  advanced: 'Advanced', translationEngine: 'Translation engine', providerAuto: 'Google first, on-device as backup (best quality)', providerBrowser: 'On-device only (private)',
@@ -725,7 +728,7 @@
725
728
  speakerMic: 'Mic', speakerMedia: 'Video', speakerMixed: 'Mixed',
726
729
  subOn: '🎙️ AI subtitles ON', subOff: '🔇 AI subtitles OFF', subUnsupported: 'This browser has no speech recognition. Use Chrome, Edge or Safari.',
727
730
  subNeedsHttps: 'Subtitles need a secure (https) page.', subMicDenied: '🎤 Microphone access is off. Click the 🔒 icon left of the address bar, set Microphone to “Allow”, then try again.',
728
- subMicUnavailable: '🎙️ No audio input available.', subNoMic: '🎙️ No microphone found.', subServiceBlocked: 'The speech service is not available in this browser.',
731
+ subMicUnavailable: '🎙️ No audio input available.', subNoMic: '🎙️ No microphone found.', subServiceBlocked: 'The speech service is not available in this browser. On iPhone/iPad turn on Settings → Siri (and Dictation in Keyboard settings); elsewhere use Chrome, or add a free Groq key in AI Sub → Advanced.',
729
732
  subNetworkFailed: 'Speech service unreachable. Check the connection and start again.', subLangUnsupported: 'This language is not supported for recognition.',
730
733
  subStalled: 'Speech recognition keeps failing. Please start again.', subWebAudioUnavailable: 'Video audio unavailable here — using the microphone.',
731
734
  p2pActive: '⚡ Direct P2P connection active', p2pLost: '⚠️ P2P lost — using relay', roomConnected: '🟢 Room connected', guestJoined: '👋 A guest joined',
@@ -788,7 +791,7 @@
788
791
  rotateDenied: '📱 동작·방향 접근이 거부되어 기울여서 가로 보기를 쓸 수 없습니다. 시네마 화면의 ↻ 버튼으로 돌릴 수 있습니다.', menuRotate: '동영상 기울이면 가로 보기 켜기/끄기 (아이폰)',
789
792
  canvas: '캔버스', bookmark: '북마크', bookmarkTitle: '현재 위치를 북마크', chat: '채팅', aiSub: 'AI 자막', aiSubTitle: '실시간 자막·번역 (Alt+Shift+T)',
790
793
  subLog: '자막 기록', debug: '디버그', hideOnSite: '이 사이트에서 숨기기', hideOnSiteTitle: '이 사이트에서 떠 있는 버튼 숨기기 (Alt+Shift+N 또는 유저스크립트 메뉴로 복원)',
791
- hiddenOnSite: '🙈 이 사이트에서 숨김 · Alt+Shift+N으로 표시', shownOnSite: '⚙️ 이 사이트에서 버튼 표시',
794
+ hiddenOnSite: '🙈 이 사이트에서 ⚙️ 버튼을 숨겼어요 · 설정이나 Alt+Shift+N으로 다시 켤 수 있어요', shownOnSite: '⚙️ 이 사이트에서 버튼 표시',
792
795
  roomChat: '방 채팅', chatLog: '채팅 기록', chatCleared: '🧹 채팅 기록을 지웠어요', nickname: '닉네임 (선택)', chatPlaceholder: '메시지…', newMessages: '새 메시지', latest: '최신',
793
796
  subHistory: '자막 기록', export: '내보내기', clear: '지우기', logCleared: '🧹 자막 기록을 지웠습니다', logExported: '💾 자막 기록을 저장했습니다',
794
797
  createRoom: '방 만들기', copyPin: 'PIN 복사', enterPin: 'PIN 입력', joinRoom: '방 참여', viewerMode: '시청자 모드 (조작 없이 따라보기)',
@@ -811,6 +814,7 @@
811
814
  setReactionsHint: '칸을 누른 뒤 이모지를 고르세요 (아무 이모지나 입력해도 돼요). 칸은 1~16개로 늘리거나 줄일 수 있어요.', setReactionsReset: '기본 리액션으로', setPlayback: '재생', setAutoNext: '다음 화 자동으로 넘기기',
812
815
  setTogether: '함께 보기', setRecvReact: '다른 사람 리액션 보기', setRecvNudge: '찌르기 받기 (흔들림)', setRecvInk: '다른 사람 그림 보기', setRecvChat: '말풍선 보기', setRecvPing: '포인터 보기',
813
816
  setPeople: '이 방의 사람들', setMute: '숨기기', setUnmute: '보이기', setMutedHint: '숨긴 사람의 메시지·리액션·그림은 이 기기에서 보이지 않아요 (이 방에서만).',
817
+ setAutoCinemaSw: '이 사이트에서 자동 시네마', setAdGuardSw: '광고 가리기', setHideFab: '이 사이트에서 ⚙️ 버튼 숨기기', setHideFabHelp: '켜면 이 사이트에서 화면에 떠 있는 ⚙️ 버튼이 보이지 않아요. 다시 보이게 하려면 이 스위치를 끄거나, Alt+Shift+N 또는 유저스크립트 관리자 메뉴를 쓰세요.', setAvatarPh: '목록에 없는 이모지 입력', setAvatarReset: '아바타 없음',
814
818
  setAdvanced: '고급', setAvatarCustom: '이모지나 이니셜 입력', setAvatarPhoto: '사진', setAvatarClear: '지우기', setAvatarFail: '이 사진은 사용할 수 없어요.', setSlotAdd: '+ 칸 추가', setSlotRemove: '- 선택한 칸 삭제', setEmojiPh: '이모지 입력', setNobody: '아직 다른 사람이 없어요.',
815
819
  speakerLanguage: '말하는 언어', speakerHelp: '영상(또는 말하는 사람)의 언어를 선택하세요. 음성 인식은 이 언어만 알아듣습니다.',
816
820
  subtitleLanguage: '자막 번역 언어', audioSource: '오디오 입력', audioAuto: '자동 (가능하면 영상 소리 + 마이크)', audioMic: '마이크만',
@@ -828,6 +832,8 @@
828
832
  subUsingMicFallback: '영상 소리를 직접 들을 수 없어 마이크로 들어요. 스피커 소리를 키워 주세요.',
829
833
  subTabShareEnded: '탭 오디오 공유가 끝나서 자막을 껐어요.',
830
834
  subHearVideo: '🎧 영상 소리 듣는 중', subHearMic: '🎧 마이크로 듣는 중', subVideoSilent: '🔇 이 영상의 소리가 자막에 전달되지 않아요',
835
+ subDiagCopy: '문제 진단 보고서 복사', subDiagCopied: '🔬 진단 보고서를 복사했어요 — 메시지에 붙여 넣어 주세요', subDiagInDebug: '🔬 진단 보고서를 디버그 콘솔에 남겼어요 (설정 → 고급 → 디버그)',
836
+ subNoTrackInput: '⚠️ 이 브라우저의 음성 인식은 영상 소리를 직접 듣지 못하고 마이크로만 들어요. 이어폰 대신 스피커로 소리를 내거나, AI 자막 → 고급에서 무료 Groq 키를 넣어 주세요.', subIssueNoTrack: '이 브라우저는 마이크로만 들을 수 있어요', subNoService: '⚠️ 이 브라우저에는 동작하는 음성 인식 서비스가 없어요 (Chrome에서는 동작해요). AI 자막 → 고급에서 무료 Groq 키나 OpenAI 키를 넣으면 AI 인식으로 쓸 수 있어요.', subNoServiceKey: '⚠️ 이 브라우저에는 동작하는 음성 인식 서비스가 없어 입력한 키로 AI 인식을 시작해요.',
831
837
  subIssueNet: '⚠️ 음성 인식 서버 연결이 불안정해요 — 다시 시도 중', subIssueNoResult: '⚠️ 소리는 들어오는데 말이 인식되지 않아요', subSiteBlocksSpeech: '이 사이트는 브라우저 음성 인식을 막아 두었어요. AI 자막 → 고급에서 OpenAI 또는 Groq 키를 넣으면 여기서도 쓸 수 있어요.', subSiteBlocksSpeechKey: '이 사이트는 브라우저 음성 인식을 막아 두어서, 넣어 둔 키로 클라우드 인식으로 바꿀게요.', subTryMic: '🎤 마이크로 듣기', subTryKey: '🔑 AI 인식 키 사용', subShareTab: '🎬 탭 소리 연결', subTabNotShared: '탭 오디오가 공유되지 않았어요. 이 탭을 고르고 “탭 오디오 공유”를 켜 주세요.',
832
838
  subPosition: '자막 위치', posVideo: '영상 위', posScreen: '화면 하단', subSize: '크기', subOpacity: '불투명도',
833
839
  advanced: '고급', translationEngine: '번역 엔진', providerAuto: 'Google 우선, 기기 내 번역 보조 (최고 품질)', providerBrowser: '기기 내 번역만 (개인정보 보호)',
@@ -840,7 +846,7 @@
840
846
  speakerMic: '마이크', speakerMedia: '영상', speakerMixed: '혼합',
841
847
  subOn: '🎙️ AI 자막 켜짐', subOff: '🔇 AI 자막 꺼짐', subUnsupported: '이 브라우저는 음성 인식을 지원하지 않습니다. Chrome, Edge, Safari를 사용하세요.',
842
848
  subNeedsHttps: '자막은 보안(https) 페이지에서만 동작합니다.', subMicDenied: '🎤 마이크 권한이 꺼져 있어요. 주소창 왼쪽 🔒(사이트 정보)에서 마이크를 “허용”으로 바꾼 뒤 다시 눌러 주세요.',
843
- subMicUnavailable: '🎙️ 사용할 수 있는 오디오 입력이 없습니다.', subNoMic: '🎙️ 마이크를 찾을 수 없습니다.', subServiceBlocked: '이 브라우저에서는 음성 인식 서비스를 사용할 수 없습니다.',
849
+ subMicUnavailable: '🎙️ 사용할 수 있는 오디오 입력이 없습니다.', subNoMic: '🎙️ 마이크를 찾을 수 없습니다.', subServiceBlocked: '이 브라우저에서는 음성 인식 서비스를 쓸 수 없어요. 아이폰·아이패드는 설정 → Siri와 키보드 설정의 받아쓰기를 켜 주세요. 그 밖에는 Chrome을 쓰거나 AI 자막 → 고급에서 무료 Groq 키를 넣어 주세요.',
844
850
  subNetworkFailed: '음성 인식 서버에 연결할 수 없습니다. 연결을 확인하고 다시 시작하세요.', subLangUnsupported: '이 언어는 음성 인식을 지원하지 않습니다.',
845
851
  subStalled: '음성 인식이 계속 실패합니다. 다시 시작해 주세요.', subWebAudioUnavailable: '이 페이지에서는 영상 소리를 직접 받을 수 없어 마이크를 사용합니다.',
846
852
  p2pActive: '⚡ P2P 직접 연결됨', p2pLost: '⚠️ P2P 끊김 — 중계 서버로 전환', roomConnected: '🟢 방에 연결됨', guestJoined: '👋 게스트가 참여했습니다',
@@ -1172,8 +1178,8 @@
1172
1178
  .nxu-cinema-root.nxu-ambient-stage { top: var(--nxu-stage-y, 0px) !important; bottom: auto !important; left: var(--nxu-stage-x, 0px) !important; right: auto !important;
1173
1179
  width: calc(100vw - 2 * var(--nxu-stage-x, 0px)) !important; height: calc(100vh - 2 * var(--nxu-stage-y, 0px)) !important; height: calc(100dvh - 2 * var(--nxu-stage-y, 0px)) !important;
1174
1180
  box-shadow: 0 16px 48px rgba(0,0,0,0.5) !important; }
1175
- .nxu-fit-cover video.nxu-cinema-video, video.nxu-cinema-root.nxu-fit-cover { object-fit: cover !important; }
1176
- .nxu-fit-fill video.nxu-cinema-video, video.nxu-cinema-root.nxu-fit-fill { object-fit: fill !important; }
1181
+ .nxu-fit-cover video.nxu-cinema-video, video.nxu-cinema-root.nxu-fit-cover, video.nxu-cinema-video.nxu-fit-cover { object-fit: cover !important; }
1182
+ .nxu-fit-fill video.nxu-cinema-video, video.nxu-cinema-root.nxu-fit-fill, video.nxu-cinema-video.nxu-fit-fill { object-fit: fill !important; }
1177
1183
  .nxu-site-ui-off :is([class*="control" i], [class*="ctrl" i], [class*="toolbar" i], [class*="progress" i], [class*="seek" i], [class*="big-play" i], [class*="bigplay" i],
1178
1184
  [class*="play-button" i], [class*="playbutton" i], [class*="play-btn" i], [class*="spinner" i], [class*="loading" i], [class*="chrome" i], [class*="gradient" i], [class*="overlay" i],
1179
1185
  [class*="mask" i], [class*="volume" i], [class*="settings" i], [class*="menu" i], [class*="tooltip" i], [class*="watermark" i], .jw-display, .xgplayer-start, .fp-ui, .art-layers, .art-notice):not(video):not(.nxu-cinema-fill):not(.nxu-keep):not([class*="caption" i]):not([class*="subtitle" i]):not([class*="text-track" i]):not([class*="cue" i]):not([class*="sub-" i]):not([class*="danmaku" i]) {
@@ -1203,6 +1209,23 @@
1203
1209
  } catch (_) { }
1204
1210
  }
1205
1211
  function ensureCinemaStyles(doc = document) { ensurePageStyle(doc, 'nxu-cinema-style', CINEMA_CSS); }
1212
+ // Players built from web components keep the <video> inside a shadow root (famelack's
1213
+ // <hlsjs-video>, media-chrome, many live-TV sites): page styles never reach it, so the
1214
+ // cinema styles go into every shadow root on the way from the video to the page.
1215
+ function parentAcross(n) { return n.parentElement || (n.parentNode && n.parentNode.host) || null; }
1216
+ function ensureCinemaStylesIn(node) {
1217
+ const r = node?.getRootNode?.();
1218
+ if (!r || r.nodeType !== 11 || !r.host) return;
1219
+ try {
1220
+ const old = r.querySelector('style[data-nxu-cinema]');
1221
+ if (old && old.dataset.nxuCinema === NXU_RANK) return;
1222
+ old?.remove();
1223
+ const style = (node.ownerDocument || document).createElement('style');
1224
+ style.dataset.nxuCinema = NXU_RANK;
1225
+ style.textContent = CINEMA_CSS;
1226
+ r.appendChild(style);
1227
+ } catch (_) { }
1228
+ }
1206
1229
 
1207
1230
  const PLAYER_CLASS_HINTS = ['html5-video-player', 'video-js', 'jwplayer', 'plyr', 'artplayer', 'dplayer', 'xgplayer', 'shaka-video-container',
1208
1231
  'vjs-fluid', 'mejs__container', 'flowplayer', 'clappr', 'bitmovinplayer-container', 'video-player', 'player-container', 'video-container'];
@@ -1219,26 +1242,26 @@
1219
1242
  try { vr = video.getBoundingClientRect(); } catch (_) { return video; }
1220
1243
  let root = video;
1221
1244
  if (vr.width < 40 || vr.height < 30) {
1222
- let node = video.parentElement;
1245
+ let node = parentAcross(video);
1223
1246
  while (node && node !== doc.body) {
1224
1247
  if (PLAYER_CLASS_HINTS.some(c => node.classList?.contains(c))) root = node;
1225
- node = node.parentElement;
1248
+ node = parentAcross(node);
1226
1249
  }
1227
1250
  return root;
1228
1251
  }
1229
1252
  const maxW = vr.width * 1.12 + 24;
1230
1253
  const maxH = vr.height * 1.3 + 90;
1231
- let node = video.parentElement;
1254
+ let node = parentAcross(video);
1232
1255
  while (node && node !== doc.body && node !== doc.documentElement) {
1233
1256
  let r;
1234
1257
  try { r = node.getBoundingClientRect(); } catch (_) { break; }
1235
1258
  if (r.width > maxW || r.height > maxH) break;
1236
1259
  try {
1237
1260
  const cs = view.getComputedStyle(node);
1238
- if (cs.display === 'contents') { node = node.parentElement; continue; }
1261
+ if (cs.display === 'contents' || node.tagName === 'SLOT') { node = parentAcross(node); continue; }
1239
1262
  } catch (_) { }
1240
1263
  root = node;
1241
- node = node.parentElement;
1264
+ node = parentAcross(node);
1242
1265
  }
1243
1266
  return root;
1244
1267
  },
@@ -1246,8 +1269,10 @@
1246
1269
  _decorate(root, video) {
1247
1270
  const doc = root.ownerDocument;
1248
1271
  ensureCinemaStyles(doc);
1272
+ ensureCinemaStylesIn(root);
1249
1273
  const ancestors = [];
1250
- for (let n = root.parentElement; n; n = n.parentElement) {
1274
+ for (let n = parentAcross(root); n; n = parentAcross(n)) {
1275
+ ensureCinemaStylesIn(n);
1251
1276
  if (!n.classList.contains('nxu-cinema-ancestor')) {
1252
1277
  n.classList.add('nxu-cinema-ancestor');
1253
1278
  ancestors.push(n);
@@ -1255,7 +1280,10 @@
1255
1280
  }
1256
1281
  const fills = [];
1257
1282
  if (video && video !== root) {
1258
- for (let n = video.parentElement; n && n !== root; n = n.parentElement) {
1283
+ ensureCinemaStylesIn(video);
1284
+ for (let n = parentAcross(video); n && n !== root; n = parentAcross(n)) {
1285
+ ensureCinemaStylesIn(n);
1286
+ if (n.tagName === 'SLOT') continue;
1259
1287
  n.classList.add('nxu-cinema-fill');
1260
1288
  fills.push(n);
1261
1289
  }
@@ -1270,7 +1298,7 @@
1270
1298
  if (!link) return;
1271
1299
  try {
1272
1300
  link.root.classList.remove('nxu-cinema-root');
1273
- link.video?.classList.remove('nxu-cinema-video');
1301
+ link.video?.classList.remove('nxu-cinema-video', 'nxu-fit-cover', 'nxu-fit-fill');
1274
1302
  link.fills.forEach(n => n.classList.remove('nxu-cinema-fill'));
1275
1303
  link.ancestors.forEach(n => n.classList.remove('nxu-cinema-ancestor'));
1276
1304
  link.doc.documentElement.classList.remove('nxu-cinema-lock');
@@ -1426,6 +1454,9 @@
1426
1454
  const fit = this.fitMode();
1427
1455
  root.classList.toggle('nxu-fit-cover', fit === 'cover');
1428
1456
  root.classList.toggle('nxu-fit-fill', fit === 'fill');
1457
+ // A video in a shadow root is not a descendant the page's selector can see: mark it too.
1458
+ const v = this.applied?.video || STATE.video;
1459
+ if (v && v.getRootNode?.() !== root.getRootNode?.()) { v.classList.toggle('nxu-fit-cover', fit === 'cover'); v.classList.toggle('nxu-fit-fill', fit === 'fill'); }
1429
1460
  },
1430
1461
  // Cinema controls: hide the site's player UI (and native video controls); site
1431
1462
  // controls: show them again and wake them with a mouse move so they appear at once.
@@ -2387,10 +2418,23 @@
2387
2418
  return /iPad|iPhone|iPod/.test(ua) || (navigator.platform === 'MacIntel' && Number(navigator.maxTouchPoints) > 1);
2388
2419
  },
2389
2420
  _isAndroid() { return /Android/i.test(navigator.userAgent || ''); },
2421
+ // Can the speech engine listen to a given audio track (the video's sound)? Browsers
2422
+ // without it silently ignore the track and listen to the microphone instead — with
2423
+ // headphones that hears nothing at all. Asked once: an engine that knows the argument
2424
+ // refuses a non-track value with a TypeError; one that does not ignores it (and would
2425
+ // start listening, so it is stopped at once).
2390
2426
  _supportsTrackInput() {
2391
- const ua = navigator.userAgent || '';
2392
- const desktopSafari = /Safari\//.test(ua) && !/Chrome|Chromium|CriOS|Edg|OPR|FxiOS|Android/.test(ua);
2393
- return !(this._isAppleMobile() || desktopSafari);
2427
+ if (this._trackInputOk !== undefined) return this._trackInputOk;
2428
+ if (this._isAppleMobile()) return (this._trackInputOk = false);
2429
+ const SR = window.SpeechRecognition || window.webkitSpeechRecognition;
2430
+ if (!SR) return (this._trackInputOk = false);
2431
+ let ok = false;
2432
+ try {
2433
+ const probe = new SR();
2434
+ try { probe.start({}); try { probe.abort(); } catch (_) { } } catch (err) { ok = err?.name === 'TypeError' && /MediaStreamTrack/i.test(err.message || ''); }
2435
+ } catch (_) { }
2436
+ logDebug('AI Sub: speech engine ' + (ok ? 'can' : 'cannot') + ' listen to the video sound directly.', ok ? 'info' : 'warn');
2437
+ return (this._trackInputOk = ok);
2394
2438
  },
2395
2439
 
2396
2440
  // ── text helpers
@@ -2693,7 +2737,7 @@
2693
2737
  const media = this._readLevel(a.media);
2694
2738
  this._levels = { mic, media };
2695
2739
  this._mediaPeak = Math.max(this._mediaPeak, media);
2696
- if (Math.max(mic, media) > SPEECH_LEVEL) this._soundMs = (this._soundMs || 0) + 400;
2740
+ if (Math.max(mic, media) > SPEECH_LEVEL) { this._soundMs = (this._soundMs || 0) + 400; this._stageSoundMs = (this._stageSoundMs || 0) + 400; }
2697
2741
  const keys = [];
2698
2742
  if (mic > SPEECH_LEVEL) keys.push('mic');
2699
2743
  if (media > SPEECH_LEVEL) keys.push('media');
@@ -2808,7 +2852,7 @@
2808
2852
  // The recognizer listens to the captured source track itself (the video's own
2809
2853
  // audio track, or the echo-free microphone), as browsers document and test it; the
2810
2854
  // mixed stream is used only once the microphone was added to a silent video sound.
2811
- if (this._micMixed) return pick(this.recognitionAudioStream) || pick(this.mediaStream);
2855
+ if (this._micMixed || this._useMixTrack) return pick(this.recognitionAudioStream) || pick(this.webMediaStream) || pick(this.mediaStream);
2812
2856
  return pick(this.webMediaStream) || pick(this.mediaStream) || pick(this.recognitionAudioStream);
2813
2857
  },
2814
2858
  _startSession(reason) {
@@ -2820,6 +2864,10 @@
2820
2864
  this._sessionStartedAt = Date.now();
2821
2865
  this._setAppleSession('play-and-record');
2822
2866
  const track = !this._trackDisabled && this._supportsTrackInput() ? this._liveTrack() : null;
2867
+ if (!track && this.audioMode === 'media' && this.captureMode !== 'ios-mic' && !this._cloud && !this._toldNoTrack) {
2868
+ this._toldNoTrack = true;
2869
+ if (!this._supportsTrackInput()) { this._issue = this._issue || 'notrack'; showToast(t('subNoTrackInput')); }
2870
+ }
2823
2871
  try {
2824
2872
  if (track) this.recognizer.start(track);
2825
2873
  else this.recognizer.start();
@@ -2889,11 +2937,52 @@
2889
2937
  this._createRecognizer();
2890
2938
  this._scheduleRestart('track-fallback', 150, true);
2891
2939
  }
2892
- // Plenty of sound but not a single word back: say so, with a one-tap way out.
2893
- if (this._useWebSpeech && !this._issue && this._soundMs > 15000 && (this._lastResultAt || 0) < (this._startedAt || 0)) this._issue = 'noresult';
2940
+ // Plenty of sound but not a single word back: try the other ways of feeding the
2941
+ // engine on its own first, then say so, with a one-tap way out.
2942
+ if (this._useWebSpeech && !this._cloud && this._rescueNoWords()) { updateAIBtnUX(); return; }
2943
+ if (this._useWebSpeech && !this._issue && this._soundMs > 15000 && (this._lastResultAt || 0) < (this._startedAt || 0) && (this._cloud || this._rescueStage >= 3)) this._issue = 'noresult';
2894
2944
  this._updateListenChip();
2895
2945
  updateAIBtnUX();
2896
2946
  },
2947
+ // Sound keeps arriving but the speech engine returns no words (some Chrome builds take
2948
+ // a captured track and then never answer, or the on-device model hears nothing).
2949
+ // Each step is tried for about ten seconds of sound: online recognition instead of
2950
+ // the on-device model → the Web Audio copy of the sound → the engine's own microphone.
2951
+ _rescueNoWords() {
2952
+ if (this.captureMode === 'ios-mic' || (this._lastResultAt || 0) >= (this._stageAt || 0)) return false;
2953
+ if ((this._stageSoundMs || 0) < 10000 || Date.now() - (this._stageAt || 0) < 8000) return false;
2954
+ const next = () => { this._rescueStage++; this._stageAt = Date.now(); this._stageSoundMs = 0; };
2955
+ const rebuild = (why) => { this._commitInterim('rescue', 0); this._resetSegment(); this._destroyRecognizer(); this._createRecognizer(); this._scheduleRestart(why, 150, true); };
2956
+ if (this._rescueStage === 0) {
2957
+ next();
2958
+ if (this.recognizer?.processLocally) {
2959
+ this._localSpeechReady = false;
2960
+ logDebug('AI Sub: no words from the on-device model, using online recognition.', 'warn');
2961
+ rebuild('rescue-online');
2962
+ return true;
2963
+ }
2964
+ }
2965
+ if (this._rescueStage === 1) {
2966
+ next();
2967
+ if (this._recognitionInput === 'track' && !this._useMixTrack && !this._micMixed && this.recognitionAudioStream?.getAudioTracks?.()[0]?.readyState === 'live') {
2968
+ this._useMixTrack = true;
2969
+ logDebug('AI Sub: no words from the captured track, trying the Web Audio copy of the sound.', 'warn');
2970
+ rebuild('rescue-mix');
2971
+ return true;
2972
+ }
2973
+ }
2974
+ if (this._rescueStage === 2) {
2975
+ next();
2976
+ if (this._recognitionInput === 'track') {
2977
+ this._trackDisabled = true;
2978
+ logDebug('AI Sub: the speech engine returns no words from the captured sound, using its own microphone.', 'warn');
2979
+ if (this.audioMode === 'media') showToast(t('subUsingMicFallback'));
2980
+ rebuild('rescue-own-mic');
2981
+ return true;
2982
+ }
2983
+ }
2984
+ return false;
2985
+ },
2897
2986
  // The video is audibly playing but the captured sound has stayed digitally silent.
2898
2987
  _mediaSilent() {
2899
2988
  const v = STATE.video;
@@ -2975,22 +3064,22 @@
2975
3064
  chip.classList.toggle('warn', silent);
2976
3065
  chip.classList.toggle('warn', silent || !!this._issue);
2977
3066
  if (this._issue) chip.classList.remove('hide');
2978
- chip.querySelector('.sub-listen-text').textContent = this._issue === 'noresult' ? t('subIssueNoResult') : this._issue === 'net' ? t('subIssueNet') : silent ? t('subVideoSilent') : this.webMediaStream && !this._micMixed ? t('subHearVideo') : t('subHearMic');
3067
+ chip.querySelector('.sub-listen-text').textContent = this._issue === 'notrack' ? t('subIssueNoTrack') : this._issue === 'noresult' ? t('subIssueNoResult') : this._issue === 'net' ? t('subIssueNet') : silent ? t('subVideoSilent') : this.webMediaStream && !this._micMixed ? t('subHearVideo') : t('subHearMic');
2979
3068
  const level = Math.max(this._levels.media || 0, this._levels.mic || 0);
2980
3069
  chip.querySelector('.sub-listen-meter i').style.width = Math.min(100, Math.round(level * 400)) + '%';
2981
3070
  chip.querySelector('.sub-listen-btn').style.display = offer ? '' : 'none';
2982
3071
  let alt = chip.querySelector('.sub-listen-alt');
2983
- const wantAlt = this._issue === 'noresult';
3072
+ const wantAlt = this._issue === 'noresult' || this._issue === 'notrack';
2984
3073
  if (wantAlt && !alt) {
2985
3074
  alt = createEl('button', 'sub-listen-btn sub-listen-alt', '', { type: 'button' });
2986
3075
  alt.addEventListener('click', (e) => {
2987
3076
  e.stopPropagation();
2988
- if (this.audioMode === 'media') { STORE.set('nxu_audio_mode', 'mic'); this.restart('no words from the video sound'); }
3077
+ if (this.audioMode === 'media' && this._issue !== 'notrack') { STORE.set('nxu_audio_mode', 'mic'); this.restart('no words from the video sound'); }
2989
3078
  else { const m = shadow?.getElementById('trans-modal'); if (m) { openPanel(m); const d = m.querySelector('.ai-advanced'); if (d) d.open = true; } }
2990
3079
  });
2991
3080
  chip.appendChild(alt);
2992
3081
  }
2993
- if (alt) { alt.style.display = wantAlt ? '' : 'none'; alt.textContent = this.audioMode === 'media' ? t('subTryMic') : t('subTryKey'); }
3082
+ if (alt) { alt.style.display = wantAlt ? '' : 'none'; alt.textContent = this.audioMode === 'media' && this._issue !== 'notrack' ? t('subTryMic') : t('subTryKey'); }
2994
3083
  },
2995
3084
  _preparePlaybackMic() {
2996
3085
  const track = this.mediaStream?.getAudioTracks?.()[0];
@@ -3208,6 +3297,19 @@
3208
3297
  case 'network': {
3209
3298
  this._networkErrors++;
3210
3299
  this._issue = this._networkErrors >= 2 ? 'net' : '';
3300
+ // Not one word yet and the service keeps refusing: this browser has no
3301
+ // working speech service (some Chromium browsers and apps ship without
3302
+ // one). Say so plainly instead of retrying for minutes.
3303
+ if (this._networkErrors >= 4 && !this._diag.results && navigator.onLine !== false) {
3304
+ const cloudKey = AI.key('openai') || AI.key('groq');
3305
+ logDebug('AI Sub: the browser speech service is unreachable here.', 'error');
3306
+ this.stop(t(cloudKey ? 'subNoServiceKey' : 'subNoService'));
3307
+ if (cloudKey && STORE.get('nxu_asr_provider', 'browser') === 'browser') {
3308
+ STORE.set('nxu_asr_provider', AI.key('groq') ? 'groq' : 'openai');
3309
+ setTimeout(() => this.start().catch(() => { }), 400);
3310
+ }
3311
+ return;
3312
+ }
3211
3313
  if (this._networkErrors >= 12) { this.stop(t('subNetworkFailed')); return; }
3212
3314
  if (navigator.onLine === false) { this._waitOnline = true; return; }
3213
3315
  this._networkRetryMs = Math.min(15000, Math.max(800, (this._networkRetryMs || 600) * 1.7));
@@ -3736,6 +3838,10 @@
3736
3838
  this._issue = '';
3737
3839
  this._sessionFailures = 0;
3738
3840
  this._trackDisabled = false;
3841
+ this._useMixTrack = false;
3842
+ this._rescueStage = 0;
3843
+ this._stageAt = Date.now();
3844
+ this._stageSoundMs = 0;
3739
3845
  this._waitOnline = false;
3740
3846
  this._googleBackoffUntil = 0;
3741
3847
  this._providerStatus = '';
@@ -3797,8 +3903,11 @@
3797
3903
  if (token !== this._startToken) return;
3798
3904
  this.state = 'running';
3799
3905
  this._diag = { sound: 0, results: 0, err: '' };
3906
+ this._toldNoTrack = false;
3800
3907
  this._startedAt = Date.now();
3801
3908
  this._soundMs = 0;
3909
+ this._stageAt = Date.now();
3910
+ this._stageSoundMs = 0;
3802
3911
  this.active = true;
3803
3912
  if (this._useWebSpeech) {
3804
3913
  this._createRecognizer();
@@ -3814,6 +3923,27 @@
3814
3923
  logDebug(`AI Sub started (${this.captureMode}, ${this._recognitionLanguage()} → ${this.outLang}, recognition: ${this._cloud ? AI.asrModel() : this._sttProvider}${this._cloud && this._useWebSpeech ? ' + live preview' : ''}, translation: ${AI.translateProvider()}).`, 'success');
3815
3924
  },
3816
3925
  // Cloud recognition returned a finished utterance (already in speaking order).
3926
+ // Everything needed to tell why AI subtitles stay empty, as plain text the user can paste.
3927
+ async diagReport() {
3928
+ const SR = window.SpeechRecognition || window.webkitSpeechRecognition;
3929
+ const v = STATE.video;
3930
+ let local = '-';
3931
+ try { if (SR && typeof SR.available === 'function') local = await withTimeout(SR.available({ langs: [this._recognitionLanguage()], processLocally: true }), 1500); } catch (_) { local = '?'; }
3932
+ const lines = [
3933
+ 'NexusSync ' + NXU_VERSION + ' · AI subtitle report',
3934
+ 'browser: ' + navigator.userAgent,
3935
+ 'page: ' + location.hostname + (window.isSecureContext ? ' (https)' : ' (NOT secure)'),
3936
+ 'speech API: ' + (SR ? 'yes' : 'NO') + ' · hears video sound directly: ' + (SR ? (this._supportsTrackInput() ? 'yes' : 'NO') : '-') + ' · on-device (' + this._recognitionLanguage() + '): ' + local,
3937
+ 'microphone blocked by site: ' + (this._micBlockedByPolicy() ? 'YES' : 'no') + ' · permission: ' + (await this._micPermissionState()),
3938
+ 'recognition: ' + (this._cloud ? 'cloud ' + AI.asrModel() : (this._useWebSpeech ? this._sttProvider || 'web-speech' : '-')) + ' · state: ' + this.state,
3939
+ 'wanted sound: ' + (this.audioMode || this._audioMode()) + ' · capturing: ' + (this.captureMode || '-') + ' · engine input: ' + (this._recognitionInput || '-') + (this._trackDisabled ? ' (track refused)' : '') + (this._micMixed ? ' · mic mixed in' : '') + (this._useMixTrack ? ' · web-audio track' : '') + ' · rescue step ' + (this._rescueStage || 0),
3940
+ 'video: ' + (v ? (v.paused ? 'paused' : 'playing') + (v.muted ? ', muted' : '') + ', volume ' + Math.round((v.volume || 0) * 100) + '%' : 'none') + ' · video sound peak: ' + (this._mediaPeak || 0).toFixed(4),
3941
+ 'levels: video ' + Math.round((this._levels?.media || 0) * 400) + ' · mic ' + Math.round((this._levels?.mic || 0) * 400),
3942
+ 'engine events: sound ' + this._diag.sound + ' · results ' + this._diag.results + ' · last error ' + (this._diag.err || '-') + ' · network errors ' + (this._networkErrors || 0),
3943
+ 'issue: ' + (this._issue || '-')
3944
+ ];
3945
+ return lines.join('\n');
3946
+ },
3817
3947
  onCloudTranscript(text, reason, meta) {
3818
3948
  if (!this.active) return;
3819
3949
  const clean = this._normalize(text);
@@ -6631,7 +6761,7 @@
6631
6761
  viewer: self ? !!STATE.isViewer : !!p?.viewer,
6632
6762
  av: safeAvatar(self ? PROFILE.avatar() : p?.av),
6633
6763
  img: AVATAR_IMG.get(uid),
6634
- st: String((self ? PROFILE.status() : p?.st) || '').slice(0, 40),
6764
+ st: '',
6635
6765
  muted: !self && SAFETY.muted.has(uid),
6636
6766
  away: !self && (!!p?.hid || !!p?._sleep),
6637
6767
  sleeping: !self && !!p?._sleep,
@@ -7127,6 +7257,8 @@
7127
7257
  const margin = 12, w = getW(), h = getH();
7128
7258
  const rect = localBox(panel);
7129
7259
  const rw = Math.min(rect.width, w - margin * 2), rh = Math.min(rect.height, h - margin * 2);
7260
+ if (panel.style.width && rect.width > rw) panel.style.width = Math.max(260, rw) + 'px';
7261
+ if (panel.style.height && rect.height > rh) panel.style.height = Math.max(200, rh) + 'px';
7130
7262
  panel.style.transform = 'none';
7131
7263
  panel.style.left = Math.max(margin, Math.min(rect.left, w - rw - margin)) + 'px';
7132
7264
  panel.style.top = Math.max(margin, Math.min(rect.top, h - rh - margin)) + 'px';
@@ -7138,6 +7270,7 @@
7138
7270
  panel.style.display = 'flex';
7139
7271
  panel.style.opacity = '1';
7140
7272
  panel.style.pointerEvents = 'auto';
7273
+ try { AUTO_CINEMA._hideCard(); } catch (_) { } // the "which player" card would cover the window
7141
7274
  PANEL_SIZE.apply(panel);
7142
7275
  if (panel.dataset.userMoved === 'true') requestAnimationFrame(() => clampPanelToViewport(panel));
7143
7276
  else centerPanel(panel);
@@ -7346,7 +7479,19 @@
7346
7479
  return select;
7347
7480
  }
7348
7481
 
7349
- // ⚙️ Settings: profile, my reactions, playback, what reaches me from others, advanced.
7482
+ // ⚙️ Settings: profile, my reactions, playback, tools. Every list is a grid of the same
7483
+ // number of cells per row (8), and every on/off choice is the same switch.
7484
+ function switchRow(btn, label, get, set) {
7485
+ btn.className = 'btn nx-sw';
7486
+ btn.setAttribute('role', 'switch');
7487
+ const text = createEl('span', 'nx-sw-label', label);
7488
+ const knob = createEl('i', 'nx-sw-track');
7489
+ btn.replaceChildren(text, knob);
7490
+ btn.paint = () => { const on = !!get(); btn.classList.toggle('active', on); btn.setAttribute('aria-checked', String(on)); };
7491
+ btn.onclick = (ev) => { ev.stopPropagation(); triggerHaptic(); set(!get()); btn.paint(); };
7492
+ btn.paint();
7493
+ return btn;
7494
+ }
7350
7495
  function buildSettingsPanel(parts) {
7351
7496
  const body = createEl('div', 'manual-body settings-body nx-settings');
7352
7497
  const section = (icon, title) => {
@@ -7355,106 +7500,74 @@
7355
7500
  body.appendChild(sec);
7356
7501
  return sec;
7357
7502
  };
7358
- const toggle = (label, get, set) => {
7359
- const row = createEl('label', 'trans-row nx-set-row');
7360
- const box = createEl('input', 'trans-check', '', { type: 'checkbox' });
7361
- box.checked = !!get();
7362
- box.addEventListener('change', () => set(!!box.checked));
7363
- row.append(createEl('span', '', label), box);
7364
- return row;
7503
+ const emojiInput = (ph, onEmoji) => {
7504
+ const inp = createEl('input', 'nx-compose-input nx-emoji-input', '', { type: 'text', maxlength: '16', placeholder: ph, autocomplete: 'off', enterkeyhint: 'done' });
7505
+ inp.addEventListener('input', () => { const em = safeEmoji(inp.value); if (em && onEmoji(em)) inp.value = ''; });
7506
+ inp.addEventListener('keydown', (ev) => ev.stopPropagation());
7507
+ return inp;
7508
+ };
7509
+ const grid = (list, cls, onPick) => {
7510
+ const g = createEl('div', 'nx-grid8');
7511
+ list.forEach(em => {
7512
+ const b = createEl('button', 'nx-cell ' + cls, em, { type: 'button' });
7513
+ b.dataset.em = em;
7514
+ b.onclick = (ev) => { ev.stopPropagation(); onPick(em, b); };
7515
+ g.appendChild(b);
7516
+ });
7517
+ return g;
7365
7518
  };
7366
- // Profile
7519
+ // Profile: name, colour, device delay, avatar (pick one, or type any emoji)
7367
7520
  const prof = section('👤', t('setProfile'));
7368
7521
  prof.open = true;
7369
7522
  prof.appendChild(PROFILE.editor());
7370
- const avRow = createEl('div', 'nx-av-row');
7371
- const paintAv = () => avRow.querySelectorAll('.nx-av').forEach(b => b.classList.toggle('on', b.dataset.av === PROFILE.avatar()));
7372
- ['', ...PROFILE.AVATARS].forEach(a => {
7373
- const b = createEl('button', 'nx-av', a || '∅', { type: 'button', 'aria-label': a || 'none' });
7374
- b.dataset.av = a;
7375
- b.onclick = (ev) => { ev.stopPropagation(); PROFILE.setAvatar(a); paintAv(); };
7376
- avRow.appendChild(b);
7377
- });
7378
- paintAv();
7379
- const status = createEl('input', 'nx-compose-input nx-status-input', '', { type: 'text', maxlength: '40', placeholder: t('setStatusPh'), autocomplete: 'off' });
7380
- status.value = PROFILE.status();
7381
- status.addEventListener('input', () => PROFILE.setStatus(status.value));
7382
- const preview = createEl('div', 'nx-av-preview');
7383
- const paintPreview = () => {
7384
- const img = PROFILE.image();
7385
- preview.style.backgroundImage = img ? `url("${img}")` : '';
7386
- preview.textContent = img ? '' : (PROFILE.avatar() || (STATE.nickname || '?').slice(0, 1).toUpperCase());
7387
- paintAv();
7523
+ const avSlot = createEl('button', 'nx-cell nx-av-slot on', '', { type: 'button', 'aria-label': t('setAvatar') });
7524
+ const avGrid = grid(PROFILE.AVATARS, 'nx-av', (em) => { PROFILE.setAvatar(em); paintAv(); });
7525
+ const paintAv = () => {
7526
+ const a = PROFILE.avatar();
7527
+ avSlot.textContent = a || (STATE.nickname || '?').slice(0, 1).toUpperCase();
7528
+ avSlot.classList.toggle('empty', !a);
7529
+ avGrid.querySelectorAll('.nx-av').forEach(b => b.classList.toggle('on', b.dataset.em === a));
7388
7530
  };
7389
- const avCustom = createEl('input', 'nx-compose-input nx-av-input', '', { type: 'text', maxlength: '8', placeholder: t('setAvatarCustom'), autocomplete: 'off' });
7390
- avCustom.value = PROFILE.avatar() && !PROFILE.AVATARS.includes(PROFILE.avatar()) ? PROFILE.avatar() : '';
7391
- avCustom.addEventListener('input', () => { const a = safeAvatar(avCustom.value); if (a || !avCustom.value.trim()) { PROFILE.setImage(''); PROFILE.setAvatar(a); paintPreview(); } });
7392
- avCustom.addEventListener('keydown', (ev) => ev.stopPropagation());
7393
- const photoBtn = createEl('button', 'btn subtle', '🖼 ' + t('setAvatarPhoto'), { type: 'button' });
7394
- photoBtn.onclick = () => { PROFILE._onImage = paintPreview; PROFILE.pickImage(); };
7395
- const clearBtn = createEl('button', 'btn subtle', '✕', { type: 'button', title: t('setAvatarClear') });
7396
- clearBtn.onclick = () => { PROFILE.setImage(''); PROFILE.setAvatar(''); avCustom.value = ''; paintPreview(); };
7397
- const customRow = createEl('div', 'nx-av-custom');
7398
- customRow.append(preview, avCustom, photoBtn, clearBtn);
7399
- avRow.querySelectorAll('.nx-av').forEach(b => b.addEventListener('click', () => { PROFILE.setImage(''); avCustom.value = ''; paintPreview(); }));
7400
- paintPreview();
7401
- prof.append(createEl('div', 'field-label', t('setAvatar')), customRow, avRow, createEl('div', 'field-label', t('setStatus')), status);
7402
- // My reactions
7531
+ const avInput = emojiInput(t('setAvatarPh'), (em) => { PROFILE.setAvatar(em); paintAv(); return true; });
7532
+ const avReset = createEl('button', 'btn subtle', '↺ ' + t('setAvatarReset'), { type: 'button' });
7533
+ avReset.onclick = (ev) => { ev.stopPropagation(); PROFILE.setAvatar(''); paintAv(); };
7534
+ const avHead = createEl('div', 'nx-pick-head');
7535
+ avHead.append(avSlot, avInput);
7536
+ paintAv();
7537
+ prof.append(createEl('div', 'field-label', t('setAvatar')), avHead, avGrid, avReset);
7538
+ // My reactions: slots, then the palette or any emoji
7403
7539
  const reac = section('😀', t('setReactions'));
7404
- const slots = createEl('div', 'nx-react-slots');
7540
+ const slots = createEl('div', 'nx-grid8 nx-react-slots');
7405
7541
  let pick = 0;
7406
- const PALETTE = ['❤️', '🔥', '👏', '🤣', '😱', '😍', '🥺', '🤯', '👀', '💀', '🙏', '👍', '🎉', '💯', '😴', '🤔', '🍿', '😂', '😭', '😡', '💦', '🍪', '☕', '😘'];
7407
7542
  const paintSlots = () => {
7408
7543
  slots.replaceChildren(...REACTIONS.list().map((em, i) => {
7409
- const b = createEl('button', 'nx-react-slot' + (i === pick ? ' on' : ''), em, { type: 'button' });
7544
+ const b = createEl('button', 'nx-cell nx-react-slot' + (i === pick ? ' on' : ''), em, { type: 'button' });
7410
7545
  b.onclick = (ev) => { ev.stopPropagation(); pick = i; paintSlots(); };
7411
7546
  return b;
7412
7547
  }));
7413
7548
  };
7414
- const pal = createEl('div', 'nx-react-pal');
7415
- PALETTE.forEach(em => {
7416
- const b = createEl('button', 'nx-react-pick', em, { type: 'button' });
7417
- b.onclick = (ev) => { ev.stopPropagation(); if (REACTIONS.set(pick, em)) { pick = (pick + 1) % REACTIONS.list().length; paintSlots(); } };
7418
- pal.appendChild(b);
7419
- });
7420
- const custom = createEl('input', 'nx-compose-input nx-react-custom', '', { type: 'text', maxlength: '16', placeholder: t('setEmojiPh'), autocomplete: 'off' });
7421
- custom.addEventListener('input', () => { if (REACTIONS.set(pick, custom.value)) { custom.value = ''; pick = (pick + 1) % REACTIONS.list().length; paintSlots(); } });
7422
- custom.addEventListener('keydown', (ev) => ev.stopPropagation());
7423
- const resetBtn = createEl('button', 'btn subtle', '↺ ' + t('setReactionsReset'), { type: 'button' });
7424
- resetBtn.onclick = () => { REACTIONS.reset(); pick = 0; paintSlots(); };
7425
- const slotRow = createEl('div', 'nx-slot-row');
7549
+ const putEmoji = (em) => { if (!REACTIONS.set(pick, em)) return false; pick = (pick + 1) % REACTIONS.list().length; paintSlots(); return true; };
7550
+ const pal = grid(REACTIONS.PALETTE, 'nx-react-pick', (em) => putEmoji(em));
7551
+ const custom = emojiInput(t('setEmojiPh'), putEmoji);
7426
7552
  const addSlot = createEl('button', 'btn subtle', t('setSlotAdd'), { type: 'button' });
7427
- addSlot.onclick = () => { const i = REACTIONS.add(); if (i >= 0) pick = i; paintSlots(); };
7553
+ addSlot.onclick = (ev) => { ev.stopPropagation(); const i = REACTIONS.add(); if (i >= 0) pick = i; paintSlots(); };
7428
7554
  const delSlot = createEl('button', 'btn subtle', t('setSlotRemove'), { type: 'button' });
7429
- delSlot.onclick = () => { if (REACTIONS.remove(pick)) pick = Math.min(pick, REACTIONS.list().length - 1); paintSlots(); };
7430
- slotRow.append(addSlot, delSlot);
7555
+ delSlot.onclick = (ev) => { ev.stopPropagation(); if (REACTIONS.remove(pick)) pick = Math.min(pick, REACTIONS.list().length - 1); paintSlots(); };
7556
+ const resetBtn = createEl('button', 'btn subtle', '↺ ' + t('setReactionsReset'), { type: 'button' });
7557
+ resetBtn.onclick = (ev) => { ev.stopPropagation(); REACTIONS.reset(); pick = 0; paintSlots(); };
7558
+ const slotRow = createEl('div', 'nx-btn-row nx-slot-row');
7559
+ slotRow.append(addSlot, delSlot, resetBtn);
7431
7560
  paintSlots();
7432
- reac.append(slots, slotRow, createEl('div', 'trans-help', t('setReactionsHint')), pal, custom, resetBtn);
7433
- // Playback
7561
+ reac.append(slots, slotRow, createEl('div', 'trans-help', t('setReactionsHint')), pal, custom);
7562
+ // Playback: the same switch for every on/off choice
7434
7563
  const play = section('🎬', t('setPlayback'));
7435
- play.append(parts.autoCinema, parts.adGuard, toggle(t('setAutoNext'), () => NEXT_EP.enabled(), on => STORE.set('nxu_auto_next', on)));
7436
- // Watching together: what reaches me, and from whom
7437
- const tog = section('🛡️', t('setTogether'));
7438
- [['react', 'setRecvReact'], ['nudge', 'setRecvNudge'], ['ink', 'setRecvInk'], ['chat', 'setRecvChat'], ['ping', 'setRecvPing']].forEach(([k, label]) => tog.appendChild(toggle(t(label), () => SAFETY.receive(k), on => SAFETY.set(k, on))));
7439
- const people = createEl('div', 'nx-people');
7440
- const paintPeople = () => {
7441
- const others = roomRoster().filter(m => !m.self);
7442
- if (!others.length) { people.replaceChildren(createEl('div', 'trans-help', t('setNobody'))); return; }
7443
- people.replaceChildren(...others.map(m => {
7444
- const row = createEl('div', 'nx-person');
7445
- const dot = createEl('i', 'nx-who-dot'); dot.style.background = m.color;
7446
- const b = createEl('button', 'btn subtle', SAFETY.muted.has(m.uid) ? '👁 ' + t('setUnmute') : '🔇 ' + t('setMute'), { type: 'button' });
7447
- b.onclick = (ev) => { ev.stopPropagation(); SAFETY.toggleMute(m.uid); paintPeople(); updatePresenceUI(); };
7448
- row.append(dot, createEl('span', 'nx-person-name', (m.av ? m.av + ' ' : '') + m.name), b);
7449
- return row;
7450
- }));
7451
- };
7452
- tog.addEventListener('toggle', () => { if (tog.open) paintPeople(); });
7453
- tog.append(createEl('div', 'field-label', t('setPeople')), people, createEl('div', 'trans-help', t('setMutedHint')));
7454
- // Advanced
7564
+ const autoNext = switchRow(createEl('button', '', '', { type: 'button' }), '⏭ ' + t('setAutoNext'), () => NEXT_EP.enabled(), on => STORE.set('nxu_auto_next', on));
7565
+ play.append(parts.autoCinema, parts.adGuard, autoNext);
7566
+ // Tools and this site
7455
7567
  const adv = section('🔧', t('setAdvanced'));
7456
- adv.append(parts.chatLog, parts.subLog, parts.debug, parts.idleRow, parts.hideSite);
7457
- body.refreshPeople = paintPeople;
7568
+ const tools = createEl('div', 'nx-btn-row nx-tools');
7569
+ tools.append(parts.chatLog, parts.subLog, parts.debug);
7570
+ adv.append(tools, parts.idleRow, parts.hideSite, createEl('div', 'trans-help', t('setHideFabHelp')), createEl('div', 'nx-set-ver', 'NexusSync v' + NXU_VERSION));
7458
7571
  return body;
7459
7572
  }
7460
7573
 
@@ -7555,6 +7668,17 @@
7555
7668
  const opacityVal = createEl('span', 'range-val');
7556
7669
  opacityRow.append(createEl('span', '', t('subOpacity')), opacitySlider, opacityVal);
7557
7670
 
7671
+ const diagBtn = createEl('button', 'btn subtle', '🔬 ' + t('subDiagCopy'), { type: 'button', id: 'nxu-ai-diag' });
7672
+ diagBtn.onclick = async (ev) => {
7673
+ ev.stopPropagation();
7674
+ const text = await TRANSLATOR.diagReport();
7675
+ logDebug(text, 'info');
7676
+ let ok = false;
7677
+ try { await navigator.clipboard.writeText(text); ok = true; } catch (_) {
7678
+ try { if (typeof GM_setClipboard === 'function') { GM_setClipboard(text); ok = true; } } catch (_) { }
7679
+ }
7680
+ showToast(ok ? t('subDiagCopied') : t('subDiagInDebug'));
7681
+ };
7558
7682
  const details = createEl('details', 'ai-advanced');
7559
7683
  const advanced = createEl('div', 'ai-advanced-body');
7560
7684
  const offlineBtn = createEl('button', 'btn subtle', '⬇️ ' + t('offlineDownload'));
@@ -7574,6 +7698,7 @@
7574
7698
  details,
7575
7699
  createEl('div', 'ai-status', t('subStatusIdle'), { id: 'nxu-ai-status' }),
7576
7700
  createEl('button', 'btn primary', '🎙️ ' + t('subStart'), { id: 'stt-toggle' }),
7701
+ diagBtn,
7577
7702
  createEl('div', 'trans-help center', t('hotkeyHelp'))
7578
7703
  );
7579
7704
 
@@ -7701,14 +7826,10 @@
7701
7826
  .nx-who-tag { font-size:10px; }
7702
7827
  .nx-who-av { font-size:12px; line-height:1; }
7703
7828
  .nx-who-img { width:16px; height:16px; border-radius:50%; object-fit:cover; border:1.5px solid; flex:none; }
7704
- .nx-av-preview { width:44px; height:44px; border-radius:50%; background:rgba(255,255,255,0.1) center/cover; display:grid; place-items:center; font-size:22px; font-weight:800; border:2px solid var(--accent); flex:none; }
7705
- .nx-av-custom { display:flex; gap:6px; align-items:center; }
7706
- .nx-av-custom .nx-compose-input { flex:1; }
7707
- .nx-av-custom .btn { width:auto; }
7708
7829
  .nx-who-st { font-weight:500; opacity:0.7; margin-left:4px; overflow:hidden; text-overflow:ellipsis; }
7709
7830
  .nx-talk-avatar.emoji { background:rgba(255,255,255,0.12) !important; font-size:16px; }
7710
- .dock { position:absolute; background:var(--glass-strong); border-radius:16px; padding:10px; display:flex; flex-direction:column; gap:6px; pointer-events:none; opacity:0; border:1px solid rgba(255,255,255,0.1);
7711
- transition:opacity 0.25s ease, transform 0.25s ease; box-shadow:0 10px 30px rgba(0,0,0,0.35); backdrop-filter:blur(4px); -webkit-backdrop-filter:blur(4px); z-index:90; overflow-y:auto; text-shadow:0 1px 2px rgba(0,0,0,0.8); overflow-x:hidden; width:clamp(150px, 40vw, 190px); width:clamp(150px, 40cqw, 190px); }
7831
+ .dock { position:absolute; max-height:calc(100cqh - 24px); background:var(--glass-strong); border-radius:16px; padding:10px; display:flex; flex-direction:column; gap:6px; pointer-events:none; opacity:0; border:1px solid rgba(255,255,255,0.1);
7832
+ transition:opacity 0.25s ease, transform 0.25s ease; box-shadow:0 10px 30px rgba(0,0,0,0.35); backdrop-filter:blur(4px); -webkit-backdrop-filter:blur(4px); z-index:90; overflow-y:auto; text-shadow:0 1px 2px rgba(0,0,0,0.8); overflow-x:hidden; width:clamp(150px, 40vw, 190px); width:clamp(160px, 22cqw, 240px); }
7712
7833
  .dock.open { opacity:1; pointer-events:auto; border-color:rgba(0,230,118,0.3); }
7713
7834
  .btn { background:rgba(255,255,255,0.06); color:var(--txt); border:1px solid transparent; padding:9px 12px; border-radius:9px; cursor:pointer; display:flex; align-items:center; justify-content:center; gap:8px;
7714
7835
  font-weight:600; font-size:13px; transition:background-color 0.2s, border-color 0.2s; touch-action:manipulation; width:100%; text-align:center; }
@@ -7721,14 +7842,15 @@
7721
7842
  .btn:disabled { opacity:0.5; cursor:wait; }
7722
7843
  .window-frame { position:absolute; top:50%; left:50%; transform:translate(-50%,-50%); background:var(--glass-strong); backdrop-filter:blur(16px); -webkit-backdrop-filter:blur(16px); border-radius:16px; display:none; flex-direction:column;
7723
7844
  border:1px solid rgba(255,255,255,0.18); overflow:hidden; box-shadow:0 15px 40px rgba(0,0,0,0.6); z-index:105; transition:opacity 0.4s ease;
7724
- width:min(420px, calc(100vw - 24px)); width:min(420px, calc(100cqw - 24px)); max-height:calc(100vh - 24px); max-height:calc(100cqh - 24px); }
7725
- #chat-panel, #sub-log-panel, #debug-panel { height:min(520px, calc(100vh - 24px)); height:min(520px, calc(100cqh - 24px)); }
7845
+ width:min(420px, calc(100vw - 24px)); width:min(max(340px, 34cqw), 560px, calc(100cqw - 24px)); max-height:calc(100vh - 24px); max-height:calc(100cqh - 24px); }
7846
+ /* Windows follow the screen: wider on big screens, never past the edges on small ones. */
7847
+ #chat-panel, #sub-log-panel, #debug-panel { height:min(520px, calc(100vh - 24px)); height:min(max(360px, 66cqh), 760px, calc(100cqh - 24px)); }
7726
7848
  /* The window stays put and its body scrolls, so the resize grip stays in the corner
7727
7849
  (it used to scroll away with long content, e.g. every Settings section open). */
7728
7850
  #manual-modal, #trans-modal, #settings-modal, #tune-panel, #os-panel { overflow:hidden; }
7729
7851
  #manual-modal > .manual-body, #trans-modal > .manual-body, #settings-modal > .manual-body, #tune-panel > .manual-body, #os-panel > .manual-body { flex:1 1 auto; min-height:0; overflow-y:auto; overscroll-behavior:contain; }
7730
7852
  /* Windows you read and fill in stay legible over a busy picture. */
7731
- #manual-modal, #trans-modal, #settings-modal, #tune-panel, #os-panel, #debug-panel { background:rgba(16,20,26,0.9); }
7853
+ #manual-modal, #trans-modal, #settings-modal, #tune-panel, #os-panel, #debug-panel, #chat-panel, #sub-log-panel { background:rgba(16,20,26,0.96); }
7732
7854
  .drag-header { background:rgba(0,0,0,0.3); padding:10px 14px; font-size:13px; color:#eee; font-weight:700; cursor:grab; display:flex; justify-content:space-between; align-items:center; border-bottom:1px solid rgba(255,255,255,0.06); user-select:none; touch-action:none; flex:0 0 auto; }
7733
7855
  .header-controls { display:flex; gap:10px; align-items:center; }
7734
7856
  .pin-btn, .close-btn { background:transparent; border:none; cursor:pointer; color:#fff; font-size:15px; line-height:1; padding:0; opacity:0.6; }
@@ -7795,7 +7917,16 @@
7795
7917
  .cc-adj-val { min-width:46px; text-align:center; font-variant-numeric:tabular-nums; font-weight:700; }
7796
7918
  .cc-slider input { width:110px; accent-color:var(--cc-accent); }
7797
7919
  .cc-menu-note { font-size:11.5px; opacity:0.6; padding:4px 10px 6px; max-width:240px; }
7798
- .os-body { gap:8px; }
7920
+ .os-body { gap:8px; display:flex; flex-direction:column; }
7921
+ #os-panel .os-body > * { flex:none; }
7922
+ #os-panel .os-q { width:100%; box-sizing:border-box; }
7923
+ /* The results take whatever room the window has (they used to be squeezed into a
7924
+ small box of their own inside the window, e.g. 120px on a phone in landscape). */
7925
+ #os-panel.has-results { height:min(760px, calc(100vh - 24px)); height:min(max(420px, 80cqh), 760px, calc(100cqh - 24px)); }
7926
+ #os-panel.has-results .os-results { flex:1 1 auto; max-height:none; min-height:96px; }
7927
+ #os-panel.has-results .os-hint { display:none; }
7928
+ /* Short screens (a phone in landscape): one scroll for the whole window, not a small inner box. */
7929
+ @media (max-height:560px) { #os-panel.has-results .os-results { flex:none; overflow:visible; } }
7799
7930
  .os-row { display:grid; grid-template-columns:1fr 1fr 1.4fr; gap:6px; }
7800
7931
  .os-tmdb { display:flex; flex-wrap:wrap; gap:5px; align-items:center; }
7801
7932
  .os-tmdb:empty { display:none; }
@@ -7848,17 +7979,28 @@
7848
7979
  .nx-set-sec[open] > .nx-set-head::after { content:'▴'; }
7849
7980
  .nx-set-sec > :not(summary) { margin-top:6px; }
7850
7981
  .nx-set-row { display:flex; align-items:center; justify-content:space-between; gap:10px; font-size:12.5px; padding:4px 0; }
7851
- .nx-av-row, .nx-react-pal { display:flex; flex-wrap:wrap; gap:4px; }
7852
- .nx-av, .nx-react-pick { width:34px; height:34px; border-radius:9px; border:1px solid rgba(255,255,255,0.12); background:rgba(255,255,255,0.06); font-size:18px; cursor:pointer; padding:0; color:inherit; }
7853
- .nx-av.on { border-color:var(--accent); background:var(--glass-active); }
7854
- .nx-react-slots { display:grid; grid-template-columns:repeat(8, 1fr); gap:4px; }
7855
- .nx-slot-row { display:grid; grid-template-columns:1fr 1fr; gap:6px; }
7856
- .nx-react-slot { height:40px; border-radius:10px; border:1px solid rgba(255,255,255,0.14); background:rgba(255,255,255,0.08); font-size:20px; cursor:pointer; padding:0; }
7857
- .nx-react-slot.on { border-color:var(--accent); box-shadow:0 0 0 2px rgba(0,230,118,0.35); }
7858
- .nx-people { display:flex; flex-direction:column; gap:4px; }
7859
- .nx-person { display:flex; align-items:center; gap:8px; font-size:12.5px; }
7860
- .nx-person .btn { width:auto; margin-left:auto; }
7861
- .nx-person-name { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
7982
+ /* Every list in Settings: one grid, eight equal cells per row, nothing wraps oddly. */
7983
+ .nx-grid8 { display:grid; grid-template-columns:repeat(8, minmax(0, 1fr)); gap:5px; }
7984
+ .nx-cell { aspect-ratio:1; min-width:0; width:100%; border-radius:10px; border:1px solid rgba(255,255,255,0.12); background:rgba(255,255,255,0.06); font-size:clamp(15px, 4.6cqw, 22px); line-height:1; cursor:pointer; padding:0; color:inherit; display:grid; place-items:center; }
7985
+ .nx-cell:hover { background:rgba(255,255,255,0.14); }
7986
+ .nx-cell.on { border-color:var(--accent); background:var(--glass-active); box-shadow:0 0 0 2px rgba(0,230,118,0.3); }
7987
+ .nx-pick-head { display:grid; grid-template-columns:calc((100% - 35px) / 8) 1fr; gap:5px; align-items:center; }
7988
+ .nx-av-slot { cursor:default; }
7989
+ .nx-av-slot.empty { font-weight:800; font-size:clamp(13px, 3.8cqw, 18px); opacity:0.8; }
7990
+ .nx-emoji-input { display:block; width:100%; box-sizing:border-box; padding:8px 14px; }
7991
+ .nx-btn-row { display:flex; gap:6px; }
7992
+ .nx-btn-row > .btn { flex:1 1 0; width:auto; min-width:0; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; padding-left:6px; padding-right:6px; }
7993
+ /* One switch for every on/off choice. */
7994
+ .btn.nx-sw { width:100%; justify-content:space-between; text-align:left; font-size:12.5px; font-weight:600; opacity:1; padding:9px 10px; background:rgba(255,255,255,0.04); }
7995
+ .btn.nx-sw.active { background:rgba(255,255,255,0.04) !important; border-color:transparent !important; }
7996
+ .nx-sw-label { flex:1; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
7997
+ .nx-sw-track { flex:none; position:relative; width:38px; height:22px; border-radius:11px; background:rgba(255,255,255,0.22); transition:background .18s; }
7998
+ .nx-sw-track::after { content:''; position:absolute; top:3px; left:3px; width:16px; height:16px; border-radius:50%; background:#fff; transition:transform .18s; box-shadow:0 1px 3px rgba(0,0,0,0.4); }
7999
+ .nx-sw.active .nx-sw-track { background:var(--accent); }
8000
+ .nx-sw.active .nx-sw-track::after { transform:translateX(16px); }
8001
+ .nx-set-sec > .nx-sw + .nx-sw { margin-top:4px; }
8002
+ .nx-set-ver { font-size:10.5px; opacity:0.45; text-align:right; }
8003
+ .nx-settings { container-type:inline-size; }
7862
8004
  .seg { display:flex; gap:6px; }
7863
8005
  .seg-btn { flex:1; min-height:38px; padding:8px 6px; border-radius:10px; border:1px solid rgba(255,255,255,0.16); background:rgba(255,255,255,0.06); color:inherit; font:inherit; font-size:13px; font-weight:700; cursor:pointer; }
7864
8006
  .seg-btn.on { background:rgba(124,77,255,0.38); border-color:rgba(160,130,255,0.95); }
@@ -7998,8 +8140,8 @@
7998
8140
  .nx-me-dot { background:var(--c, #69f0ae) !important; box-shadow:0 0 0 2px rgba(255,255,255,0.25), 0 0 10px var(--c, #69f0ae); }
7999
8141
  .nx-profile { display:flex; flex-direction:column; gap:7px; padding:6px 4px 2px; }
8000
8142
  .nx-profile-title { font-size:11.5px; font-weight:800; color:rgba(255,255,255,0.7); padding-left:4px; }
8001
- .nx-swatches { display:flex; flex-wrap:wrap; gap:7px; padding:0 2px; }
8002
- .nx-swatch { width:26px; height:26px; border-radius:50%; border:2px solid rgba(255,255,255,0.2); background:var(--c); cursor:pointer; padding:0; }
8143
+ .nx-swatches { display:grid; grid-template-columns:repeat(8, minmax(0, 1fr)); gap:5px; padding:0 2px; justify-items:center; }
8144
+ .nx-swatch { width:min(100%, 30px); aspect-ratio:1; height:auto; border-radius:50%; border:2px solid rgba(255,255,255,0.2); background:var(--c); cursor:pointer; padding:0; }
8003
8145
  .nx-swatch.on { border-color:#fff; box-shadow:0 0 0 2px var(--c), 0 0 12px var(--c); transform:scale(1.08); }
8004
8146
  .nx-swatch-custom { -webkit-appearance:none; appearance:none; background:conic-gradient(#ff5252, #ffd740, #69f0ae, #40c4ff, #7c4dff, #ff4fa3, #ff5252); overflow:hidden; }
8005
8147
  .nx-swatch-custom::-webkit-color-swatch-wrapper { padding:0; } .nx-swatch-custom::-webkit-color-swatch { border:none; opacity:0; }
@@ -8181,7 +8323,7 @@
8181
8323
  .cc-hover { position:absolute; bottom:26px; transform:translateX(-50%); background:rgba(12,14,18,0.9); color:#fff; font-size:12px; font-weight:700; font-variant-numeric:tabular-nums; padding:4px 8px; border-radius:6px; opacity:0; pointer-events:none; transition:opacity 0.15s; white-space:nowrap; box-shadow:0 2px 8px rgba(0,0,0,0.4); }
8182
8324
  .cc-hover.show { opacity:1; }
8183
8325
  .cc-hover small { display:block; font-weight:600; opacity:0.75; font-size:11px; max-width:180px; overflow:hidden; text-overflow:ellipsis; }
8184
- .cc-menu { position:absolute; bottom:calc(58px + env(safe-area-inset-bottom, 0px)); right:calc(14px + env(safe-area-inset-right, 0px)); z-index:80; min-width:150px; padding:6px; border-radius:12px; background:rgba(20,22,28,0.94); -webkit-backdrop-filter:blur(14px); backdrop-filter:blur(14px); box-shadow:0 10px 30px rgba(0,0,0,0.5); display:none; pointer-events:auto; }
8326
+ .cc-menu { position:absolute; bottom:calc(58px + env(safe-area-inset-bottom, 0px)); right:calc(14px + env(safe-area-inset-right, 0px)); z-index:80; min-width:150px; max-width:calc(100% - 28px); max-height:calc(100% - 140px - env(safe-area-inset-bottom, 0px)); overflow-y:auto; overscroll-behavior:contain; padding:6px; border-radius:12px; background:rgba(20,22,28,0.94); -webkit-backdrop-filter:blur(14px); backdrop-filter:blur(14px); box-shadow:0 10px 30px rgba(0,0,0,0.5); display:none; pointer-events:auto; }
8185
8327
  .cc-menu.open { display:block; animation:ccMenu 0.14s ease-out; }
8186
8328
  @keyframes ccMenu { from { opacity:0; transform:translateY(6px); } to { opacity:1; transform:none; } }
8187
8329
  .cc-menu-title { font-size:11px; font-weight:700; opacity:0.6; padding:4px 10px 6px; text-transform:uppercase; letter-spacing:0.5px; }
@@ -8308,13 +8450,8 @@
8308
8450
  const btnSyncStatus = mk('nxu-sync-status', '📡 ' + t('sync'));
8309
8451
  const btnInvite = mk('nxu-invite', '👥 ' + t('invite'), t('inviteTitle'));
8310
8452
  const btnCinema = mk('nxu-cinema', '🍿 ' + t('cinema'), t('cinemaTitle'));
8311
- const btnAutoCinema = mk('nxu-auto-cinema', '');
8312
- btnAutoCinema.classList.add('subtle');
8313
- const btnAdGuard = mk('nxu-ad-guard', '');
8314
- btnAdGuard.classList.add('subtle');
8315
- const paintAdGuard = () => { const on = AD_GUARD.enabled(); btnAdGuard.textContent = '🛡️ ' + t(on ? 'adGuardOn' : 'adGuardOff'); btnAdGuard.classList.toggle('active', on); };
8316
- paintAdGuard();
8317
- btnAdGuard.onclick = () => { STORE.set('nxu_ad_guard', !AD_GUARD.enabled()); paintAdGuard(); showToast('🛡️ ' + t(AD_GUARD.enabled() ? 'adGuardOn' : 'adGuardOff')); };
8453
+ const btnAutoCinema = switchRow(mk('nxu-auto-cinema', ''), '✨ ' + t('setAutoCinemaSw'), () => AUTO_CINEMA.enabled(), on => AUTO_CINEMA.setSite(on));
8454
+ const btnAdGuard = switchRow(mk('nxu-ad-guard', ''), '🛡️ ' + t('setAdGuardSw'), () => AD_GUARD.enabled(), on => { STORE.set('nxu_ad_guard', !!on); showToast('🛡️ ' + t(on ? 'adGuardOn' : 'adGuardOff')); });
8318
8455
  const btnPiP = mk('nxu-pip', '📺 PiP');
8319
8456
  const btnRate = mk('nxu-rate', '⏩ 1x', t('rateTitle'));
8320
8457
  // Talking happens in speech bubbles and quick ink now: the menu opens those directly
@@ -8326,10 +8463,11 @@
8326
8463
  const btnSubLog = mk('', '📝 ' + t('subLog'));
8327
8464
  const btnChatLog = mk('nxu-chat-log', '💬 ' + t('chatLog'));
8328
8465
  const btnDebug = mk('', '🐛 ' + t('debug'));
8329
- const btnHideSite = createEl('button', 'btn subtle', '🙈 ' + t('hideOnSite'), { title: t('hideOnSiteTitle') });
8466
+ const btnHideSite = switchRow(createEl('button', '', '', { type: 'button', id: 'nxu-hide-site' }), '🙈 ' + t('setHideFab'), () => !!STORE.get('nxu_hide_fab_' + HOST, false), on => setFabHiddenOnSite(on));
8330
8467
  const btnSettings = mk('nxu-settings', '⚙️ ' + t('settings'));
8331
8468
  [btnLink, btnSyncStatus, btnInvite, btnCinema, btnPiP, btnRate, btnDraw, btnBookmark, btnChat].forEach(b => { b.style.display = 'none'; });
8332
8469
  btnSubLog.style.display = 'none';
8470
+ btnChatLog.style.display = 'none';
8333
8471
 
8334
8472
  // Chat panel
8335
8473
  const chatPanel = createEl('div', 'window-frame');
@@ -8416,13 +8554,13 @@
8416
8554
  const debugContent = createEl('div', 'debug-content');
8417
8555
  const debugJumpBtn = createEl('button', 'jump-btn', '↓ ' + t('latest'));
8418
8556
  debugJumpBtn.id = 'debug-jump-btn';
8419
- const idleRow = createEl('div', 'idle-row');
8420
- const idleSlider = createEl('input', '', '', { type: 'range', min: '3', max: '30', step: '1', style: 'flex:1;' });
8557
+ const idleRow = createEl('div', 'nx-latency nx-idle-row');
8558
+ const idleSlider = createEl('input', 'nx-latency-range', '', { type: 'range', min: '3', max: '30', step: '1' });
8421
8559
  const idleVal = createEl('span', '', '');
8422
8560
  idleSlider.value = CONFIG.idleTimeoutMs / 1000;
8423
8561
  idleVal.textContent = idleSlider.value + 's';
8424
8562
  idleSlider.addEventListener('input', () => { idleVal.textContent = idleSlider.value + 's'; STORE.set('nxu_idle_timeout', +idleSlider.value); });
8425
- idleRow.append(createEl('span', '', '⏱️ ' + t('uiHide')), idleSlider, idleVal, createEl('span', '', 'v' + NXU_VERSION, { style: 'margin-left:6px;opacity:0.6;' }));
8563
+ idleRow.append(createEl('span', 'nx-latency-label', '⏱️ ' + t('uiHide')), idleSlider, idleVal);
8426
8564
  debugPanel.append(debugHeader, debugContent, debugJumpBtn);
8427
8565
 
8428
8566
  // Sync timing (offset between different versions of a movie)
@@ -8468,7 +8606,7 @@
8468
8606
 
8469
8607
  uiElements = {
8470
8608
  uiWrapper, fab, reactPill, dock, btnFindMedia, btnLink, btnSyncStatus, btnTranslate, btnCinema, btnAutoCinema, btnPiP, btnRate, btnDraw, btnBookmark, btnChat, btnSubLog,
8471
- btnDebug, btnHideSite, btnSettings, settingsModal, btnTune, tunePanel, chatPanel, chatMessages, chatInput, chatJumpBtn, subLogPanel, subLogMessages,
8609
+ btnDebug, btnHideSite, btnChatLog, btnSettings, settingsModal, btnTune, tunePanel, chatPanel, chatMessages, chatInput, chatJumpBtn, subLogPanel, subLogMessages,
8472
8610
  subLogJumpBtn, drawCanvas, manualModal, transModal, toast, debugJumpBtn, syncBubble: null,
8473
8611
  pinError, guestInput, pinHint, pinDisplay, pinCopyBtn, hostBtn, connectBtn, btnInvite, typingRow, nickInput
8474
8612
  };
@@ -8724,7 +8862,6 @@
8724
8862
  };
8725
8863
 
8726
8864
  btnCinema.onclick = () => { triggerHaptic(); CINEMA.toggle(); };
8727
- btnAutoCinema.onclick = () => { triggerHaptic(); AUTO_CINEMA.setSite(!AUTO_CINEMA.enabled()); };
8728
8865
  btnPiP.onclick = async () => {
8729
8866
  let video = STATE.video;
8730
8867
  if (!video || video.readyState === 0) {
@@ -8747,7 +8884,6 @@
8747
8884
  INK.start();
8748
8885
  };
8749
8886
  btnBookmark.onclick = () => addBookmark();
8750
- btnHideSite.onclick = () => setFabHiddenOnSite(true);
8751
8887
 
8752
8888
  setupCanvasLogic();
8753
8889
  resetIdleTimer(true);
@@ -8773,6 +8909,7 @@
8773
8909
  if (hidden) UI_GATE.forced = false;
8774
8910
  STORE.set('nxu_hide_fab_' + HOST, !!hidden);
8775
8911
  uiElements.uiWrapper?.classList.toggle('site-hidden', !!hidden);
8912
+ uiElements.btnHideSite?.paint?.();
8776
8913
  try { ROTATE._tick(); } catch (_) { }
8777
8914
  if (hidden) {
8778
8915
  toggleDock(false);
@@ -8940,50 +9077,19 @@
8940
9077
  return first.length <= 16 && /\p{Extended_Pictographic}|\p{Regional_Indicator}/u.test(first) ? first : '';
8941
9078
  }
8942
9079
 
8943
- // An avatar: one emoji, or one or two letters/digits (initials).
8944
- function safeAvatar(s) {
8945
- const e = safeEmoji(s);
8946
- if (e) return e;
8947
- const str = String(s || '').trim();
8948
- return /^[\p{L}\p{N}]{1,2}$/u.test(str) ? str.toUpperCase() : '';
8949
- }
8950
-
8951
- // Photo avatars of the others: announced by a short fingerprint in presence, fetched
8952
- // once by message, kept for the session.
8953
- const AVATAR_IMG = {
8954
- cache: new Map(), // uid → { h, img }
8955
- _asked: new Map(),
8956
- get(uid) {
8957
- if (uid === STATE.userId) return PROFILE.image();
8958
- const want = STATE.presenceMap?.[uid]?.avh || STATE.sleepingMap?.[uid]?.avh || '';
8959
- const c = this.cache.get(uid);
8960
- if (!want) return '';
8961
- if (c && c.h === want) return c.img;
8962
- if (Date.now() - (this._asked.get(uid + want) || 0) > 20000) { this._asked.set(uid + want, Date.now()); SOCIAL.send('avatar', { op: 'req', who: uid }); }
8963
- return '';
8964
- },
8965
- mine() { const img = PROFILE.image(); if (img && SOCIAL.live()) SOCIAL.send('avatar', { op: 'img', h: PROFILE.imageHash(), img }); },
8966
- onRemote(d) {
8967
- if (d.op === 'req' && d.who === STATE.userId) { if (Date.now() - (this._sentAt || 0) > 5000) { this._sentAt = Date.now(); this.mine(); } return; }
8968
- if (d.op === 'img' && typeof d.img === 'string' && /^data:image\/jpeg;base64,[A-Za-z0-9+/=]+$/.test(d.img) && d.img.length < 40000 && typeof d.h === 'string') {
8969
- this.cache.set(d.uid, { h: d.h, img: d.img });
8970
- updatePresenceUI();
8971
- }
8972
- }
8973
- };
9080
+ // An avatar: one emoji.
9081
+ function safeAvatar(s) { return safeEmoji(s); }
9082
+
9083
+ // Photo avatars were removed (1.6.0): older devices may still announce or send one; it is ignored.
9084
+ const AVATAR_IMG = { get() { return ''; }, mine() { }, onRemote() { } };
8974
9085
 
8975
- // What reaches this device from the others, and from whom: kinds of events can be turned
8976
- // off, a person can be muted for this room, and floods of reactions are thinned out.
9086
+ // Everything the others send (reactions, nudges, sketches, bubbles, pointers) always
9087
+ // reaches a connected device — those are the point of watching together. Only floods of
9088
+ // reactions are thinned out.
8977
9089
  const SAFETY = {
8978
- KINDS: ['react', 'nudge', 'ink', 'chat', 'ping'],
8979
9090
  muted: new Set(),
8980
- receive(kind) { return STORE.get('nxu_recv_' + kind, true) !== false; },
8981
- set(kind, on) { STORE.set('nxu_recv_' + kind, !!on); },
8982
- allows(uid, kind) {
8983
- if (uid && this.muted.has(uid)) return false;
8984
- return !kind || this.receive(kind);
8985
- },
8986
- toggleMute(uid) { if (this.muted.has(uid)) this.muted.delete(uid); else this.muted.add(uid); },
9091
+ receive() { return true; },
9092
+ allows() { return true; },
8987
9093
  _rate: new Map(),
8988
9094
  // More than 6 reactions a second from one person: the rest are not shown.
8989
9095
  flood(uid, max = 6) {
@@ -8999,6 +9105,7 @@
8999
9105
  // The eight reaction buttons: the user's own choice (any emoji), or the defaults.
9000
9106
  const REACTIONS = {
9001
9107
  DEFAULT: ['😂', '😭', '😡', '💦', '🍪', '☕', '😘', '🖕'],
9108
+ PALETTE: ['❤️', '🔥', '👏', '🤣', '😱', '😍', '🥺', '🤯', '👀', '💀', '🙏', '👍', '🎉', '💯', '😴', '🤔', '🍿', '😂', '😭', '😡', '💦', '🍪', '☕', '😘'],
9002
9109
  MAX: 16,
9003
9110
  list() {
9004
9111
  const saved = STORE.get('nxu_reactions', null);
@@ -9048,7 +9155,7 @@
9048
9155
  };
9049
9156
 
9050
9157
  const PROFILE = {
9051
- SWATCHES: ['#69f0ae', '#40c4ff', '#7c4dff', '#ff4fa3', '#ff6e40', '#ffd740', '#b2ff59', '#18ffff', '#ea80fc', '#ff8a80'],
9158
+ SWATCHES: ['#69f0ae', '#40c4ff', '#7c4dff', '#ff4fa3', '#ff6e40', '#ffd740', '#ea80fc'],
9052
9159
  color() {
9053
9160
  const c = String(STORE.get('nxu_color', '') || '');
9054
9161
  return /^#[0-9a-f]{6}$/i.test(c) ? c : generateUserColor(STATE.userId);
@@ -9062,41 +9169,14 @@
9062
9169
  },
9063
9170
  // What this device announces in the room (presence): name, colour, avatar, status.
9064
9171
  value() {
9065
- return { ts: Date.now(), color: STATE.color, viewer: !!STATE.isViewer, nick: STATE.nickname || '', av: this.avatar(), avh: this.imageHash(), st: this.status(), md: TUNE.mediaSig(), v: NXU_VERSION, r: NXU_RANK, sess: NXU_SESSION, hid: !!document.hidden };
9172
+ return { ts: Date.now(), color: STATE.color, viewer: !!STATE.isViewer, nick: STATE.nickname || '', av: this.avatar(), md: TUNE.mediaSig(), v: NXU_VERSION, r: NXU_RANK, sess: NXU_SESSION, hid: !!document.hidden };
9066
9173
  },
9067
- AVATARS: ['🙂', '😎', '🦊', '🐱', '🐶', '🐯', '🐵', '🐼', '🐸', '🦄', '🐧', '🍿', '🎧', '🌙', '🔥', '🌸', '👾', '🤖'],
9174
+ AVATARS: ['🙂', '😎', '🥳', '🤠', '👻', '👾', '🤖', '🎃', '🦊', '🐱', '🐶', '🐯', '🐵', '🐼', '🐸', '🐰', '🐻', '🐨', '🦁', '🐧', '🦄', '🐙', '🍿', '🎧'],
9068
9175
  avatar() { return safeAvatar(STORE.get('nxu_avatar', '')); },
9069
- // A photo avatar travels once (and on request), not in every presence note.
9070
- image() { const v = String(STORE.get('nxu_avatar_img', '') || ''); return /^data:image\/jpeg;base64,[A-Za-z0-9+/=]+$/.test(v) && v.length < 40000 ? v : ''; },
9071
- imageHash() { const v = this.image(); if (!v) return ''; let h = 0; for (let i = 0; i < v.length; i += 7) h = (h * 31 + v.charCodeAt(i)) | 0; return (h >>> 0).toString(36) + v.length.toString(36); },
9072
- setImage(dataUrl) { STORE.set('nxu_avatar_img', dataUrl || ''); AVATAR_IMG.mine(); this.publish(); updatePresenceUI(); },
9073
- async pickImage() {
9074
- const input = document.createElement('input');
9075
- input.type = 'file'; input.accept = 'image/*';
9076
- input.onchange = async () => {
9077
- const f = input.files?.[0];
9078
- if (!f) return;
9079
- try {
9080
- const url = URL.createObjectURL(f);
9081
- const img = await new Promise((res, rej) => { const i = new Image(); i.onload = () => res(i); i.onerror = rej; i.src = url; });
9082
- const c = document.createElement('canvas'); c.width = c.height = 96;
9083
- const s = Math.min(img.naturalWidth, img.naturalHeight);
9084
- c.getContext('2d').drawImage(img, (img.naturalWidth - s) / 2, (img.naturalHeight - s) / 2, s, s, 0, 0, 96, 96);
9085
- URL.revokeObjectURL(url);
9086
- let q = 0.82, out = c.toDataURL('image/jpeg', q);
9087
- while (out.length > 30000 && q > 0.4) { q -= 0.12; out = c.toDataURL('image/jpeg', q); }
9088
- this.setImage(out);
9089
- this._onImage?.();
9090
- } catch (_) { showToast(t('setAvatarFail')); }
9091
- };
9092
- input.click();
9093
- },
9094
- status() { return String(STORE.get('nxu_status', '') || '').replace(/\s+/g, ' ').trim().slice(0, 40); },
9176
+ image() { return ''; },
9177
+ imageHash() { return ''; },
9178
+ status() { return ''; },
9095
9179
  setAvatar(a) { STORE.set('nxu_avatar', safeAvatar(a)); this.publish(); updatePresenceUI(); },
9096
- setStatus(s) {
9097
- STORE.set('nxu_status', String(s || '').replace(/\s+/g, ' ').slice(0, 40));
9098
- clearTimeout(this._st); this._st = setTimeout(() => { this.publish(); updatePresenceUI(); }, 600);
9099
- },
9100
9180
  setName(name) {
9101
9181
  STATE.nickname = String(name || '').trim().slice(0, 16);
9102
9182
  STORE.set('nxu_nickname', STATE.nickname);
@@ -10060,7 +10140,7 @@
10060
10140
  // Opened again after picking one: start at the top (it used to keep the old scroll
10061
10141
  // position past the end of a shorter list, which looked like an empty window).
10062
10142
  panel.scrollTop = 0;
10063
- const body = panel.querySelector('.os-body'); if (body) body.scrollTop = 0;
10143
+ const body = panel.querySelector('.os-body'); if (body) { body.style.display = ''; body.scrollTop = 0; }
10064
10144
  panel.querySelectorAll('.os-item.busy').forEach(b => b.classList.remove('busy'));
10065
10145
  openPanel(panel);
10066
10146
  if (q.value && !panel.querySelector('.os-item')) this.prepare(panel, g);
@@ -10097,9 +10177,13 @@
10097
10177
  const lang = panel.querySelector('.os-lang').value;
10098
10178
  STORE.set('nxu_os_lang', lang);
10099
10179
  out.replaceChildren(createEl('div', 'trans-help', t('osSearching')));
10180
+ const win = panel.closest('#os-panel') || panel;
10100
10181
  try {
10101
10182
  const list = await this.search({ query: q, season: +panel.querySelector('.os-season').value || 0, episode: +panel.querySelector('.os-episode').value || 0, lang });
10102
- if (!list.length) { out.replaceChildren(createEl('div', 'trans-help', t('osNone'))); return; }
10183
+ if (!list.length) { win.classList.remove('has-results'); out.replaceChildren(createEl('div', 'trans-help', t('osNone'))); return; }
10184
+ win.classList.add('has-results');
10185
+ requestAnimationFrame(() => clampPanelToViewport(win));
10186
+ out.scrollTop = 0;
10103
10187
  out.replaceChildren(...list.map(item => {
10104
10188
  const b = createEl('button', 'os-item', '', { type: 'button' });
10105
10189
  b.append(createEl('span', 'os-name', String(item.MovieReleaseName || item.SubFileName || item.MovieName || '').slice(0, 140)),
@@ -10110,7 +10194,8 @@
10110
10194
  const cues = await this.download(item);
10111
10195
  if (!cues.length) throw new Error('empty');
10112
10196
  SUBS.useCues(cues, String(item.MovieName || q).slice(0, 60) + ' · ' + (item.LanguageName || lang));
10113
- closePanel(panel);
10197
+ b.classList.remove('busy');
10198
+ closePanel(win);
10114
10199
  } catch (err) { logDebug('Subtitles download failed: ' + (err.message || err), 'warn'); showToast(t('subLoadFail')); b.classList.remove('busy'); }
10115
10200
  };
10116
10201
  return b;
@@ -10134,7 +10219,7 @@
10134
10219
  go.onclick = () => this.run(body);
10135
10220
  [q, se, ep].forEach(i => i.addEventListener('keydown', (ev) => { ev.stopPropagation(); if (ev.key === 'Enter') this.run(body); }));
10136
10221
  const tm = createEl('div', 'os-tmdb');
10137
- body.append(q, tm, row, go, out, createEl('div', 'trans-help', t('osHint')));
10222
+ body.append(q, tm, row, go, out, createEl('div', 'trans-help os-hint', t('osHint')));
10138
10223
  return body;
10139
10224
  }
10140
10225
  };
@@ -10265,9 +10350,7 @@
10265
10350
  paintButton() {
10266
10351
  const b = uiElements.btnAutoCinema;
10267
10352
  if (!b) return;
10268
- const on = this.enabled();
10269
- b.textContent = '✨ ' + t(on ? 'autoCinemaBtnOn' : 'autoCinemaBtnOff');
10270
- b.classList.toggle('active', on);
10353
+ b.paint?.();
10271
10354
  },
10272
10355
  // One real video on the page, big enough, long enough — not a feed.
10273
10356
  _singleMedia() {
@@ -13240,7 +13323,7 @@
13240
13323
  if (uiElements.btnRate) uiElements.btnRate.style.display = hasMedia ? '' : 'none';
13241
13324
  updateRateButton();
13242
13325
  if (uiElements.btnCinema) uiElements.btnCinema.style.display = hasMedia || STATE.isCinema ? '' : 'none';
13243
- if (uiElements.btnAutoCinema) { uiElements.btnAutoCinema.style.display = hasMedia || STATE.isCinema ? '' : 'none'; AUTO_CINEMA.paintButton(); }
13326
+ if (uiElements.btnAutoCinema) AUTO_CINEMA.paintButton();
13244
13327
  if (uiElements.btnBookmark) uiElements.btnBookmark.style.display = 'none';
13245
13328
  if (uiElements.btnFindMedia) uiElements.btnFindMedia.style.display = hasMedia ? 'none' : '';
13246
13329
  if (uiElements.btnLink) uiElements.btnLink.style.display = hasMedia || connected ? '' : 'none';
@@ -13254,6 +13337,7 @@
13254
13337
  const showSubLog = connected || TRANSLATOR.active || hasHistory;
13255
13338
  ['btnSyncStatus', 'btnDraw', 'btnChat', 'btnInvite', 'btnTune'].forEach(key => { if (uiElements[key]) uiElements[key].style.display = show; });
13256
13339
  if (uiElements.btnSubLog) uiElements.btnSubLog.style.display = showSubLog ? '' : 'none';
13340
+ if (uiElements.btnChatLog) uiElements.btnChatLog.style.display = connected || uiElements.chatMessages?.childElementCount ? '' : 'none';
13257
13341
  if (!connected) {
13258
13342
  if (STATE.chatActive) {
13259
13343
  STATE.chatActive = false;