/* Locale-specific typography; numbers retain the project's Inter font. */
html[lang="zh-Hant"] {
  --sans: "Inter Variable", Inter, "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", sans-serif;
  --stock-font-product: "Inter Variable", Inter, "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", sans-serif;
}
html[lang="ja"] {
  --sans: "Inter Variable", Inter, "Noto Sans JP", "Yu Gothic", Meiryo, sans-serif;
  --stock-font-product: var(--sans);
}
html[lang="ko"] {
  --sans: "Inter Variable", Inter, "Noto Sans KR", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  --stock-font-product: var(--sans);
}
html:is([lang="zh-Hant"], [lang="ja"], [lang="ko"]) :is(body, button, input, select, textarea) {
  font-family: var(--sans);
}
html:is([lang="zh-Hant"], [lang="ja"], [lang="ko"]) :is(h1, h2, h3, .stock-hero-kicker, .copy-overline) {
  letter-spacing: 0;
  word-break: normal;
  line-break: strict;
}
html[lang="zh-Hant"] p { line-height: 1.7; }
html[lang="zh-Hant"] .stock-hero h1 { line-height: 1.13; }
html[lang="zh-Hant"] .stock-nav a span { white-space: nowrap; }
html[lang="zh-Hant"] .stock-menu-card a { line-height: 1.55; }
html[lang="ja"] p { line-height: 1.75; line-break: strict; }
html[lang="ko"] :is(p, h1, h2, h3, button, label) { word-break: keep-all; overflow-wrap: anywhere; }
html[lang="ko"] p { line-height: 1.7; }
html:is([lang="ja"], [lang="ko"]) .stock-page-head h1 { font-size: 28px; line-height: 1.3; }
html[lang="ja"] .stock-hero h1 { font-size: 34px; line-height: 1.35; }
html[lang="ko"] .stock-hero h1 { font-size: 36px; line-height: 1.25; }
html:is([lang="ja"], [lang="ko"]) .stock-page-head > div { min-width: 0; }
html:is([lang="ja"], [lang="ko"]) .stock-section-head h2 { font-size: 18px; line-height: 1.45; }
html:is([lang="ja"], [lang="ko"]) .stock-page-home .stock-quick-grid .stock-tile {
  height: 116px;
  min-height: 116px;
  max-height: none;
  justify-content: flex-start;
}
html:is([lang="ja"], [lang="ko"]) .stock-page-home .stock-tile-copy { width: 100%; }
html:is([lang="ja"], [lang="ko"]) .stock-page-home .stock-tile-copy b {
  padding: 0;
  font-size: 14px;
  line-height: 1.5;
  white-space: normal;
  overflow: visible;
}
html:is([lang="ja"], [lang="ko"]) .stock-page-home .stock-tile-copy small {
  font-size: 10px;
  line-height: 1.5;
  white-space: normal;
  overflow: visible;
  display: block;
}
html:is([lang="ja"], [lang="ko"]) .stock-page-home .stock-tile-art { width: 48px; height: 30px; bottom: 10px; }
/* Only the current tab carries a visible caption in the project's compact nav. */
html:is([lang="zh-Hant"], [lang="ja"], [lang="ko"]) .stock-nav a.on { font-size: 12.5px; font-weight: 700; white-space: nowrap; }
html:is([lang="zh-Hant"], [lang="ja"], [lang="ko"]) .stock-nav a:not(.on) span { font-size: 0; }
html:is([lang="ja"], [lang="ko"]) .copy-mobilebar h1 { font-size: 20px; line-height: 1.4; }
html:is([lang="ja"], [lang="ko"]) .copy-heading p { font-size: 12px; line-height: 1.7; }
html:is([lang="ja"], [lang="ko"]) .copy-metrics .metric small { min-height: 33px; line-height: 1.5; }
html:is([lang="ja"], [lang="ko"]) .copy-metrics .metric strong { font-size: 19px; }
html:is([lang="ja"], [lang="ko"]) .copy-metrics .metric .copy-time { font-size: 13px; line-height: 1.5; letter-spacing: 0; white-space: nowrap; }
html:is([lang="ja"], [lang="ko"]) .copy-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
html:is([lang="ja"], [lang="ko"]) .wallet-actions .btn { font-size: 11px; padding-inline: 9px; white-space: nowrap; }
html:is([lang="ja"], [lang="ko"]) dialog h2 { font-size: 20px; line-height: 1.45; }
html:is([lang="ja"], [lang="ko"]) .dialog-metrics .metric small { line-height: 1.55; }
html:is([lang="ja"], [lang="ko"]) .ct-metrics small { font-size: 9px; line-height: 1.5; min-height: 1.5em; white-space: nowrap; }
html:is([lang="ja"], [lang="ko"]) .ct-tag { display: flex; align-items: center; justify-content: center; min-height: 2.8em; font-size: 9px; line-height: 1.4; }
html:is([lang="ja"], [lang="ko"]) .ranking-toolbar { display: flex; flex-direction: column; align-items: stretch; gap: 8px; }
html:is([lang="ja"], [lang="ko"]) .ranking-toolbar small { text-align: left; line-height: 1.6; font-size: 10px; }
/* CJK account overview uses one heading row with the same gutters as its cards. */
html:is([lang="zh-Hant"], [lang="ja"], [lang="ko"]) .stock-asset-position-groups { width: calc(100% - 8px); margin-inline: 4px; }
html:is([lang="zh-Hant"], [lang="ja"], [lang="ko"]) .stock-asset-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 24px 4px 12px;
  min-width: 0;
}
html:is([lang="zh-Hant"], [lang="ja"], [lang="ko"]) .stock-asset-section-head > div { min-width: 0; }
html:is([lang="zh-Hant"], [lang="ja"], [lang="ko"]) .stock-asset-section-head > div > span { display: none; }
html:is([lang="zh-Hant"], [lang="ja"], [lang="ko"]) .stock-asset-section-head h2 {
  font-size: 19px;
  line-height: 1.45;
  font-weight: 700;
  letter-spacing: .015em;
}
html:is([lang="zh-Hant"], [lang="ja"], [lang="ko"]) .stock-asset-section-head > small {
  flex: 0 0 auto;
  font-size: 12px;
  line-height: 1.5;
  font-weight: 500;
  letter-spacing: 0;
  white-space: nowrap;
}
html[lang="ja"] .stock-asset-section-head h2 { font-size: 18px; letter-spacing: 0; }
html[lang="ko"] .stock-asset-section-head h2 { font-size: 20px; letter-spacing: -.015em; }
html:is([lang="ja"], [lang="ko"]) .stock-page-assets .stock-asset-group-title { min-width: 0; gap: 8px; }
html:is([lang="ja"], [lang="ko"]) .stock-page-assets .stock-asset-group-title > b { font-size: 14px; line-height: 1.5; white-space: normal; }
html:is([lang="ja"], [lang="ko"]) .stock-asset-group-totals { flex-shrink: 0; white-space: nowrap; }
@media (max-width: 430px) {
  html[lang="zh-Hant"] .stock-section-head h2 { line-height: 1.4; }
  html[lang="zh-Hant"] .stock-hero-kicker { font-size: 12px; }
}

