/* Per-language type fixes for js/i18n.js. The brand faces (Archivo Black, Chakra Petch, JetBrains Mono) carry Latin
   only (Archivo, the body face, too; Russian takes the device sans), so Chinese, Japanese, Arabic and Russian fall back to the device's own fonts:
   PingFang / Hiragino / Geeza on Apple, Noto on Android, Microsoft YaHei / Yu Gothic / Segoe UI on Windows. */
:root:lang(zh){--font-ui:"Archivo","PingFang SC","Hiragino Sans GB","Noto Sans CJK SC","Microsoft YaHei",sans-serif;
  --font-display:"Archivo Black","PingFang SC","Noto Sans CJK SC","Microsoft YaHei",sans-serif;
  --font-game:"Chakra Petch","PingFang SC","Noto Sans CJK SC","Microsoft YaHei",sans-serif;
  --font-mono:"JetBrains Mono","PingFang SC","Noto Sans CJK SC","Microsoft YaHei",monospace}
:root:lang(ja){--font-ui:"Archivo","Hiragino Sans","Hiragino Kaku Gothic ProN","Noto Sans CJK JP","Yu Gothic",sans-serif;
  --font-display:"Archivo Black","Hiragino Sans","Noto Sans CJK JP","Yu Gothic",sans-serif;
  --font-game:"Chakra Petch","Hiragino Sans","Noto Sans CJK JP","Yu Gothic",sans-serif;
  --font-mono:"JetBrains Mono","Hiragino Sans","Noto Sans CJK JP","Yu Gothic",monospace}
:root:lang(ar){--font-ui:"Geeza Pro","Noto Sans Arabic","Segoe UI",Tahoma,sans-serif;
  --font-display:"Geeza Pro","Noto Sans Arabic","Segoe UI",Tahoma,sans-serif;
  --font-game:"Geeza Pro","Noto Sans Arabic","Segoe UI",Tahoma,sans-serif;
  --font-mono:"Geeza Pro","Noto Sans Arabic","Segoe UI",Tahoma,sans-serif}

/* Arabic letters join; letter spacing pulls them apart, and the faux italic slants them the wrong way */
:root:lang(ar) *{letter-spacing:0 !important;font-style:normal !important}
/* CJK has no italics or capitals; keep the weight, drop the slant and the tracking that suits Latin capitals */
:root:lang(zh) *, :root:lang(ja) *{font-style:normal !important;letter-spacing:.02em !important}

/* Right to left: panels, cards and lists read from the right. The play field stays a map, so the in-round HUD rows,
   the power-up bank and the dash/pause buttons keep their screen positions (thumb reach is set by the hand control,
   not by the language); only their text is mirrored. */
:root[dir="rtl"] .panel,:root[dir="rtl"] .veil{text-align:right}
:root[dir="rtl"] #hud,:root[dir="rtl"] #bankWrap,:root[dir="rtl"] #bagbar,:root[dir="rtl"] #buffs,
:root[dir="rtl"] #combo,:root[dir="rtl"] #reactorArrow,:root[dir="rtl"] #ready,:root[dir="rtl"] #count{direction:ltr}
:root[dir="rtl"] #hud small,:root[dir="rtl"] #hud b,:root[dir="rtl"] #bagbar .lab,:root[dir="rtl"] #toast,:root[dir="rtl"] #tut .tutbody{direction:rtl;unicode-bidi:plaintext}
:root[dir="rtl"] .panel .x{left:10px;right:auto}
/* numbers, RP amounts and ranks keep their digits in order inside Arabic sentences */
:root[dir="rtl"] .stat b,:root[dir="rtl"] .herostat b,:root[dir="rtl"] .gearstats b,:root[dir="rtl"] .fuelpill,:root[dir="rtl"] .buy{unicode-bidi:isolate}
:root[dir="rtl"] input[type="email"]{direction:ltr;text-align:right}
/* Julian's verbatim lines stay in English: they set their own direction, so the full stop lands at the end */
:root[dir="rtl"] .fact,:root[dir="rtl"] .src,:root[dir="rtl"] .credit{unicode-bidi:plaintext}

/* longer words in German-length languages (fr, pt, ru, it, tr, es): buttons may wrap instead of overflowing */
:root:not(:lang(en)) .go,:root:not(:lang(en)) .alt,:root:not(:lang(en)) .buy{white-space:normal;overflow-wrap:anywhere;hyphens:auto}
