.app-localizing body { visibility: hidden; }
.app-language-control { position: relative; }
.app-language-button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 34px; padding: 6px 11px; border: 1px solid rgba(var(--theme-text-warm-rgb), .2); border-radius: 999px; color: var(--theme-text-warm); background: linear-gradient(135deg,var(--theme-control-gradient-start),var(--theme-raised-surface)); font: inherit; font-size: .72rem; font-weight: 700; line-height: 1.3; white-space: nowrap; cursor: pointer; }
.app-language-button svg { flex: none; width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.app-language-name { display: none; }
.app-language-menu { position: fixed; z-index: 200; padding: 6px; overflow-y: auto; overscroll-behavior: contain; border: 1px solid rgba(var(--theme-text-warm-rgb), .16); border-radius: 12px; background: var(--theme-menu-background); box-shadow: 0 12px 36px rgba(var(--theme-shadow-rgb), .5); }
.app-language-menu[hidden] { display: none; }
.app-language-option { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 40px; padding: 9px; border: 0; border-radius: 7px; color: var(--theme-language-option-text); background: transparent; font: inherit; font-size: .81rem; text-align: start; cursor: pointer; }
.app-language-option > span { min-width: 45px; color: var(--theme-text-secondary); }
.app-language-option:hover,.app-language-option:focus-visible,.app-language-option[aria-selected="true"] { color: var(--theme-language-option-selected); background: rgba(var(--theme-accent-gold-soft-rgb), .16); }
.app-language-button:focus-visible { outline: 2px solid var(--theme-accent-gold-soft); outline-offset: 3px; }
@media (min-width:680px) {
  .app-language-videos { display: none; }
  .desktop-account-footer .app-language-button { justify-content: flex-start; width: 100%; min-height: 44px; height: auto; padding: 10px 14px; border-radius: 12px; }
  .desktop-account-footer .app-language-code { display: none; }
  .desktop-account-footer .app-language-name { display: inline; overflow: hidden; text-overflow: ellipsis; }
  body.standalone-bible:not(.episode-embedded-panel):not(.episode-mobile-embedded) .reading-header .reading-language { display: none; }
}
@media (max-width:679px) {
  .app-language-sidebar { display: none; }
  body.videos-page .videos-heading.social-header { grid-template-columns: minmax(0,1fr) auto auto; column-gap: 8px; direction: ltr; }
  .videos-heading .app-language-videos { justify-self: end; }
  /* Explicit line and bar heights prevent CJK fallback fonts from resizing
     navigation. Keep the taller CJK spacing in every language and theme. */
  body[data-bible-page] .bottom-nav {
    box-sizing: border-box;
    height: calc(54px + max(11px, env(safe-area-inset-bottom)));
    grid-template-rows: 42px;
  }
  body[data-bible-page] .bottom-nav .nav-item {
    height: 42px;
    line-height: 15px;
    overflow-wrap: anywhere;
    text-align: center;
  }
  .social-tabs,.profile-content-tabs { overflow-x: auto; }
  .social-tabs > a,.profile-content-tabs > button { flex-shrink: 0; white-space: nowrap; }
}
@media (max-width:399px) {
  body.videos-page .videos-heading h1 .videos-title-mobile { font-size: 24px; }
}
@media (max-width:359px) {
  /* Apple's six-character Japanese term must stay on one navigation line. */
  html[lang="ja"] .bible-nav .nav-item[href="widget.html"] {
    font-size: .625rem;
    white-space: nowrap;
    overflow-wrap: normal;
  }
  body.videos-page .videos-heading > .premium-button { width: 34px; padding: 6px; }
  body.videos-page .videos-heading > .premium-button > span { display: none; }
  body.videos-page .videos-heading h1 .videos-title-mobile { font-size: 22px; }
}
html[dir="rtl"] .reading-header,html[dir="rtl"] .app-language-control,html[dir="rtl"] .artifact-photos { direction: ltr; }
html[dir="rtl"] .episode-player-copy,html[dir="rtl"] .artifact-description,html[dir="rtl"] .policy-card,html[dir="rtl"] .profile-identity { text-align: start; }
html[dir="rtl"] .reading-header .desktop-reading-heading { direction: rtl; }
.bible-nav:has(.app-language-menu:not([hidden])) { z-index: 200; }
html[dir="rtl"] .episode-verse-excerpt p { text-align: start; }
.episode-embedded-panel .reading-language { display: none; }

html[dir="rtl"] .profile-account-tools,html[dir="rtl"] .social-header { direction: ltr; }

.episode-card h3 { overflow-wrap: anywhere; hyphens: auto; }

@media (max-width:679px) {
  .profile-page.profile-tools-wrapped { --profile-mobile-header-height: calc(max(22px, env(safe-area-inset-top)) + 88px); }
  .profile-page.profile-tools-wrapped .profile-account-tools { grid-template-columns: auto minmax(0,1fr) auto; grid-template-areas: "settings . premium" "edit edit ."; }
  .profile-page.profile-tools-wrapped .profile-account-tools > .profile-edit-button { justify-self: start; }
}

@media (min-width:680px) and (max-height:740px) {
  body[data-bible-page] .bible-nav { overflow-y: auto; }
  .bible-nav .desktop-account-footer { position: static; margin-top: 16px; }
}
