"use client";
import { useEffect, useState } from "react";
import { t } from "@/utils/translation";

// Inlined (not fetched via ThemedSvg) on purpose: ThemedSvg fetch()es the raw
// .svg file over the network to recolor it, which is exactly the one thing
// that can't work on the screen shown when the network is DOWN — the icon
// itself failed to load with net::ERR_INTERNET_DISCONNECTED. Baked-in markup
// with the accent pre-swapped to the theme var needs zero network.
const NO_INTERNET_SVG = `<svg viewBox="0 0 164 164" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M94.3546 34.7507V124.515C94.355 125.675 94.1269 126.823 93.6832 127.895C93.2396 128.967 92.5891 129.94 91.769 130.76C90.9489 131.581 89.9752 132.231 88.9036 132.675C87.832 133.118 86.6834 133.347 85.5236 133.346H43.9951C41.653 133.346 39.4067 132.416 37.7506 130.76C36.0945 129.103 35.1641 126.857 35.1641 124.515V34.7507C35.1635 32.6232 35.9318 30.5672 37.3274 28.9615C38.723 27.3557 40.6519 26.3084 42.7587 26.0126C43.6107 25.8844 39.9463 25.9229 85.53 25.9229C87.8707 25.9237 90.1153 26.8542 91.7701 28.5096C93.425 30.1651 94.3546 32.41 94.3546 34.7507Z" fill="#EDEDED"/>
<path d="M89.7388 34.3311V124.922C89.7388 125.928 89.3393 126.893 88.6282 127.605C87.9171 128.316 86.9524 128.717 85.9463 128.718H43.5786C42.5716 128.718 41.6058 128.318 40.8935 127.606C40.1811 126.894 39.7805 125.929 39.7797 124.922V34.3311C39.7797 33.8324 39.8779 33.3385 40.0689 32.8778C40.2599 32.4171 40.5397 31.9985 40.8925 31.646C41.2453 31.2935 41.6641 31.014 42.125 30.8234C42.5859 30.6328 43.0798 30.535 43.5786 30.5354H52.6947C53.3199 30.5354 53.9196 30.7838 54.3617 31.2259C54.8038 31.668 55.0522 32.2677 55.0522 32.8929C55.0522 33.2025 55.1131 33.5091 55.2316 33.7951C55.3501 34.0811 55.5237 34.341 55.7427 34.5599C55.9616 34.7788 56.2215 34.9525 56.5075 35.0709C56.7935 35.1894 57.1001 35.2504 57.4097 35.2504H72.1024C72.7274 35.2496 73.3265 35.0009 73.7685 34.559C74.2104 34.117 74.4591 33.5179 74.4599 32.8929C74.4599 32.2677 74.7083 31.668 75.1504 31.2259C75.5925 30.7838 76.1922 30.5354 76.8174 30.5354H85.9463C86.4446 30.5354 86.938 30.6336 87.3984 30.8244C87.8587 31.0152 88.2769 31.2948 88.6291 31.6473C88.9813 31.9998 89.2606 32.4183 89.451 32.8788C89.6414 33.3393 89.7392 33.8328 89.7388 34.3311Z" fill="white"/>
<path d="M65.0852 81.1704C61.5083 81.1704 58.0117 80.1097 55.0376 78.1225C52.0635 76.1352 49.7455 73.3107 48.3767 70.0061C47.0078 66.7015 46.6497 63.0651 47.3475 59.5569C48.0453 56.0488 49.7678 52.8263 52.297 50.297C54.8263 47.7678 58.0488 46.0453 61.5569 45.3475C65.0651 44.6497 68.7015 45.0078 72.0061 46.3767C75.3107 47.7455 78.1352 50.0635 80.1225 53.0376C82.1097 56.0117 83.1704 59.5083 83.1704 63.0852C83.1669 67.8806 81.2603 72.4786 77.8695 75.8695C74.4786 79.2603 69.8806 81.1669 65.0852 81.1704ZM65.0852 46.5928C61.8227 46.5928 58.6334 47.5603 55.9208 49.3729C53.2081 51.1855 51.0939 53.7618 49.8455 56.7761C48.5971 59.7903 48.2706 63.107 48.9073 66.3068C49.544 69.5066 51.1152 72.4458 53.4224 74.7525C55.7295 77.0593 58.6689 78.6301 61.8688 79.2663C65.0687 79.9024 68.3854 79.5754 71.3994 78.3265C74.4134 77.0776 76.9894 74.963 78.8016 72.2501C80.6138 69.5371 81.5808 66.3477 81.5802 63.0852C81.5795 58.7109 79.8414 54.516 76.748 51.4231C73.6547 48.3303 69.4595 46.5928 65.0852 46.5928Z" fill="black"/>
<path d="M65.0838 81.1679C60.7162 81.1679 57.2921 73.2172 57.2921 63.0853C57.2921 52.9535 60.7162 45.0028 65.0838 45.0028C69.4514 45.0028 72.8781 52.9535 72.8781 63.0853C72.8781 73.2172 69.454 81.1679 65.0838 81.1679ZM65.0838 46.5929C63.5838 46.5929 62.0493 48.2573 60.8752 51.1593C59.5899 54.3396 58.8823 58.5799 58.8823 63.0853C58.8823 72.9522 62.089 79.5777 65.0838 79.5777C66.5865 79.5777 68.121 77.9134 69.295 75.0114C71.9452 68.4468 71.9452 57.7239 69.295 51.1593C68.121 48.2573 66.5944 46.5929 65.0838 46.5929Z" fill="black"/>
<path d="M50.5573 53.8117L49.7993 53.3771L50.3029 52.6641C57.5088 42.4607 72.6602 42.4607 79.8635 52.6641L80.3671 53.3771L79.6091 53.8117C72.4826 57.901 57.6891 57.901 50.5573 53.8117ZM52.1474 52.855C58.8366 56.1068 71.3404 56.1015 78.0216 52.855C76.4755 50.9051 74.5084 49.3302 72.2677 48.2478C70.0269 47.1655 67.5704 46.6038 65.082 46.6049C62.5935 46.6059 60.1375 47.1696 57.8976 48.2537C55.6577 49.3379 53.692 50.9145 52.1474 52.8656V52.855Z" fill="black"/>
<path d="M50.3029 73.5054L49.7993 72.7925L50.5573 72.3579C57.6864 68.2686 72.48 68.2686 79.6091 72.3579L80.3671 72.7925L79.8635 73.5054C72.6576 83.7115 57.5088 83.7141 50.3029 73.5054ZM52.158 73.3146C53.7028 75.2659 55.669 76.8426 57.9094 77.9264C60.1498 79.0102 62.6063 79.5732 65.0951 79.5732C67.5839 79.5732 70.0405 79.0102 72.2809 77.9264C74.5213 76.8426 76.4874 75.2659 78.0322 73.3146C71.3324 70.0628 58.826 70.0681 52.1474 73.3146H52.158Z" fill="black"/>
<path d="M82.3665 62.2899H47.7969V63.8801H82.3665V62.2899Z" fill="black"/>
<path d="M68.6975 117.36H59.5334C58.2923 117.36 57.1019 116.866 56.2243 115.989C55.3467 115.111 54.8536 113.921 54.8536 112.68C54.8536 111.439 55.3467 110.248 56.2243 109.371C57.1019 108.493 58.2923 108 59.5334 108H68.6975C69.9387 108 71.129 108.493 72.0066 109.371C72.8843 110.248 73.3773 111.439 73.3773 112.68C73.3773 113.921 72.8843 115.111 72.0066 115.989C71.129 116.866 69.9387 117.36 68.6975 117.36Z" fill="#D9D9D9"/>
<path d="M85.5236 134.307H43.9951C41.3991 134.304 38.9105 133.271 37.0749 131.435C35.2393 129.6 34.2065 127.111 34.2031 124.515V34.7507C34.2065 32.155 35.2394 29.6667 37.0751 27.8316C38.9108 25.9965 41.3994 24.9645 43.9951 24.9619H85.5236C88.12 24.9619 90.6102 25.9931 92.4464 27.8288C94.2827 29.6644 95.3147 32.1542 95.3155 34.7507V124.515C95.3122 127.111 94.2794 129.6 92.4438 131.435C90.6082 133.271 88.1195 134.304 85.5236 134.307ZM43.9951 26.8838C41.9089 26.8855 39.9086 27.7148 38.4331 29.1896C36.9576 30.6645 36.1275 32.6645 36.125 34.7507V124.515C36.1275 126.602 36.9575 128.602 38.4329 130.077C39.9083 131.553 41.9086 132.383 43.9951 132.385H85.5236C87.6101 132.383 89.6104 131.553 91.0858 130.077C92.5611 128.602 93.3911 126.602 93.3937 124.515V34.7507C93.3928 32.6639 92.5633 30.663 91.0874 29.1877C89.6116 27.7125 87.6103 26.8838 85.5236 26.8838H43.9951Z" fill="black"/>
<path d="M113.245 17.3231C108.549 16.5495 103.729 17.1723 99.3833 19.1141C95.0379 21.0559 91.3587 24.2312 88.8022 28.2459C86.2458 32.2605 84.9248 36.9375 85.0033 41.6964C85.0818 46.4552 86.5563 51.0861 89.2437 55.0143L86.0566 64.6973L95.5346 61.3276C98.5353 63.3939 101.962 64.7591 105.561 65.3224C109.161 65.8857 112.841 65.6326 116.329 64.5818C119.818 63.5311 123.025 61.7095 125.715 59.252C128.404 56.7944 130.507 53.7637 131.867 50.3839C133.227 47.0041 133.81 43.3618 133.573 39.7263C133.336 36.0908 132.284 32.5552 130.496 29.3809C128.708 26.2066 126.229 23.4749 123.243 21.3878C120.257 19.3006 116.84 17.9115 113.245 17.3231Z" fill="white"/>
<path d="M114.803 31L100 45.8032L105.013 50.8161L119.816 36.0129L114.803 31Z" fill="var(--primary-color)"/>
<path d="M105.015 31L100.002 36.0129L114.805 50.8162L119.818 45.8032L105.015 31Z" fill="var(--primary-color)"/>
<path d="M95.8952 61.9356L85.0302 65.7794L88.6818 54.6838C85.9939 50.5818 84.558 45.7861 84.5494 40.8819C84.5407 35.9777 85.9597 31.177 88.6332 27.0655C91.3067 22.9541 95.1191 19.7097 99.6052 17.7282C104.091 15.7467 109.057 15.1138 113.897 15.9067C120.502 17.0062 126.402 20.6789 130.305 26.1202C134.207 31.5615 135.794 38.3277 134.717 44.9366C131.741 63.124 111.004 71.9134 95.8952 61.9356ZM96.1739 59.7959C111.145 70.11 130.127 61.0996 132.834 44.6227C133.581 40.0676 132.961 35.393 131.052 31.1901C129.144 26.9872 126.031 23.4447 122.109 21.0105C118.187 18.5763 113.631 17.3597 109.018 17.5146C104.404 17.6694 99.94 19.1888 96.1899 21.8805C86.2955 28.9819 82.9867 42.9699 90.8023 54.4019L88.086 62.6691L96.1739 59.7959Z" fill="black"/>
<path d="M33.5464 77.836H31.3042C29.6222 77.836 28.009 77.1678 26.8196 75.9784C25.6302 74.789 24.962 73.1759 24.962 71.4938C24.962 69.8117 25.6302 68.1986 26.8196 67.0092C28.009 65.8198 29.6222 65.1516 31.3042 65.1516H33.5464C35.2285 65.1516 36.8416 65.8198 38.031 67.0092C39.2204 68.1986 39.8886 69.8117 39.8886 71.4938C39.8886 73.1759 39.2204 74.789 38.031 75.9784C36.8416 77.1678 35.2285 77.836 33.5464 77.836Z" fill="white"/>
<path d="M33.5463 90.5107H29.3823C27.7253 90.4734 26.1488 89.789 24.9901 88.604C23.8314 87.419 23.1826 85.8274 23.1826 84.1701C23.1826 82.5127 23.8314 80.9212 24.9901 79.7361C26.1488 78.5511 27.7253 77.8667 29.3823 77.8295H33.5463C34.391 77.8105 35.2309 77.9605 36.0168 78.2706C36.8027 78.5807 37.5187 79.0447 38.1228 79.6354C38.7269 80.226 39.2069 80.9314 39.5346 81.7101C39.8622 82.4889 40.0311 83.3252 40.0311 84.1701C40.0311 85.0149 39.8622 85.8513 39.5346 86.63C39.2069 87.4087 38.7269 88.1141 38.1228 88.7048C37.5187 89.2954 36.8027 89.7595 36.0168 90.0696C35.2309 90.3797 34.391 90.5296 33.5463 90.5107Z" fill="white"/>
<path d="M33.5463 103.192H29.3823C27.7253 103.155 26.1488 102.47 24.9901 101.285C23.8314 100.1 23.1826 98.5086 23.1826 96.8512C23.1826 95.1938 23.8314 93.6023 24.9901 92.4173C26.1488 91.2323 27.7253 90.5479 29.3823 90.5106H33.5463C34.391 90.4916 35.2309 90.6416 36.0168 90.9517C36.8027 91.2618 37.5187 91.7259 38.1228 92.3165C38.7269 92.9072 39.2069 93.6126 39.5346 94.3913C39.8622 95.17 40.0311 96.0064 40.0311 96.8512C40.0311 97.6961 39.8622 98.5324 39.5346 99.3112C39.2069 100.09 38.7269 100.795 38.1228 101.386C37.5187 101.977 36.8027 102.441 36.0168 102.751C35.2309 103.061 34.391 103.211 33.5463 103.192Z" fill="white"/>
<path d="M33.5464 115.876H31.3042C29.6222 115.876 28.009 115.208 26.8196 114.019C25.6302 112.829 24.962 111.216 24.962 109.534C24.962 107.852 25.6302 106.239 26.8196 105.049C28.009 103.86 29.6222 103.192 31.3042 103.192H33.5464C35.2285 103.192 36.8416 103.86 38.031 105.049C39.2204 106.239 39.8886 107.852 39.8886 109.534C39.8886 111.216 39.2204 112.829 38.031 114.019C36.8416 115.208 35.2285 115.876 33.5464 115.876Z" fill="white"/>
<path d="M33.5464 78.7969H31.3042C29.3673 78.7969 27.5097 78.0275 26.1401 76.6579C24.7705 75.2883 24.0011 73.4307 24.0011 71.4938C24.0011 69.5569 24.7705 67.6993 26.1401 66.3297C27.5097 64.9601 29.3673 64.1907 31.3042 64.1907H33.5464C35.4833 64.1907 37.3409 64.9601 38.7105 66.3297C40.0801 67.6993 40.8495 69.5569 40.8495 71.4938C40.8495 73.4307 40.0801 75.2883 38.7105 76.6579C37.3409 78.0275 35.4833 78.7969 33.5464 78.7969ZM31.3042 66.1125C29.877 66.1125 28.5083 66.6795 27.4991 67.6887C26.4899 68.6979 25.923 70.0666 25.923 71.4938C25.923 72.921 26.4899 74.2897 27.4991 75.2989C28.5083 76.3081 29.877 76.8751 31.3042 76.8751H33.5464C34.9736 76.8751 36.3423 76.3081 37.3515 75.2989C38.3607 74.2897 38.9277 72.921 38.9277 71.4938C38.9277 70.0666 38.3607 68.6979 37.3515 67.6887C36.3423 66.6795 34.9736 66.1125 33.5464 66.1125H31.3042Z" fill="black"/>
<path d="M33.5464 91.4716H29.3824C27.4724 91.4316 25.6541 90.6447 24.3174 89.2798C22.9808 87.9149 22.2322 86.0805 22.2322 84.1701C22.2322 82.2596 22.9808 80.4253 24.3174 79.0603C25.6541 77.6954 27.4724 76.9086 29.3824 76.8685H33.5464C34.5181 76.8482 35.4842 77.022 36.3878 77.3798C37.2915 77.7376 38.1147 78.2722 38.8091 78.9522C39.5035 79.6322 40.0552 80.444 40.4318 81.34C40.8085 82.236 41.0025 83.1981 41.0025 84.1701C41.0025 85.142 40.8085 86.1042 40.4318 87.0001C40.0552 87.8961 39.5035 88.7079 38.8091 89.388C38.1147 90.068 37.2915 90.6026 36.3878 90.9603C35.4842 91.3181 34.5181 91.492 33.5464 91.4716ZM29.392 78.7968C27.9879 78.8311 26.6529 79.4129 25.672 80.4181C24.6911 81.4232 24.142 82.772 24.142 84.1765C24.142 85.5809 24.6911 86.9297 25.672 87.9349C26.6529 88.94 27.9879 89.5219 29.392 89.5561H33.556C34.2735 89.5736 34.9873 89.4474 35.6553 89.185C36.3233 88.9225 36.9321 88.529 37.4457 88.0277C37.9594 87.5264 38.3676 86.9275 38.6463 86.2661C38.925 85.6047 39.0686 84.8942 39.0686 84.1765C39.0686 83.4588 38.925 82.7483 38.6463 82.0869C38.3676 81.4255 37.9594 80.8265 37.4457 80.3252C36.9321 79.8239 36.3233 79.4305 35.6553 79.168C34.9873 78.9055 34.2735 78.7793 33.556 78.7968H29.392Z" fill="black"/>
<path d="M33.5464 104.153H29.3824C27.4724 104.113 25.6541 103.326 24.3174 101.961C22.9808 100.596 22.2322 98.7616 22.2322 96.8512C22.2322 94.9408 22.9808 93.1064 24.3174 91.7415C25.6541 90.3765 27.4724 89.5897 29.3824 89.5497H33.5464C34.5181 89.5293 35.4842 89.7032 36.3878 90.0609C37.2915 90.4187 38.1147 90.9533 38.8091 91.6333C39.5035 92.3134 40.0552 93.1252 40.4318 94.0211C40.8085 94.9171 41.0025 95.8793 41.0025 96.8512C41.0025 97.8231 40.8085 98.7853 40.4318 99.6813C40.0552 100.577 39.5035 101.389 38.8091 102.069C38.1147 102.749 37.2915 103.284 36.3878 103.641C35.4842 103.999 34.5181 104.173 33.5464 104.153ZM29.3824 91.4716C27.9783 91.5058 26.6433 92.0877 25.6624 93.0928C24.6815 94.0979 24.1324 95.4468 24.1324 96.8512C24.1324 98.2557 24.6815 99.6045 25.6624 100.61C26.6433 101.615 27.9783 102.197 29.3824 102.231H33.5464C34.2639 102.248 34.9777 102.122 35.6457 101.86C36.3137 101.597 36.9225 101.204 37.4361 100.702C37.9498 100.201 38.358 99.6022 38.6367 98.9408C38.9154 98.2794 39.059 97.5689 39.059 96.8512C39.059 96.1335 38.9154 95.423 38.6367 94.7616C38.358 94.1002 37.9498 93.5012 37.4361 93C36.9225 92.4987 36.3137 92.1052 35.6457 91.8427C34.9777 91.5803 34.2639 91.4541 33.5464 91.4716H29.3824Z" fill="black"/>
<path d="M33.5464 116.837H31.3042C29.3673 116.837 27.5097 116.068 26.1401 114.698C24.7705 113.329 24.0011 111.471 24.0011 109.534C24.0011 107.597 24.7705 105.74 26.1401 104.37C27.5097 103 29.3673 102.231 31.3042 102.231H33.5464C35.4833 102.231 37.3409 103 38.7105 104.37C40.0801 105.74 40.8495 107.597 40.8495 109.534C40.8495 111.471 40.0801 113.329 38.7105 114.698C37.3409 116.068 35.4833 116.837 33.5464 116.837ZM31.3042 104.153C29.877 104.153 28.5083 104.72 27.4991 105.729C26.4899 106.738 25.923 108.107 25.923 109.534C25.923 110.961 26.4899 112.33 27.4991 113.339C28.5083 114.348 29.877 114.915 31.3042 114.915H33.5464C34.9736 114.915 36.3423 114.348 37.3515 113.339C38.3607 112.33 38.9277 110.961 38.9277 109.534C38.9277 108.107 38.3607 106.738 37.3515 105.729C36.3423 104.72 34.9736 104.153 33.5464 104.153H31.3042Z" fill="black"/>
<path d="M107.154 152.469V79.6328H104.39C101.729 79.6337 99.1772 80.6913 97.2959 82.5732C95.4146 84.4552 94.3578 87.0072 94.3578 89.6682V109.528C94.3578 109.528 77.8969 113.932 77.8969 133.34H58.8864C58.8864 133.34 60.2669 140.435 69.2901 143.308L66.7436 152.469" fill="white"/>
<path d="M67.6694 152.725L65.818 152.212L68.121 143.929C59.4469 140.758 58.0023 133.833 57.9415 133.532L57.7205 132.385H76.9392C77.2147 122.574 81.7055 116.69 85.4916 113.432C87.82 111.429 90.4962 109.87 93.3873 108.832V89.6682C93.3898 86.7531 94.5487 83.9581 96.6097 81.8966C98.6707 79.835 101.465 78.6753 104.38 78.6719H108.106V152.469H106.184V80.5938H104.39C101.985 80.5971 99.6788 81.5544 97.9783 83.2555C96.2777 84.9567 95.3213 87.2628 95.3187 89.6682V110.271L94.6044 110.463C91.6905 111.408 88.9981 112.934 86.6895 114.947C81.4941 119.432 78.8579 125.626 78.8579 133.349V134.31H60.1901C60.9748 136.312 63.2971 140.396 69.5816 142.401L70.4625 142.683L67.6694 152.725Z" fill="black"/>
<path d="M43.047 17.8798C42.4632 17.8792 41.8881 17.7387 41.3698 17.4702C40.8515 17.2017 40.405 16.8129 40.0678 16.3364C39.7306 15.8599 39.5124 15.3096 39.4315 14.7314C39.3506 14.1533 39.4094 13.5642 39.6029 13.0135C39.7964 12.4628 40.1191 11.9664 40.5438 11.5659C40.9685 11.1654 41.483 10.8726 42.0442 10.7117C42.6053 10.5509 43.1968 10.5269 43.7692 10.6416C44.3416 10.7563 44.8782 11.0064 45.334 11.3711C48.0022 13.5044 46.516 17.8798 43.047 17.8798ZM42.8644 12.4922C42.5253 12.5321 42.2056 12.6715 41.9456 12.8928C41.6856 13.1141 41.4969 13.4074 41.4033 13.7357C41.3097 14.0641 41.3153 14.4128 41.4195 14.7379C41.5238 15.0631 41.7219 15.3501 41.9889 15.5629C42.256 15.7756 42.58 15.9046 42.9202 15.9335C43.2604 15.9624 43.6016 15.89 43.9007 15.7253C44.1998 15.5607 44.4435 15.3112 44.6011 15.0084C44.7587 14.7055 44.8231 14.3627 44.7863 14.0233C44.7608 13.7965 44.6908 13.5769 44.5804 13.3772C44.47 13.1775 44.3213 13.0014 44.1428 12.8592C43.9643 12.717 43.7595 12.6114 43.5401 12.5484C43.3208 12.4854 43.0912 12.4663 42.8644 12.4922Z" fill="black"/>
<path d="M26.8102 33.2709C26.0885 33.2686 25.395 32.9909 24.8712 32.4944C24.3474 31.998 24.033 31.3203 23.9921 30.5998C23.9512 29.8793 24.187 29.1704 24.6512 28.6178C25.1154 28.0653 25.7731 27.7109 26.4899 27.627C26.8734 27.5821 27.262 27.6161 27.6319 27.7269C28.0017 27.8378 28.345 28.0231 28.6406 28.2714C28.9362 28.5198 29.1779 28.826 29.3508 29.1713C29.5238 29.5165 29.6243 29.8934 29.6461 30.2789C29.668 30.6644 29.6108 31.0503 29.4781 31.4129C29.3453 31.7754 29.1398 32.107 28.8742 32.3873C28.6086 32.6675 28.2885 32.8904 27.9335 33.0424C27.5786 33.1944 27.1963 33.2721 26.8102 33.2709ZM26.7173 29.5393C26.5383 29.5588 26.369 29.6311 26.2311 29.7469C26.0932 29.8628 25.9927 30.0169 25.9425 30.1899C25.8923 30.3629 25.8945 30.5469 25.949 30.7186C26.0034 30.8903 26.1076 31.0419 26.2484 31.1544C26.3891 31.2668 26.5601 31.3349 26.7396 31.35C26.919 31.3652 27.099 31.3267 27.2566 31.2395C27.4142 31.1523 27.5423 31.0203 27.6248 30.8601C27.7073 30.7 27.7404 30.519 27.7199 30.34C27.6925 30.1012 27.5717 29.8828 27.3838 29.7328C27.196 29.5827 26.9563 29.5131 26.7173 29.5393Z" fill="black"/>
<path d="M33.0888 134.783L28.7892 139.081L30.1479 140.44L34.4475 136.142L33.0888 134.783Z" fill="black"/>
<path d="M30.5836 129.477H24.504V131.399H30.5836V129.477Z" fill="black"/>
<path d="M39.3793 138.801H37.4574V144.881H39.3793V138.801Z" fill="black"/>
<path d="M113.922 73.7008C113.788 72.4996 113.842 72.9897 113.708 71.7789C113.708 71.7789 114.393 71.6988 115.511 71.4586L115.924 73.3388C114.694 73.6143 113.951 73.6976 113.922 73.7008ZM119.108 72.4804L118.516 70.6514C119.108 70.4624 119.704 70.2542 120.287 70.0332L120.969 71.8302C120.361 72.0704 119.733 72.2818 119.108 72.4804ZM123.996 70.5233L123.157 68.7968C123.721 68.5213 124.278 68.233 124.816 67.932L125.752 69.6136C125.181 69.9307 124.602 70.235 123.996 70.5233ZM128.551 67.8775L127.462 66.2952C127.971 65.9428 128.477 65.5713 128.964 65.1901L130.146 66.7052C129.631 67.1087 129.086 67.5027 128.551 67.8775ZM132.641 64.543L131.306 63.1593C131.754 62.7269 132.19 62.2784 132.603 61.8268L134.022 63.108C133.57 63.6045 133.116 64.0818 132.641 64.543ZM136.133 60.5648L134.579 59.4309C134.944 58.9312 135.297 58.4155 135.63 57.8966L137.251 58.9312C136.879 59.4853 136.504 60.0363 136.133 60.5648ZM138.859 56.0548L137.139 55.1963C137.414 54.6486 137.677 54.0784 137.92 53.5083L139.688 54.261C139.429 54.8696 139.15 55.475 138.859 56.0548ZM140.829 51.1764L138.996 50.6095C139.182 50.0233 139.355 49.4179 139.512 48.8125L141.373 49.2962C141.207 49.924 141.024 50.5614 140.829 51.1796V51.1764Z" fill="#D9D9D9"/>
<path d="M52.0955 98.0649C51.2745 98.0643 50.4873 97.7378 49.9069 97.1571C49.3265 96.5765 49.0003 95.7892 49 94.9682V92.973C49.0009 92.1514 49.3277 91.3637 49.9087 90.7827C50.4897 90.2018 51.2774 89.875 52.099 89.874H58.1523C58.9738 89.8747 59.7615 90.2012 60.3425 90.782C60.9235 91.3628 61.2504 92.1503 61.2513 92.9719V94.9682C61.2507 95.7898 60.9241 96.5775 60.3433 97.1585C59.7626 97.7395 58.975 98.0663 58.1535 98.0673L52.0955 98.0649ZM58.1487 91.8312H52.0955C51.7926 91.8312 51.5022 91.9515 51.2881 92.1657C51.074 92.3798 50.9537 92.6702 50.9537 92.973V94.9682C50.9535 95.1182 50.9829 95.2668 51.0403 95.4054C51.0976 95.544 51.1817 95.6699 51.2877 95.776C51.3938 95.882 51.5197 95.9661 51.6583 96.0235C51.7969 96.0808 51.9455 96.1102 52.0955 96.1101H58.1487C58.4512 96.1094 58.7412 95.9889 58.955 95.7749C59.1688 95.5608 59.289 95.2708 59.2893 94.9682V92.9742C59.2895 92.8242 59.2601 92.6756 59.2028 92.5369C59.1454 92.3983 59.0614 92.2722 58.9553 92.1661C58.8493 92.0599 58.7234 91.9757 58.5848 91.9183C58.4461 91.8608 58.2976 91.8312 58.1475 91.8312H58.1487Z" fill="black"/>
<path d="M71.3138 98.0649C70.4927 98.064 69.7055 97.7374 69.1247 97.1569C68.544 96.5764 68.2172 95.7894 68.2159 94.9682V92.9742C68.2166 92.1526 68.5431 91.3648 69.1238 90.7836C69.7046 90.2024 70.4922 89.8753 71.3138 89.874H77.367C78.1887 89.875 78.9764 90.2018 79.5573 90.7827C80.1383 91.3637 80.4651 92.1514 80.4661 92.973V94.9682C80.4648 95.7896 80.1378 96.5768 79.5568 97.1574C78.9759 97.7379 78.1883 98.0643 77.367 98.0649H71.3138ZM71.3138 91.8312C71.0111 91.8316 70.7208 91.952 70.5067 92.166C70.2927 92.3801 70.1723 92.6703 70.172 92.973V94.9682C70.1729 95.2706 70.2936 95.5602 70.5076 95.7737C70.7216 95.9873 71.0115 96.1074 71.3138 96.1077H77.367C77.6696 96.1074 77.9596 95.9871 78.1736 95.7733C78.3877 95.5595 78.5082 95.2696 78.5088 94.9671V92.973C78.5085 92.6703 78.3881 92.3801 78.1741 92.166C77.96 91.952 77.6698 91.8316 77.367 91.8312H71.3138Z" fill="black"/>
<path d="M63.2702 95.049H58.2507C57.9706 95.0397 57.7051 94.9219 57.5102 94.7205C57.3154 94.5191 57.2064 94.2498 57.2064 93.9695C57.2064 93.6893 57.3154 93.42 57.5102 93.2185C57.7051 93.0171 57.9706 92.8993 58.2507 92.89H63.2429L63.8636 93.2342L62.9853 93.633L63.8636 94.0852V94.6787L63.2702 95.049Z" fill="black"/>
<path d="M71.4612 92.89H66.4833L65.8495 93.2461V93.9689L66.5177 94.2965L65.8495 94.7L66.4168 95.0478H71.4612C71.7413 95.0385 72.0068 94.9207 72.2017 94.7193C72.3966 94.5178 72.5055 94.2485 72.5055 93.9683C72.5055 93.688 72.3966 93.4187 72.2017 93.2173C72.0068 93.0159 71.7413 92.8981 71.4612 92.8888V92.89Z" fill="black"/>
<path d="M60.8654 100.948L63.562 98.3617L62.8879 102.048L60.8654 100.948Z" fill="var(--primary-color)"/>
<path d="M65.6534 99.8963V96.4863L67.8196 99.1165L65.6534 99.8963Z" fill="var(--primary-color)"/>
<path d="M62.7193 86L63.5988 89.2949L60.8274 87.3127L62.7193 86Z" fill="var(--primary-color)"/>
<path d="M68.3916 88.6159L65.6534 90.6479L66.4748 87.3412L68.3916 88.6159Z" fill="var(--primary-color)"/>
</svg>`;