/* Give the introduction its own full-width row, below title and language chip.
   It must not inherit the narrow English wallet column or a two-line crop. */
.stock-page-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  column-gap: 12px;
  row-gap: 8px;
  align-items: end;
}
.stock-page-head > .stock-page-head-actions { margin: 0 0 1px; align-self: end; }
.stock-page .stock-page-head > p {
  display: block;
  grid-column: 1 / -1;
  max-width: none;
  margin: 0;
  overflow: visible;
  -webkit-line-clamp: unset;
  text-wrap: pretty;
}
html:is([lang="zh-Hant"], [lang="ja"], [lang="ko"]) .stock-page-head h1 {
  font-size: 28px;
  line-height: 1.25;
  font-weight: 700;
  letter-spacing: 0;
}
html:is([lang="zh-Hant"], [lang="ja"], [lang="ko"]) :is(.stock-page-head > p, .stock-account-head-copy > p, .stock-hero-copy > p) {
  font-size: 13px;
  line-height: 1.65;
  text-wrap: balance;
  overflow-wrap: break-word;
}
html:is([lang="zh-Hant"], [lang="ja"], [lang="ko"]) :is(.stock-section-head h2, .copy-heading h2, .ranking-toolbar h2) {
  font-size: 18px;
  line-height: 1.4;
  font-weight: 700;
  text-wrap: balance;
}
html:is([lang="zh-Hant"], [lang="ja"], [lang="ko"]) :is(.stock-account-head-copy h1, .stock-strategy-purchase h2, dialog h2) {
  line-height: 1.35;
  letter-spacing: 0;
  text-wrap: balance;
}
/* Action labels need optical weight and breathing room, not heavier numbers. */
html:is([lang="zh-Hant"], [lang="ja"], [lang="ko"]) :is(.ct-card .ct-follow, .copy-app .row-action .btn) {
  font-size: 13.5px;
  font-weight: 700;
  letter-spacing: .025em;
  line-height: 1.25;
  gap: 6px;
}
html:is([lang="zh-Hant"], [lang="ja"], [lang="ko"]) .stock-copy-entry-cta {
  font-size: 12.5px;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: .015em;
  padding-inline: 13px;
  gap: 7px;
  min-height: 44px;
}
html:is([lang="zh-Hant"], [lang="ja"], [lang="ko"]) :is(.stock-hero-actions button, .stock-account-submit, .copy-actions .btn, .copy-app .btn.primary, dialog .btn.primary) {
  font-size: 13px;
  font-weight: 700;
  line-height: 1.45;
  letter-spacing: .01em;
}
html:is([lang="zh-Hant"], [lang="ja"], [lang="ko"]) :is(.stock-tile-copy b, .copy-switch .nav-link, .portfolio-tabs button, .stock-chips button) {
  font-weight: 700;
  letter-spacing: 0;
}
html:is([lang="zh-Hant"], [lang="ja"], [lang="ko"]) :is(.stock-empty-state p, .empty-state p, .copy-start-note, .copy-rules p, .copy-terms) {
  line-height: 1.65;
  text-wrap: pretty;
  word-break: normal;
}
html[lang="ko"] :is(.copy-start-note, .copy-rules p, .copy-terms, .ct-tag) { word-break: keep-all; }

