/* DRIP WARS localization styles: language picker, right-to-left layer for Arabic, script fonts, text expansion.
   The physical left/right rules of the game's own stylesheets are mirrored at runtime by i18n.js (mirrorCss) for
   html[dir=rtl]; this file holds the hand-made parts. */

/* hide the page for the moment between first paint and the first translation pass (i18n.js removes it, 4 s max) */
html.i18n-pending body{visibility:hidden}

/* ---------- picker ---------- */
.lang-settings .lang-options{display:flex;flex-wrap:wrap;gap:8px;margin:6px 0 4px}
.lang-settings .lang-option{flex:1 1 calc(50% - 8px);min-width:0;margin:0!important;text-transform:none!important;letter-spacing:0!important}
.lang-settings .lang-option[aria-pressed=true]{outline:3px solid #c8ff62;outline-offset:-3px}
.lang-globe{display:inline-flex;align-items:center;gap:5px;min-height:32px;padding:4px 9px;border-radius:999px;border:2px solid rgba(255,255,255,.35);background:rgba(16,16,23,.55);color:#fff8e9;font:700 13px/1 Arial,sans-serif;letter-spacing:.04em;cursor:pointer}
.lang-globe:hover,.lang-globe:focus-visible{border-color:#c8ff62;color:#c8ff62}
.lang-globe svg{flex:none}
.topline .utilities .lang-globe{margin-inline-end:6px}
.acct-card{position:relative}
.acct-card>.lang-globe-gate{position:absolute;top:10px;inset-inline-end:10px;z-index:2;background:rgba(18,16,23,.8)}
.lang-menu{position:fixed;z-index:100000;display:flex;flex-direction:column;min-width:150px;padding:6px;border-radius:12px;background:#17131f;border:2px solid #c8ff62;box-shadow:0 12px 32px rgba(0,0,0,.5)}
.lang-menu-item{all:unset;box-sizing:border-box;display:block;padding:10px 14px;border-radius:8px;color:#fff8e9;font:600 16px/1.2 system-ui,"Segoe UI",Tahoma,"Noto Sans Arabic","Hiragino Sans","Yu Gothic","Meiryo","Noto Sans JP",sans-serif;cursor:pointer;text-align:start}
.lang-menu-item:hover,.lang-menu-item:focus-visible{background:#2a2236}
.lang-menu-item[aria-checked=true]{background:#c8ff62;color:#121017}
.lang-option,.lang-menu-item{font-family:system-ui,"Segoe UI",Tahoma,"Noto Sans Arabic","Hiragino Sans","Yu Gothic","Meiryo","Noto Sans JP",sans-serif!important}

/* ---------- script fallbacks ----------
   i18n.js adds @font-face rules that extend every game font (Bangers, Fredoka, WackBubble, DripDisplay, DripRead…)
   with bold system Arabic / Japanese faces via unicode-range. These stacks cover plain Arial / system text. */
html[lang=ar]{--i18n-script:"Noto Sans Arabic","Segoe UI","Tahoma","Geeza Pro",sans-serif}
html[lang=ja]{--i18n-script:"Hiragino Sans","Hiragino Kaku Gothic ProN","Yu Gothic","Meiryo","Noto Sans JP",sans-serif}
html[lang=ar] body,html[lang=ja] body{font-family:Arial,var(--i18n-script)}
html[lang=ar] :is(input,select,textarea,button),html[lang=ja] :is(input,select,textarea,button){font-family:inherit}

/* Arabic letters must join: never space them apart, give diacritics room, no fake italics */
html[lang=ar] *{letter-spacing:0!important}
html[lang=ar] :is(h1,h2,h3,h4,.brand-title,.acct-title,.callout,.combo,.eyebrow,button){line-height:1.3}
html[lang=ar] :is(em,i){font-style:normal}
/* Japanese: tight negative tracking from the Latin display fonts overlaps kana; slanted CJK looks wrong */
html[lang=ja] :is(h1,h2,h3,h4,.brand-title,.acct-title,.callout,.combo){letter-spacing:0!important}
html[lang=ja] :is(em,i){font-style:normal}
html[lang=ja]{line-break:strict;word-break:normal;overflow-wrap:anywhere}

/* ---------- right to left ---------- */
/* <html dir=rtl> flips flex/grid rows, lists and inline text by itself. Text that mixes Arabic with Latin names or
   numbers gets its own direction from its first strong letter, so "MOTE وصل" and "وصل MOTE" both read right. */
html[dir=rtl] :is(p,li,label,small,span,strong,b,em,h1,h2,h3,h4,dt,dd,td,th,figcaption,blockquote,option,.settings-hint,.acct-note,.acct-fine,.toast,[role=status],[aria-live]){unicode-bidi:plaintext}
html[dir=rtl] :is(input,textarea){unicode-bidi:plaintext;text-align:start}
/* numbers, timers and scores stay left-to-right inside RTL text */
html[dir=rtl] :is(output,time,progress,.health-number,#timer,.timer,.score,.count,.price,kbd,code){direction:ltr;unicode-bidi:isolate}
/* the game HUD (health bars, minimap, timer, touch controls) keeps its physical layout; only its text is RTL */
html[dir=rtl] :is(.hud,.fighter-hud,.round-hud,.touch-controls,.adv-map-wrap,canvas){direction:ltr}
html[dir=rtl] :is(.hud,.fighter-hud,.round-hud) :is(strong,span,small,b){direction:rtl;unicode-bidi:plaintext}
html[dir=rtl] :is(.settings-panel,.overlay,.acct-card,dialog,[role=dialog],.lang-menu){text-align:start}
/* arrows that point "forward"/"back" in Latin layouts */
html[dir=rtl] :is(.chev,.arrow,.next-arrow){transform:scaleX(-1)}

/* ---------- text expansion (Spanish runs ~30% longer; Arabic and Japanese are shorter but taller) ---------- */
html:not([lang=en]) :is(button,[role=tab],.chip,.pill,.tab,.badge,.tag){overflow-wrap:anywhere;hyphens:auto;min-width:0;max-width:100%}
html:not([lang=en]) :is(button,[role=tab]){white-space:normal;line-height:1.15}
html:not([lang=en]) :is(.setting-label label,.settings-hint,.acct-note,.acct-fine,p,li){overflow-wrap:anywhere;hyphens:auto}
html[lang=es] :is(h1,h2,h3,.brand-title,.acct-title){overflow-wrap:anywhere;hyphens:auto}
html[lang=es] .acct-tabs button,html[lang=es] .brand-tabs button{font-size:clamp(12px,3.4vw,17px)!important}
