html.i18n-pending body { visibility: hidden !important; }

/* Keep the original Latin brand typography, then fall back to native system
   fonts only for glyphs that the bundled Latin faces do not contain. */
html:lang(zh-CN) body {
  font-family: var(--font-content,Inter),"PingFang SC","Microsoft YaHei","Noto Sans CJK SC","Source Han Sans SC",system-ui,sans-serif;
}
html:lang(ja) body {
  font-family: var(--font-content,Inter),"Hiragino Kaku Gothic ProN","Yu Gothic",Meiryo,"Noto Sans CJK JP",system-ui,sans-serif;
}
html:lang(ko) body {
  font-family: var(--font-content,Inter),"Apple SD Gothic Neo","Malgun Gothic","Noto Sans CJK KR",system-ui,sans-serif;
}
html:lang(ka) body {
  font-family: var(--font-content,Inter),"Noto Sans Georgian",Sylfaen,"Segoe UI",Arial,system-ui,sans-serif;
}
html:is(:lang(el),:lang(ru),:lang(uk)) body {
  font-family: var(--font-content,Inter),"Segoe UI",Arial,system-ui,sans-serif;
}

html[data-chatly-locale]:not(:lang(en)) :where(h1,h2,h3,h4,h5,h6,p,li,dt,dd,blockquote,figcaption,label,button,a) {
  max-width: 100%;
  overflow-wrap: break-word;
}
html:is(:lang(de),:lang(nl),:lang(fr),:lang(es),:lang(it),:lang(pt),:lang(tr),:lang(ca),:lang(no),:lang(is),:lang(sv),:lang(fi),:lang(da),:lang(el),:lang(ru),:lang(uk),:lang(ka)) :where(h1,h2,h3,h4,h5,h6,p,li,blockquote,figcaption) {
  hyphens: auto;
}
html:is(:lang(zh-CN),:lang(ja),:lang(ko)) :where(h1,h2,h3,h4,h5,h6,p,li,blockquote,figcaption) {
  line-break: strict;
  word-break: normal;
}

/* Long translated copy must participate in the layout instead of widening
   grid/flex tracks or being silently clipped by English-sized text slots. */
html[data-chatly-locale]:not(:lang(en)) :where(.panes,.pane,.rows,.arow,.agrp) {
  max-width: 100%;
  min-width: 0;
}
html[data-chatly-locale]:not(:lang(en)) :where(.pane,.rows,.arow) {
  width: 100%;
}
html[data-chatly-locale]:not(:lang(en)) .arow {
  height: auto;
  min-height: 73px;
}
html[data-chatly-locale]:not(:lang(en)) .agrp {
  flex: 1 1 12rem;
}
html[data-chatly-locale]:not(:lang(en)) .agrp :where(.sub,span) {
  height: auto;
  overflow: visible;
  overflow-wrap: anywhere;
  text-overflow: clip;
  white-space: normal;
}

/* Card titles and compact labels are deliberately English-sized in the
   source snapshot.  Let translated variants grow vertically rather than
   truncating content; English keeps the original clamps. */
html[data-chatly-locale]:not(:lang(en)) :where(.line-clamp-2.text-body-md,.truncate) {
  display: block;
  overflow: visible;
  overflow-wrap: anywhere;
  text-overflow: clip;
  white-space: normal;
  -webkit-box-orient: initial;
  -webkit-line-clamp: unset;
  line-clamp: unset;
}
html[data-chatly-locale]:not(:lang(en)) small {
  max-width: 100%;
  overflow-wrap: anywhere;
  white-space: normal;
}