/* Dense card metadata wraps at phrase boundaries; prose gets balanced lines. */
html:is([lang="zh-Hant"], [lang="ja"], [lang="ko"]) .ct-tag {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 2.9em;
  font-size: 10px;
  line-height: 1.45;
  word-break: keep-all;
  overflow-wrap: anywhere;
  text-wrap: balance;
}
html:is([lang="zh-Hant"], [lang="ja"], [lang="ko"]) .ranking-toolbar {
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
}
html:is([lang="zh-Hant"], [lang="ja"], [lang="ko"]) .ranking-toolbar h2 { flex: none; white-space: nowrap; }
html:is([lang="zh-Hant"], [lang="ja"], [lang="ko"]) .ranking-toolbar small { text-align: left; font-size: 10px; line-height: 1.6; }
html:is([lang="zh-Hant"], [lang="ja"], [lang="ko"]) .manager-row .identity p {
  white-space: normal;
  overflow: visible;
  word-break: normal;
  line-height: 1.55;
  text-wrap: balance;
}
html[lang="ko"] .manager-row .identity p { word-break: keep-all; }
html:is([lang="zh-Hant"], [lang="ja"], [lang="ko"]) .stock-strategy-purchase h1 {
  font-size: 26px;
  font-weight: 700;
  line-height: 1.4;
  letter-spacing: 0;
  text-wrap: balance;
}
html:is([lang="zh-Hant"], [lang="ja"], [lang="ko"]) :is(.stock-strategy-purchase > header p, .stock-account-form-status) {
  line-height: 1.65;
  text-wrap: balance;
}
html[lang="zh-Hant"] .stock-page-home .stock-quick-grid .stock-tile { height: 108px; min-height: 108px; max-height: none; }
html[lang="zh-Hant"] .stock-page-home .stock-tile-copy { width: 100%; }
html[lang="zh-Hant"] .stock-page-home .stock-tile-copy b { font-size: 15px; line-height: 1.4; }
html[lang="zh-Hant"] .stock-page-home .stock-tile-copy small { font-size: 10.5px; line-height: 1.5; white-space: normal; overflow: visible; }
html[lang="zh-Hant"] .stock-page-home .stock-tile-art { width: 48px; height: 30px; bottom: 10px; }
html:is([lang="zh-Hant"], [lang="ja"], [lang="ko"]) .stock-deposit-address code[data-ui-message] {
  font: 500 12px/1.65 var(--sans);
  text-wrap: pretty;
  word-break: normal;
}

