.yb-region-language[hidden],
body > .yb-language-switcher,
.yb-language-switcher[hidden] { display: none !important; }
[data-yb-language-slot] { flex: 1 1 180px; min-width: 0; }
.yb-language-switcher {
  position: static;
  width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  box-shadow: none;
  font-size: 14px;
}
.yb-language-switcher select {
  display: block;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  min-height: 44px;
  margin: 0;
  padding: 8px 30px 8px 10px;
  border: 1px solid #739eb4;
  border-radius: 2px;
  background-color: #fff;
  color: #123957;
  color-scheme: light;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.yb-language-switcher select:focus-visible { outline: 2px solid #1486c9; outline-offset: 2px; }
.yb-language-switcher [data-yb-language-status]:not(:empty) {
  display: block;
  padding: 6px 0 0;
  line-height: 1.5;
  overflow-wrap: anywhere;
}
#yuyi-right-menu-drawer .yb-language-switcher select:focus-visible { outline-color: #ffe185; }
@media print { .yb-region-language, .yb-language-switcher { display: none !important; } }

@media (max-width:1089px) {
  #yuyi-right-menu-drawer .yb-right-region-settings {
    display: grid;
    grid-template-columns: minmax(0,.85fr) minmax(0,1.15fr);
    gap: 10px;
    margin: 0 8px;
    padding: 6px 0;
    border-bottom: 1px solid #9edbec35;
  }
  #easystore-section-header #yuyi-right-menu-drawer .yb-right-region-settings > .yuyi-right-drawer-topbar {
    display: grid;
    grid-template-columns: auto minmax(0,1fr);
    align-items: center;
    gap: 6px;
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
  }
  #yuyi-right-menu-drawer .yb-right-region-settings .currency-label {
    font-size: 12px;
    line-height: 1.2;
    white-space: nowrap;
  }
  #yuyi-right-menu-drawer .yb-right-region-settings :is(.yuyi-right-currency-select,[data-yb-language-slot]) {
    min-width: 0;
    width: 100%;
    flex: 1 1 auto;
  }
  #easystore-section-header #yuyi-right-menu-drawer .yb-right-region-settings select {
    width: 100%;
    min-width: 0;
    height: 36px;
    min-height: 36px;
    padding: 4px 20px 4px 6px;
    font-size: 13px;
    line-height: 1.2;
    text-overflow: ellipsis;
  }
}

/* Shared foreign-language text flow. The Traditional Chinese layout is unchanged. */
html[data-yb-i18n-language]:not([data-yb-i18n-language="zh-Hant"]) body {
  overflow-wrap: anywhere;
}
html[data-yb-i18n-language]:not([data-yb-i18n-language="zh-Hant"]) :is(h1,h2,h3,h4,h5,h6,p,li,dt,dd,label,summary,th,td,.button,.btn,.rte,[class$="__title"],[class$="-title"],[class$="-label"],[class$="-text"]) {
  overflow-wrap: anywhere;
  word-break: normal;
  white-space: normal !important;
}
/* Flexible children must be allowed to shrink inside their existing column. */
html[data-yb-i18n-language]:not([data-yb-i18n-language="zh-Hant"]) :is(.grid__item,.card__content,.card__information,.rte,.product__info-wrapper,.product__info-container,.yb-quest-caption,.yb-quest-dialog,.ybm-title,.yuyi-menu-label,.product_upsell-text) {
  min-width: 0;
}
/* Text actions grow vertically; native fields and icon-only controls keep their size. */
html[data-yb-i18n-language]:not([data-yb-i18n-language="zh-Hant"]) :is(.button,.btn,button:not([aria-label]):not(:has(svg,img))):not(input):not(.quantity__button):not(.yb-qty-btn):not(.slider-button):not(.header__icon):not(.modal__close-button):not(.yb-product-choice-cover__open):not([data-yb-i18n-fixed]) {
  min-width: 0;
  max-width: 100%;
  height: auto !important;
  white-space: normal !important;
  overflow-wrap: anywhere;
  line-height: 1.4;
}
html[data-yb-i18n-language]:not([data-yb-i18n-language="zh-Hant"]) :is(.menu-drawer__menu-item,.yuyi-drill__items a,.yuyi-drill__items button,.breadcrumb a,.yb-member-back,.yb-reviews-view-all,.yb-welcome-choices a,.yb-menu-context strong,.yb-menu-context span) {
  min-width: 0;
  max-width: 100%;
  height: auto;
  white-space: normal !important;
  overflow-wrap: anywhere;
}
/* A typewriter's invisible spacer and visible overlay must use the same line breaks. */
html[data-yb-i18n-language]:not([data-yb-i18n-language="zh-Hant"]) [data-yb-typewriter] {
  min-width: 0;
  max-width: 100%;
  height: auto !important;
  white-space: normal !important;
  overflow-wrap: anywhere;
}
html[data-yb-i18n-language]:not([data-yb-i18n-language="zh-Hant"]) [data-yb-typewriter] :is(.yb-typewriter__space,.yb-typewriter__typed) {
  white-space: inherit;
  overflow-wrap: inherit;
  word-break: inherit;
}
html[data-yb-i18n-language]:not([data-yb-i18n-language="zh-Hant"]) [data-yb-typewriter] .yb-typewriter__letter {
  display: inline;
}
/* Dialog titles take the remaining width; the close action keeps its own column. */
html[data-yb-i18n-language]:not([data-yb-i18n-language="zh-Hant"]) :is(.ybm-head,.cart-notification__header,.yb-notify-head,.yb-catalog-dialog__heading) {
  min-width: 0;
  height: auto;
  align-items: flex-start;
  gap: 12px;
}

