/* UI-only language proposal inside existing menus. English page geometry is unchanged. */
:root[data-ui-language-loading] body{visibility:hidden}
.ss-language-selector{min-width:0;flex:none;text-align:start;direction:inherit}
.ss-language-row{display:flex;align-items:center;justify-content:space-between;gap:12px;min-height:60px;width:100%;padding:10px 16px;border:0;border-radius:12px;background:#292929;color:#f0f0f0;font-family:inherit;font-size:16px;font-weight:600;line-height:1.4;text-align:start}
.ss-language-row>span{flex:0 1 auto;min-width:0}
.ss-language-row select{appearance:none;min-width:0;width:auto;max-width:70%;margin:0;padding:8px;border:0;border-radius:8px;outline:0;box-shadow:none;background:transparent;color:inherit;font:inherit;text-align:end;cursor:pointer}
.ss-language-row select:focus-visible,.ss-language-row select:hover{background:#353535}
.ss-language-row option{background:#292929;color:#f0f0f0;font-family:system-ui,sans-serif}
.ss-language-note{margin:8px 8px 0;font-size:12px;line-height:1.5;color:inherit;opacity:.8;overflow-wrap:anywhere}
.ss-language-retry{width:100%;min-height:44px;margin:8px 0 0;border:0;border-radius:12px;background:#353535;color:#f0f0f0;font:inherit;cursor:pointer}
.ss-language-selector [hidden]{display:none!important}
.ss-language-automatic{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:10px 16px;min-height:44px;font:inherit;font-size:14px;font-weight:600;line-height:1.5;cursor:pointer}.ss-language-automatic input{width:22px;height:22px;flex:none;margin:0;accent-color:#ffeb00}
/* OS script fonts supplement approved Latin faces without downloading third-party assets. */
:lang(zh-Hans){--ss-script-font:"PingFang SC","Microsoft YaHei","Noto Sans CJK SC",sans-serif}
:lang(ja){--ss-script-font:"Hiragino Kaku Gothic ProN","Yu Gothic","Meiryo","Noto Sans CJK JP",sans-serif}
:lang(ko){--ss-script-font:"Apple SD Gothic Neo","Malgun Gothic","Noto Sans CJK KR",sans-serif}
:lang(hi){--ss-script-font:"Nirmala UI","Noto Sans Devanagari",sans-serif}
:lang(bn){--ss-script-font:"Nirmala UI","Noto Sans Bengali",sans-serif}
:lang(ar){--ss-script-font:"Geeza Pro","Noto Sans Arabic",Tahoma,sans-serif}
:lang(ur){--ss-script-font:"Noto Nastaliq Urdu","Noto Naskh Arabic","Geeza Pro",Tahoma,sans-serif}
[data-i18n],.ss-language-selector{font-family:var(--ss-script-font,inherit)}
[dir=rtl] .ss-header-menu-panel>a,[dir=rtl] .ss-header-menu-panel>button{text-align:start}
[dir=rtl] .ss-header-menu-next{transform:rotate(-135deg)}
/* Direction follows language for UI; canonical numeric/code/QR content stays LTR. */
[data-i18n-ltr],.ss-ltr,input[type=number],input[type=date],input[type=time],input[type=email],input[type=url],input[type=tel],[data-qr],.share-code{direction:ltr;unicode-bidi:isolate}
[data-user-content],[data-advertiser-content]{unicode-bidi:plaintext}
/* These are saved artwork coordinates and a scaled viewport, not reading-order
   containers. RTL absolute-position resolution must not move the 390px iframe. */
.artboard,.calculator-view-content,.calculator-view-screen,.calculator-scan-art,.calculator-scan-words,.calculator-scan-qr,.hero-menu-logo{direction:ltr;unicode-bidi:isolate}
/* Keep the maintained numeric diagrams, Latin identifiers and positive-scroll
   protocol rail physically consistent while feature translations are reviewed. */
.ss-brand-mark,.draw-metrics,.draw-number,.draw-mass,.draw-volume,.draw-peptide,.draw-share,.gauge,.water-number,.liquid-card-number,.liquid-card-final strong,.key-amount,.keys,.protocol-track,.protocol-tile>span,.oral-count,.oral-dose,.period-pair strong{direction:ltr;unicode-bidi:isolate}
html[dir=rtl] [data-i18n]:not([dir=ltr]),html[dir=rtl] .ss-language-selector,html[dir=rtl] .hero-menu-link-text:not([dir=ltr]){direction:rtl;unicode-bidi:isolate}
html[dir=rtl] [data-i18n][dir=ltr]{direction:ltr;unicode-bidi:isolate}
/* Menu clipping masks need a full script line box, including lower strokes and
   vowel marks. Preserve the approved English line height and reveal geometry. */
html:is([lang=ar],[lang=ur]) .hero-menu-link{line-height:1.55}
html:is([lang=hi],[lang=bn]) .hero-menu-link{line-height:1.5}
html[lang=zh-Hans] .hero-menu-link{line-height:1.25}
html:is([lang=ja],[lang=ko]) .hero-menu-link{line-height:1.35}
html:not([lang=en]) .hero-menu-link{max-width:calc(100vw - 48px);white-space:normal;overflow-wrap:anywhere}
/* Until these messages are keyed, the original wording chooses its own text
   direction; an English fallback must not move its final punctuation first. */
.target-help,.input-error{unicode-bidi:plaintext}
/* Longer translated control names stay inside the existing columns and tiles. */
html:is([lang=de],[lang=ja],[lang=ko],[lang=it],[lang=sv],[lang=nl],[lang=tr]) #calculator .key-label,html:is([lang=de],[lang=ja],[lang=ko],[lang=it],[lang=sv],[lang=nl],[lang=tr]) .protocol-facts dt{min-width:0;overflow-wrap:anywhere;hyphens:auto}
/* A translated fact is still the complete saved fact. Keep the approved columns
   and type scale; the shared row grows to its longest label instead of clipping
   a frequency or timing at the old one-line/two-line height. English is exact. */
html:not([lang=en]) #calculator .result>.protocol-pad{flex:0 0 auto;height:auto;min-height:var(--protocol-tile-height);max-height:none}
html:not([lang=en]) #calculator .protocol-track{height:auto;min-height:var(--protocol-tile-height)}
html:not([lang=en]) #calculator .protocol-tile{height:auto;min-height:var(--protocol-tile-height)}
html:not([lang=en]) :is(#calculator,.ss-share) .protocol-tile>span{white-space:normal;overflow:visible;text-overflow:clip;overflow-wrap:anywhere;text-align:center;line-height:1.2}
html:not([lang=en]) .ss-share .ss-share-tiles{height:auto;min-height:76px}
html:not([lang=en]) .ss-share .protocol-tile{height:auto;min-height:76px}
html:not([lang=en]) .ss-calendar-editor .sce-supplies{height:auto;min-height:76px}
html:not([lang=en]) .ss-calendar-editor .sce-supplies .sce-tile{height:auto;min-height:76px;padding:6px 3px}
html:not([lang=en]) .ss-calendar-editor .sce-supplies .sce-tile>span{white-space:normal;overflow:visible;text-overflow:clip;overflow-wrap:anywhere;text-align:center;line-height:1.2}
@media(max-height:760px){html:not([lang=en]) .ss-share :is(.ss-share-tiles,.protocol-tile){min-height:60px}}
@media(max-width:599px) and (max-height:810px){html:is([lang=de],[lang=ja],[lang=ko],[lang=it],[lang=sv],[lang=nl],[lang=tr]) #calculator{--protocol-tile-height:76px}}

/* Translated source badges share the existing picker row with the peptide
   name. Reserve a readable name and let the full source label wrap. */
html:not([lang=en]) #calculator .picker-choice .picker-copy{min-inline-size:min(84px,28%)}
html:not([lang=en]) #calculator .picker-tag{flex:0 1 auto;min-inline-size:0;max-inline-size:40%;white-space:normal;overflow-wrap:anywhere;font-size:14px;line-height:1.2;text-align:end}
/* A fixed English label column is too narrow for translated fact names.
   The existing two-column component and its values remain unchanged. */
html:not([lang=en]) #calculator .protocol-facts>div{grid-template-columns:minmax(0,30%) minmax(0,1fr);column-gap:10px}
html:not([lang=en]) #calculator .protocol-facts dt{min-width:0;overflow-wrap:anywhere;word-break:normal;hyphens:auto}
html:not([lang=en]) #calculator .protocol-facts dd{min-width:0}
/* Prefer language-aware hyphenation before an emergency compound-word break. */
html[lang=de] #calculator .key-label{word-break:normal;overflow-wrap:break-word;hyphens:auto;hyphenate-limit-chars:5 3 3;hyphenate-character:'-'}