/* One language control for Home, Markets, Invest and Assets. */
.stock-language-toggle,
.stock-top .stock-language-toggle,
.stock-page-head .stock-language-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  gap: 7px;
  width: auto;
  min-width: 106px;
  min-height: 44px;
  height: 44px;
  padding: 0 12px;
  border: 1px solid rgba(205, 242, 210, .2);
  border-radius: 999px;
  background: rgba(8, 20, 13, .8);
  color: #dce8d8;
  font: 600 12px/1.25 var(--sans);
  letter-spacing: 0;
  cursor: pointer;
  box-shadow: none;
}
.stock-top .stock-language-toggle { margin-left: auto; }
.stock-language-toggle::before,
.stock-page-head .stock-language-toggle::before { content: none; }
.stock-language-toggle > svg { flex: 0 0 16px; width: 16px; height: 16px; color: #b3caab; }
.stock-language-toggle > .stock-language-chevron { flex-basis: 12px; width: 12px; height: 12px; }
.stock-language-toggle > span,
.stock-page-head .stock-language-toggle > span {
  display: inline;
  width: auto;
  min-height: 0;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  color: inherit;
  letter-spacing: 0;
  text-transform: none;
  white-space: nowrap;
}
.stock-language-toggle:hover,
.stock-language-toggle[aria-expanded="true"] { border-color: #819e73; background: #17281b; }
.stock-language-toggle:focus-visible,
.stock-language-menu button:focus-visible { outline: 2px solid #b6f367; outline-offset: 3px; }
.stock-language-menu {
  position: fixed;
  inset: auto;
  margin: 0;
  box-sizing: border-box;
  width: 208px;
  max-width: calc(100vw - 24px);
  padding: 8px;
  border: 1px solid #38513c;
  border-radius: 18px;
  background: #111e16;
  color: #edf4e9;
  box-shadow: 0 14px 40px #0009;
  font-family: var(--sans);
}
.stock-language-menu::backdrop { background: transparent; }
.stock-language-menu > p { margin: 6px 12px 8px; font-size: 11px; font-weight: 500; color: #94aa91; line-height: 1.5; }
.stock-language-menu > button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: inherit;
  font: 500 13px/1.4 var(--sans);
  text-align: start;
  cursor: pointer;
}
.stock-language-menu button[lang="zh-Hant"] { font-family: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", sans-serif; }
.stock-language-menu button[lang="ja"] { font-family: "Noto Sans JP", "Yu Gothic", Meiryo, sans-serif; }
.stock-language-menu button[lang="ko"] { font-family: "Noto Sans KR", "Malgun Gothic", sans-serif; }
.stock-language-menu button:hover { background: #233627; }
.stock-language-menu button[aria-checked="true"] { background: #243b28; color: #c2f87d; font-weight: 700; }
.stock-language-menu button > svg { width: 16px; height: 16px; visibility: hidden; }
.stock-language-menu button[aria-checked="true"] > svg { visibility: visible; }

/* An order-book status is prose, not a price/quantity row. */
html:is([lang="zh-Hant"], [lang="ja"], [lang="ko"]) .stock-book [data-order-book-state="status"] {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  padding-block: 8px;
  overflow: visible;
}
html:is([lang="zh-Hant"], [lang="ja"], [lang="ko"]) .stock-book [data-order-book-state="status"] > span {
  white-space: normal;
  overflow: visible;
  line-height: 1.6;
  text-wrap: balance;
}

/* Loading/error messages must remain readable alongside fixed chart controls. */
.stock-chart-tool-row { flex-wrap: wrap; row-gap: 8px; }
.stock-chart-history-status {
  flex: 1 0 100%;
  order: 1;
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  line-height: 1.5;
  text-wrap: pretty;
}
html:is([lang="zh-Hant"], [lang="ja"], [lang="ko"]) .stock-strategy > div { min-width: 0; }
html:is([lang="zh-Hant"], [lang="ja"], [lang="ko"]) .stock-strategy b {
  white-space: normal;
  overflow-wrap: anywhere;
  line-height: 1.5;
}
html:is([lang="zh-Hant"], [lang="ja"], [lang="ko"]) .admin-identity {
  min-width: 0;
  white-space: normal;
  overflow-wrap: anywhere;
  line-height: 1.5;
}

/* Share the small-phone width between the name, sparkline and complete price.
   The earlier fixed chart lane clipped even short ticker symbols on Home. */
.stock-page-home .stock-home-market-card {
  grid-template-columns: minmax(0, 1fr) 48px 106px;
  column-gap: 6px;
  padding-inline: 10px;
}
.stock-page-home .stock-home-market-card .stock-market-leading {
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 8px;
}
.stock-page-home .stock-home-market-card .stock-icon { width: 38px; height: 38px; }
.stock-page-home .stock-home-market-card .stock-market-spark { width: 48px; }
.stock-page-home .stock-home-market-card .stock-name small {
  white-space: normal;
  overflow: visible;
  overflow-wrap: break-word;
}
html:is([lang="zh-Hant"], [lang="ja"], [lang="ko"]) .gh-wallet-copy {
  text-wrap: balance;
  line-height: 1.75;
}

/* English is also a supported locale: full status messages and short action
   descriptions should not retain the old narrow, single-line clipping. */
html[lang="en"] .stock-book [data-order-book-state="status"] {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  padding-block: 8px;
}
html[lang="en"] .stock-book [data-order-book-state="status"] > span,
html[lang="en"] .stock-strategy b,
html[lang="en"] .manager-row .identity p,
html[lang="en"] .stock-security-copy small,
html[lang="en"] .stock-page-home .stock-tile-copy :is(b, small) {
  white-space: normal;
  overflow: visible;
  line-height: 1.5;
  text-wrap: pretty;
}
html[lang="en"] .stock-page-home .stock-quick-grid .stock-tile {
  height: 116px;
  min-height: 116px;
  max-height: none;
  justify-content: flex-start;
}
html[lang="en"] .stock-page-home .stock-tile-copy { width: 100%; }
html[lang="en"] .stock-page-home .stock-tile-art { width: 48px; height: 30px; bottom: 10px; }

/* Position forms need room for translated options and native date controls. */
html .copy-admin-scope-row {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: start;
  gap: 16px 12px;
}
html .copy-admin-scope-row > label { min-width: 0; }
html .copy-admin-scope-row > label > span:first-child {
  display: flex;
  align-items: flex-end;
  min-height: 2.8em;
  line-height: 1.4;
}
html .copy-admin-scope-row :is(input, select, output) {
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}
html .copy-admin-scope-row select { font-size: 13px; padding-inline: 12px 30px; }
html .copy-admin-scope-row > label:has(input[type="datetime-local"]) { grid-column: span 2; }
html .copy-admin-scope-row > [data-copy-remove-row] {
  grid-column: 1 / -1;
  justify-self: end;
  min-width: 128px;
  min-height: 44px;
}
@media (max-width: 1000px) {
  html .copy-admin-scope-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  html .copy-admin-scope-row { grid-template-columns: minmax(0, 1fr); }
  html .copy-admin-scope-row > label:has(input[type="datetime-local"]) { grid-column: auto; }
  html .copy-admin-scope-row > label > span:first-child { min-height: 0; }
}