/* Public labels drawn by CSS use the same dictionary as real text nodes. */
html[data-yb-i18n-language] #yb-article-top .yb-article-author::before { content: var(--yb-i18n-author,"作者 ") !important; }
html[data-yb-i18n-language] .yb-game-theme .customer:is(.login,.yb-account-auth):not(.yb-account-challenge) > .card::before { content: var(--yb-i18n-login,"登入") !important; }
html[data-yb-i18n-language] .yb-game-theme .customer:is(.login,.yb-account-auth):has(#tab-register:checked) > .card::before { content: var(--yb-i18n-register,"註冊") !important; }
html[data-yb-i18n-language] .yb-game-theme .customer.yb-account-auth[data-yb-login-mode="recover"] > .card::before { content: var(--yb-i18n-reset-password,"重設密碼") !important; }
html[data-yb-i18n-language] .yb-game-theme .customer.yb-account-auth[data-yb-login-mode="setup"] > .card::before { content: var(--yb-i18n-finish-registration,"完成註冊") !important; }
html[data-yb-i18n-language] .yb-game-theme .customer.yb-account-auth[data-yb-login-mode="verify"] > .card::before { content: var(--yb-i18n-enter-verification-code,"輸入驗證碼") !important; }
html[data-yb-i18n-language] .price-field.yb-pending::after { content: var(--yb-i18n-select-option,"請先選擇規格") !important; }
html[data-yb-i18n-language]:not([data-yb-i18n-language="zh-Hant"]) :is(.ybm-title,.cart-notification__heading,.yb-notify-head-title,.yb-catalog-dialog__heading > div) {
  flex: 1 1 0;
  min-width: 0;
  white-space: normal !important;
  overflow-wrap: anywhere;
}
html[data-yb-i18n-language]:not([data-yb-i18n-language="zh-Hant"]) :is(.ybm-close,.yb-notify-readall,.cart-notification__close,.yb-catalog-dialog__heading > button) {
  flex: 0 0 auto;
}
html[data-yb-i18n-language]:not([data-yb-i18n-language="zh-Hant"]) .ybm-close {
  max-width: 45%;
  height: auto;
  white-space: normal !important;
  overflow-wrap: anywhere;
}
/* Decorative dialog tabs enter the flow when a translation needs multiple lines. */
html[data-yb-i18n-language]:not([data-yb-i18n-language="zh-Hant"]) .ybm-label {
  position: relative;
  top: auto;
  left: auto;
  align-self: flex-start;
  flex: 0 0 auto;
  max-width: 100%;
  margin: -12px 0 14px;
  white-space: normal;
  overflow-wrap: anywhere;
}
html[data-yb-i18n-language]:not([data-yb-i18n-language="zh-Hant"]) :is(.ybm-body,.rte,.fr-view) {
  min-width: 0;
  overflow-wrap: anywhere;
}
html[data-yb-i18n-language]:not([data-yb-i18n-language="zh-Hant"]) :is(.ybm-body,.rte,.fr-view) img {
  max-width: 100% !important;
  height: auto !important;
}
/* Imported rich text stays within its container in every language. */
html :is(.ybm-body,.rte,.fr-view) :is(div,p,span)[style*="width"] {
  min-width: 0 !important;
  max-width: 100% !important;
  box-sizing: border-box;
}
html :is(.ybm-body,.rte,.fr-view) :is(div,p,span)[style*="white-space"] {
  white-space: normal !important;
  overflow-wrap: anywhere;
}
/* Illustrated purchase notices use the same wrapping and action width in every language. */
html .yb-r18-overlay { touch-action: pan-y; }
html .yb-r18-overlay .yb-r18-card .yb-r18-textbox {
  max-height: 58%;
  padding-inline: 1cqw;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  touch-action: pan-y;
  font-size: clamp(13px,4.2cqw,20px);
}
html .yb-r18-overlay .yb-r18-card :is(.yb-r18-line,.yb-r18-link) {
  white-space: normal;
  overflow-wrap: break-word;
}
html .yb-r18-overlay .yb-r18-card .yb-r18-actions {
  left: 46%;
  width: 51%;
  transform: none;
  white-space: normal;
}
html .yb-r18-overlay .yb-r18-card .yb-r18-actions .yb-r18-btn {
  display: block;
  box-sizing: border-box;
  width: 100%;
  padding: 3.4cqw 2cqw;
  font-size: clamp(12px,4.4cqw,20px);
  white-space: normal;
  overflow-wrap: normal;
  word-break: normal;
}
html .yb-r18-overlay .yb-r18-card .yb-r18-btn::after { white-space: nowrap; }
/* The containers and labels in a shared text row grow together. */
html[data-yb-i18n-language]:not([data-yb-i18n-language="zh-Hant"]) :is(.yb-search__recent,.yb-catalog__state,.yb-menu-context) {
  min-width: 0;
  max-width: 100%;
  height: auto;
  white-space: normal !important;
  overflow-wrap: anywhere;
}
html[data-yb-i18n-language]:not([data-yb-i18n-language="zh-Hant"]) .yb-search__recent { min-height: 36px; align-items: flex-start; }
html[data-yb-i18n-language]:not([data-yb-i18n-language="zh-Hant"]) :is(.yb-catalog__toolbar,.yb-catalog__state,.yb-menu-context) { flex-wrap: wrap; }
html[data-yb-i18n-language]:not([data-yb-i18n-language="zh-Hant"]) .yb-catalog__state { flex-shrink: 1; }
html[data-yb-i18n-language]:not([data-yb-i18n-language="zh-Hant"]) .yb-menu-context strong { overflow: visible; text-overflow: clip; }
/* Long Latin menu titles own a full row instead of the leftover flex width. */
@media (max-width:1089px) {
  html:is([data-yb-i18n-language="en"],[data-yb-i18n-language="ms"]) :is(#easystore-section-header,.yb-world-turn-source-header) #menu-drawer .yb-menu-context:not(.yb-menu-context--root) {
    display: grid;
    grid-template-columns: minmax(0,1fr) auto;
    grid-template-areas: "location back" "title title";
    gap: 8px 12px;
  }
  html:is([data-yb-i18n-language="en"],[data-yb-i18n-language="ms"]) #menu-drawer .yb-menu-context > span { grid-area: location; }
  html:is([data-yb-i18n-language="en"],[data-yb-i18n-language="ms"]) #menu-drawer .yb-menu-context > strong { grid-area: title; }
  html:is([data-yb-i18n-language="en"],[data-yb-i18n-language="ms"]) #menu-drawer .yb-menu-context > .menu-drawer__close-button { grid-area: back; }
}
/* Mobile Latin headings reserve a separate row for the return action. */
@media (max-width:640px) {
  html:is([data-yb-i18n-language="en"],[data-yb-i18n-language="ms"]) :is(.yb-cart-heading,.yb-lobby-heading) {
    grid-template-columns: 40px minmax(0,1fr);
  }
  html:is([data-yb-i18n-language="en"],[data-yb-i18n-language="ms"]) :is(.yb-cart-news-back,.yb-account-news-back) {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-self: end;
  }
  html:is([data-yb-i18n-language="en"],[data-yb-i18n-language="ms"]) :is(#easystore-section-header,.yb-world-turn-source-header) .yb-notify-head {
    display: grid;
    grid-template-columns: minmax(0,1fr);
  }
  html:is([data-yb-i18n-language="en"],[data-yb-i18n-language="ms"]) :is(#easystore-section-header,.yb-world-turn-source-header) .yb-notify-readall {
    justify-self: end;
    max-width: 100%;
  }
  html:is([data-yb-i18n-language="en"],[data-yb-i18n-language="ms"]) #yb-info-page #yb-help-quest .yhq-archive-nav.yb-game-filters {
    grid-template-columns: minmax(0,1fr);
  }
  html:is([data-yb-i18n-language="en"],[data-yb-i18n-language="ms"]) #yb-info-page #yb-help-quest .yhq-archive-nav.yb-game-filters > a.yb-game-filter {
    flex-direction: row;
  }
  html:is([data-yb-i18n-language="en"],[data-yb-i18n-language="ms"]) #yb-info-page #yb-help-quest .yhq-archive-label {
    display: grid;
    grid-template-columns: auto minmax(0,1fr) auto;
    flex: 1 1 0;
    min-width: 0;
    gap: 8px;
    text-align: left;
  }
  html:is([data-yb-i18n-language="en"],[data-yb-i18n-language="ms"]) .yb-lobby__scene-controls {
    width: min(150px,calc(100vw - 32px));
  }
  html:is([data-yb-i18n-language="en"],[data-yb-i18n-language="ms"]) .yb-lobby__scene-controls > button[data-yb-view-mode] {
    width: 140px;
    height: auto;
    min-height: 44px;
    white-space: normal;
  }
  html:is([data-yb-i18n-language="en"],[data-yb-i18n-language="ms"]) [data-yb-view-label] {
    min-width: 0;
    max-width: 100%;
    white-space: normal;
    overflow-wrap: break-word;
  }
  html:is([data-yb-i18n-language="en"],[data-yb-i18n-language="ms"]) :is(.yb-float,.yb-float__compact) {
    width: 140px;
    height: 104px;
  }
  html:is([data-yb-i18n-language="en"],[data-yb-i18n-language="ms"]) .yb-float__portrait {
    left: calc(50% - 36px);
    right: auto;
  }
  /* Translated lobby content flows vertically instead of using fixed scene coordinates. */
  html:is([data-yb-i18n-language="en"],[data-yb-i18n-language="ms"]) .yb-lobby {
    grid-template-columns: minmax(0,1fr);
    grid-template-rows: repeat(5,auto);
    gap: 16px;
    padding-top: 240px;
  }
  html:is([data-yb-i18n-language="en"],[data-yb-i18n-language="ms"]) .yb-lobby > :is(.yb-lobby__welcome,.yb-lobby__social,.yb-lobby__missions,.yb-lobby__dock,.yb-lobby__notice) {
    position: relative;
    inset: auto;
    grid-column: 1;
    width: calc(100% - 32px);
    max-width: none;
    margin: 0 auto;
  }
  html:is([data-yb-i18n-language="en"],[data-yb-i18n-language="ms"]) .yb-lobby__welcome { grid-row: 1; }
  html:is([data-yb-i18n-language="en"],[data-yb-i18n-language="ms"]) .yb-lobby__social {
    grid-row: 2;
    grid-template-columns: repeat(2,minmax(0,1fr));
  }
  html:is([data-yb-i18n-language="en"],[data-yb-i18n-language="ms"]) .yb-lobby__missions {
    grid-row: 3;
    grid-template-columns: minmax(0,1fr);
  }
  html:is([data-yb-i18n-language="en"],[data-yb-i18n-language="ms"]) .yb-lobby__dock {
    grid-row: 4;
    grid-template-columns: repeat(3,minmax(0,1fr));
    gap: 12px 8px;
    height: auto;
  }
  html:is([data-yb-i18n-language="en"],[data-yb-i18n-language="ms"]) .yb-lobby__notice { grid-row: 5; }
  html:is([data-yb-i18n-language="en"],[data-yb-i18n-language="ms"]) .yb-lobby__dock > a {
    white-space: normal;
    overflow-wrap: break-word;
    font-size: 12px;
  }
  html:is([data-yb-i18n-language="en"],[data-yb-i18n-language="ms"]) .yb-lobby__dock > a > span:last-child {
    width: 100%;
    min-width: 0;
  }
}
@media (max-width:620px) {
  html:is([data-yb-i18n-language="en"],[data-yb-i18n-language="ms"]) #ybXmb .yb-xmb-row {
    grid-template-columns: repeat(2,minmax(0,1fr));
  }
}
/* The existing four-column header reserves the logo, search and action tiles. */
@media (min-width: 1090px) {
  html[data-yb-i18n-language]:not([data-yb-i18n-language="zh-Hant"]) :is(#easystore-section-header,.yb-world-turn-source-header) .header {
    grid-template-rows: auto;
  }
  html[data-yb-i18n-language]:not([data-yb-i18n-language="zh-Hant"]) :is(#easystore-section-header,.yb-world-turn-source-header) .header__inline-menu {
    width: 100%;
    min-width: 0;
    max-width: 100%;
  }
  html[data-yb-i18n-language]:not([data-yb-i18n-language="zh-Hant"]) :is(#easystore-section-header,.yb-world-turn-source-header) .header__inline-menu > ul {
    min-width: 0;
    width: 100%;
    align-items: stretch;
  }
  html[data-yb-i18n-language]:not([data-yb-i18n-language="zh-Hant"]) :is(#easystore-section-header,.yb-world-turn-source-header) .header__inline-menu > ul > li {
    flex: 1 1 0;
    min-width: 0;
  }
  html[data-yb-i18n-language]:not([data-yb-i18n-language="zh-Hant"]) :is(#easystore-section-header,.yb-world-turn-source-header) .header__inline-menu > ul > li > a,
  html[data-yb-i18n-language]:not([data-yb-i18n-language="zh-Hant"]) :is(#easystore-section-header,.yb-world-turn-source-header) .header__inline-menu > ul > li > details-disclosure > details > summary {
    min-width: 0;
    width: 100%;
    min-height: 48px;
    height: auto;
    padding-block: 8px;
    white-space: normal !important;
    overflow-wrap: anywhere;
    transform: none;
  }
  html[data-yb-i18n-language]:not([data-yb-i18n-language="zh-Hant"]) :is(#easystore-section-header,.yb-world-turn-source-header) .header__inline-menu .yuyi-menu-label {
    min-width: 0;
    white-space: normal;
    overflow-wrap: anywhere;
  }
  html[data-yb-i18n-language]:not([data-yb-i18n-language="zh-Hant"]) :is(#easystore-section-header,.yb-world-turn-source-header) .header__inline-menu .icon-caret {
    flex: 0 0 auto;
  }
  html[data-yb-i18n-language]:not([data-yb-i18n-language="zh-Hant"]) :is(#easystore-section-header,.yb-world-turn-source-header) .header__icons {
    flex-shrink: 0;
    min-width: max-content;
  }
}

html[data-yb-i18n-language] .template-point-history #MainContent .yb-points-heading h1::after { content: var(--yb-i18n-points-history-description,"查看每筆 Y幣的增減與紀錄。") !important; }