// Full-screen overlay shown when the browser goes offline. Listens to the
// window online/offline events (and seeds from navigator.onLine on mount).
// Mounted once globally in Layout so it covers every route.
const OfflineOverlay = () => {
  const [offline, setOffline] = useState(false);

  useEffect(() => {
    // Seed from the current status (navigator.onLine is only reliable client-side).
    // Intentional sync setState: mirrors an external browser API on mount.
    if (typeof navigator !== "undefined" && navigator.onLine === false) {
      // eslint-disable-next-line react-hooks/set-state-in-effect
      setOffline(true);
    }
    const goOffline = () => setOffline(true);
    const goOnline = () => setOffline(false);
    window.addEventListener("offline", goOffline);
    window.addEventListener("online", goOnline);
    return () => {
      window.removeEventListener("offline", goOffline);
      window.removeEventListener("online", goOnline);
    };
  }, []);

  if (!offline) return null;

  return (
    <div className="fixed inset-0 z-[10000] flex flex-col items-center justify-center gap-5 bg-white/95 dark:bg-zinc-950/95 px-6 text-center backdrop-blur-sm">
      <span
        role="img"
        aria-label={t("no_internet_connection") || "No internet connection"}
        className="block w-3/4 max-w-[320px] mx-auto [&>svg]:block [&>svg]:h-auto [&>svg]:w-full"
        dangerouslySetInnerHTML={{ __html: NO_INTERNET_SVG }}
      />
      <div className="flex flex-col gap-1.5">
        <h2 className="text-xl md:text-2xl font-bold textColor">
          {t("no_internet_connection") || "No Internet Connection"}
        </h2>
        <p className="text-sm SecondaryTextColor max-w-sm">
          {t("check_your_connection") ||
            "Please check your network and try again."}
        </p>
      </div>
      <button
        type="button"
        onClick={() => {
          if (typeof navigator !== "undefined" && navigator.onLine) {
            setOffline(false);
          } else {
            window.location.reload();
          }
        }}
        className="primaryBackColor text-white rounded-xl px-6 py-2.5 text-sm font-semibold transition-opacity hover:opacity-90"
      >
        {t("retry") || "Retry"}
      </button>
    </div>
  );
};

export default OfflineOverlay;