.chatly-i18n-switcher {
  align-items: center;
  background: rgba(255,255,255,.96);
  border: 1px solid rgba(17,24,39,.15);
  border-radius: 999px;
  bottom: max(12px,env(safe-area-inset-bottom));
  box-shadow: 0 8px 28px rgba(15,23,42,.16);
  color: #111827;
  display: flex;
  font-family: Inter,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
  gap: 8px;
  left: max(12px,env(safe-area-inset-left));
  max-width: calc(100vw - 24px - env(safe-area-inset-left) - env(safe-area-inset-right));
  min-height: 44px;
  padding: 5px 10px 5px 12px;
  position: fixed;
  z-index: 2147482000;
}
.chatly-i18n-switcher[hidden] { display: none !important; }
.chatly-i18n-icon { flex: 0 0 auto; font-size: 18px; line-height: 1; }
.chatly-i18n-label {
  border: 0; clip: rect(0 0 0 0); clip-path: inset(50%); height: 1px;
  margin: -1px; overflow: hidden; padding: 0; position: absolute;
  white-space: nowrap; width: 1px;
}
.chatly-i18n-select {
  appearance: auto; background: transparent; border: 0; color: inherit;
  cursor: pointer; font: inherit; font-size: 14px; font-weight: 650;
  line-height: 1.2; max-width: min(230px,calc(100vw - 72px));
  min-height: 34px; outline: 0; padding: 0 22px 0 0;
}
.chatly-i18n-select:focus-visible { border-radius: 8px; outline: 3px solid rgba(59,130,246,.34); outline-offset: 2px; }
[data-theme="dark"] .chatly-i18n-switcher,.dark .chatly-i18n-switcher {
  background: rgba(15,23,42,.95); border-color: rgba(255,255,255,.22); color: #f8fafc;
}
@media (max-width:480px) {
  /* Preserve the source layout down to 320px. Constrain the component itself
     rather than masking layout defects with a global overflow-x:hidden. */
  button[aria-label="Scroll right"][class~="-right-6"] { right: -1rem !important; }
  button[class~="absolute"][class~="top-0"][class~="-right-6"][class~="bottom-0"] {
    right: 0 !important;
  }
  html[data-chatly-locale]:not(:lang(en)) .nav,
  html[data-chatly-locale]:not(:lang(en)) .nav .wrap {
    max-width: 100%;
    min-width: 0;
    width: 100%;
  }
  html[data-chatly-locale]:not(:lang(en)) .nav .wrap > * { min-width: 0; }
  html[data-chatly-locale]:not(:lang(en)) .nav-menu {
    flex: 0 0 36px;
    margin-right: 0;
  }
  html[data-chatly-locale]:not(:lang(en)) .nav-go {
    max-width: calc(100% - 52px);
    min-width: 0;
    overflow-wrap: anywhere;
  }
  html[data-chatly-locale]:not(:lang(en)) .arow {
    align-items: flex-start;
    flex-wrap: wrap;
    padding-bottom: 10px;
    padding-top: 10px;
  }
  html[data-chatly-locale]:not(:lang(en)) .agrp { flex-basis: calc(100% - 64px); }
  [class~="w-[343px]"] { width: min(343px,calc(100vw - 2rem)) !important; }
  [class~="w-[327px]"] { width: min(327px,calc(100vw - 2rem)) !important; }
  [class~="w-[328px]"] { width: min(328px,calc(100vw - 2rem)) !important; }
  header[class~="fixed"][class~="inset-x-0"] { max-width: 100vw; width: 100vw; }
  [class~="max-w-[780px]"][class~="w-full"] {
    width: min(780px,calc(100vw - 2.5rem)) !important;
  }
  [class~="max-w-[780px]"][class~="w-full"],
  .ea-more > li { min-width: 0; }
  [class~="grid"] > * { max-width: 100%; min-width: 0; }
  div[class~="space-y-4"][class~="whitespace-normal"] {
    max-width: 100%; min-width: 0; width: 100%;
  }
  div[class~="space-y-4"][class~="whitespace-normal"] a { overflow-wrap: anywhere; }
  div[class~="space-y-4"][class~="whitespace-normal"] p > code {
    max-width: 100%; overflow-wrap: anywhere; white-space: pre-wrap;
  }
  [class~="max-w-140"] {
    max-width: calc(100vw - 2rem) !important;
    width: min(560px,calc(100vw - 2rem));
  }
  [class~="tracking-[4px]"][class~="uppercase"] {
    height: auto; max-width: calc(100vw - 2rem);
    min-height: 2rem; overflow-wrap: anywhere; white-space: normal;
  }
  h2:has(> span[class~="block"][class~="whitespace-nowrap"]) {
    max-width: calc(100vw - 2rem); width: 100%;
  }
  h2 > span[class~="block"][class~="whitespace-nowrap"] {
    max-width: 100%; overflow-wrap: anywhere; white-space: normal;
  }
  .ea-asks > .ea-ask { max-width: 100%; min-width: 0; }
  .ea-ask-head { flex-wrap: wrap; min-width: 0; }
  .ea-ask-head > * { min-width: 0; }
  .ea-more-actions { flex-wrap: wrap; }
  .static-fallback h1,
  .static-fallback main > p { max-width: 100%; overflow-wrap: anywhere; }
  div[class~="overflow-hidden"]:has(> [class~="animate-pulse"][class~="w-32"]) {
    max-width: 100%; width: 100%;
  }
  .chatly-i18n-switcher {
    bottom: max(10px,env(safe-area-inset-bottom)); left: max(10px,env(safe-area-inset-left));
    max-width: calc(100vw - 20px - env(safe-area-inset-left) - env(safe-area-inset-right));
    min-height: 44px; padding: 4px 9px 4px 10px;
  }
  .chatly-i18n-select {
    font-size: 14px; max-width: calc(100vw - 64px - env(safe-area-inset-left) - env(safe-area-inset-right));
    min-height: 36px;
  }
}
@media (forced-colors:active) {
  .chatly-i18n-switcher { background: Canvas; border: 1px solid CanvasText; color: CanvasText; }
}
