/* Japanese mobile layout corrections. Loaded after page-specific styles. */
@media (max-width: 760px) {
  html.ja-mobile *,
  html.ja-mobile *::before,
  html.ja-mobile *::after {
    box-sizing: border-box;
  }

  html.ja-mobile body,
  html.ja-mobile main,
  html.ja-mobile section,
  html.ja-mobile article,
  html.ja-mobile aside,
  html.ja-mobile form,
  html.ja-mobile main > * {
    min-width: 0 !important;
    max-width: 100%;
  }

  html.ja-mobile .directory-container {
    width: auto !important;
    max-width: none !important;
    margin-left: 16px !important;
    margin-right: 16px !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
  }

  html.ja-mobile main :where(h1, h2, h3, h4, p, label, strong, small) {
    height: auto !important;
    min-width: 0 !important;
    overflow: visible;
    text-overflow: clip;
    overflow-wrap: anywhere;
    word-break: normal;
  }

  html.ja-mobile main :where(h1, h2, h3, h4) {
    padding-bottom: .08em;
    line-height: 1.28 !important;
  }

  html.ja-mobile main :where(button, .btn, .button, .primary-btn, .secondary-btn) {
    height: auto !important;
    min-height: 44px;
    max-width: 100%;
    white-space: normal !important;
    line-height: 1.35 !important;
    overflow-wrap: anywhere;
  }

  html.ja-mobile main :where(.result-value, .metric-value, .result-main, .result-number,
    .perf-result-value, .eng-result-hero strong, .accept-score b, .calc-result strong) {
    max-width: 100% !important;
    font-size: clamp(24px, 9vw, 40px) !important;
    line-height: 1.2 !important;
    overflow-wrap: anywhere;
  }

  html.ja-mobile main :where(.metric-grid, .result-grid, .summary-grid, .stats-grid,
    .perf-metrics, .accept-metrics) > * {
    min-width: 0 !important;
  }

  html.ja-mobile main :where(.metric, .stat, .summary-item, .result-item,
    .perf-metric, .jewelry-result, .fuel-result) strong {
    font-size: clamp(16px, 5.5vw, 28px) !important;
    word-break: break-word !important;
  }

  html.ja-mobile main table {
    display: block;
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    -webkit-overflow-scrolling: touch;
  }

  html.ja-mobile .tiny-info {
    display: inline-grid !important;
    place-items: center;
    width: 18px !important;
    height: 18px !important;
    min-height: 18px !important;
    border: 1px solid currentColor;
    border-radius: 999px;
    font-size: 0 !important;
    overflow: hidden !important;
  }

  html.ja-mobile .tiny-info::before {
    content: "i";
    font: 700 11px/1 Arial, sans-serif;
  }

  html.ja-mobile .trust {
    flex: 1 1 140px !important;
    max-width: 100% !important;
  }

  html.ja-mobile body:not(.popular-page) .popular-grid {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  html.ja-mobile main :where(.metric-grid, .result-grid, .summary-grid, .stats-grid,
    .perf-metrics, .accept-metrics) strong {
    max-width: 100% !important;
    font-size: clamp(18px, 6vw, 30px) !important;
    white-space: normal !important;
    overflow-wrap: anywhere;
  }

  html.ja-mobile main :where(.compound-input, .fuel-input, .tip-field, .tip-input,
    .dt-field, .input-unit, .field-control) {
    height: auto !important;
    min-height: 44px !important;
    overflow: visible !important;
  }

  html.ja-mobile main :where(.compound-input, .fuel-input, .tip-field, .tip-input,
    .dt-field, .input-unit, .field-control) :where(input, select) {
    min-height: 44px !important;
  }

  html.ja-mobile main :where(.tabs, .tab-list, .segmented, .toggle-group,
    .perf-unit-toggle, .filter-row, .button-group) {
    display: flex !important;
    flex-wrap: wrap !important;
    width: 100% !important;
    max-width: 100% !important;
  }

  html.ja-mobile main :where(.tabs, .tab-list, .segmented, .toggle-group,
    .perf-unit-toggle, .filter-row, .button-group) > * {
    flex: 1 1 120px !important;
    min-width: 0 !important;
  }

  /* Legacy everyday pages used desktop-width hero columns on phones. */
  html.ja-mobile :where(.perf-hero-grid, .hundred-hero-grid, .day180-layout,
    .adddays-hero-grid, .addmin-hero-grid, .addtime-hero-grid, .hm-hero-grid,
    .age-hero-grid, .sec-hero-grid, .month-hero-grid, .day-hero-grid,
    .hour-hero-grid, .min-hero-grid) {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
  }

  html.ja-mobile :where(.perf-hero-grid, .hundred-hero-grid, .day180-layout,
    .adddays-hero-grid, .addmin-hero-grid, .addtime-hero-grid, .hm-hero-grid,
    .age-hero-grid, .sec-hero-grid, .month-hero-grid, .day-hero-grid,
    .hour-hero-grid, .min-hero-grid) > * {
    min-width: 0 !important;
    max-width: 100% !important;
  }

  html.ja-mobile :where(.perf-art, .hundred-art) {
    overflow: hidden !important;
  }

  html.ja-mobile :where(.uc-table, .jpc-table) {
    min-width: 460px;
  }
  html.ja-mobile,
  html.ja-mobile body {
    width: 100%;
    max-width: 100%;
    overflow-x: clip;
  }

  html.ja-mobile *,
  html.ja-mobile *::before,
  html.ja-mobile *::after {
    box-sizing: border-box;
  }

  html.ja-mobile :where(main, section, article, form, fieldset,
    .directory-container, .container, .page-shell, .tool-shell,
    .calculator-shell, .workspace-grid, .input-panel, .result-panel,
    .hero-copy, .month6-copy, .day180-card) {
    min-width: 0 !important;
    max-width: 100% !important;
  }

  html.ja-mobile :where(.workspace-grid, .calculator-layout,
    .tool-layout, .input-output-grid, .result-layout, .results-grid) {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  html.ja-mobile :where(.directory-container.hero-inner,
    .directory-container.workspace-grid) {
    width: calc(100% - 32px) !important;
    margin-inline: 16px !important;
  }

  html.ja-mobile :where(.topic-tabs, .collection-tabs, .mode-tabs,
    .filter-tabs, .category-tabs, .tab-list, [role="tablist"]) {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: visible !important;
    overscroll-behavior-inline: contain;
    scrollbar-width: thin;
    padding-bottom: 6px;
    -webkit-overflow-scrolling: touch;
  }

  html.ja-mobile :where(.browse-categories, .sort-tabs, .hero-category-chips,
    .img2-filters, .popular-filters) {
    display: flex !important;
    flex-wrap: wrap !important;
    width: 100% !important;
    max-width: 100% !important;
    overflow: visible !important;
    gap: 8px !important;
  }

  html.ja-mobile :where(.browse-categories, .sort-tabs, .hero-category-chips,
    .img2-filters, .popular-filters) > * {
    flex: 0 1 auto !important;
    max-width: 100% !important;
    white-space: normal !important;
  }

  html.ja-mobile .calculator-card {
    min-height: 94px !important;
    align-items: center;
  }

  html.ja-mobile .calculator-card .card-copy p {
    display: -webkit-box !important;
    margin-top: 3px !important;
    font-size: 11px !important;
    line-height: 1.35 !important;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
  }

  html.ja-mobile :where(.topic-tab, .collection-tab, .mode-tab,
    [role="tab"]) {
    flex: 0 0 auto !important;
    min-height: 44px !important;
    white-space: nowrap;
  }

  html.ja-mobile :where(.segmented-control, .toggle-group,
    .button-group, .button-row, .action-row, .form-actions,
    .calculator-actions, .result-actions, .preset-row) {
    display: flex !important;
    flex-wrap: wrap !important;
    width: 100% !important;
    max-width: 100% !important;
    gap: 8px !important;
  }

  html.ja-mobile body :where(button, .btn, .button, [role="button"],
    .lang-btn, .cookie-primary, .cookie-secondary) {
    min-height: 44px !important;
    min-width: 44px !important;
  }

  html.ja-mobile body :where(input:not([type="checkbox"]):not([type="radio"]), select, textarea) {
    min-height: 44px !important;
    font-size: 16px !important;
  }

  html.ja-mobile body {
    line-break: strict;
  }

  html.ja-mobile :where(h1, h2, h3, h4, p, li, label, button, a,
    .hero-copy, .result-value, .metric-value, .formula) {
    min-width: 0;
    max-width: 100%;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  html.ja-mobile :where(.search, .hero-search, .popular-search, .img2-search) {
    position: relative !important;
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    align-items: stretch !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    gap: 8px !important;
    height: auto !important;
    min-height: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
  }

  html.ja-mobile :where(.search, .hero-search, .popular-search, .img2-search) input {
    grid-column: 1 !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    height: 48px !important;
    min-height: 48px !important;
    padding: 0 14px 0 44px !important;
    border: 1px solid #cbd9e8 !important;
    border-radius: 12px !important;
    outline: 0;
    background: #fff !important;
    box-shadow: 0 6px 18px rgba(29, 75, 120, .06) !important;
    -webkit-appearance: none !important;
    appearance: none !important;
  }

  html.ja-mobile :where(.search, .hero-search, .popular-search, .img2-search) input::-webkit-search-decoration,
  html.ja-mobile :where(.search, .hero-search, .popular-search, .img2-search) input::-webkit-search-cancel-button {
    display: none !important;
    -webkit-appearance: none !important;
  }

  html.ja-mobile :where(.search, .hero-search, .popular-search, .img2-search) > span:first-child {
    position: absolute !important;
    z-index: 2;
    top: 14px !important;
    left: 14px !important;
    width: 20px !important;
    height: 20px !important;
    pointer-events: none;
  }

  html.ja-mobile :where(.search, .hero-search, .img2-search) button {
    position: static !important;
    grid-column: 1 !important;
    width: 100% !important;
    height: auto !important;
    min-height: 46px !important;
    padding: 10px 16px !important;
    margin: 0 !important;
    border-radius: 12px !important;
    line-height: 1.35 !important;
    white-space: normal !important;
    overflow: visible !important;
  }

  html.ja-mobile :where(.popular-search) kbd {
    position: absolute !important;
    top: 14px !important;
    right: 12px !important;
    max-width: 72px;
  }

  html.ja-mobile :where(.search, .hero-search, .popular-search, .img2-search) input:focus-visible {
    outline: 2px solid #2d74b8;
    outline-offset: 2px;
  }

  html.ja-mobile :where(.hero-category-chips, .quick-tags, .img2-filters,
    .popular-toolbar, .popular-results-heading, .guide-links) {
    display: flex !important;
    flex-wrap: wrap !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    gap: 8px !important;
  }

  /* The shared mobile theme hides the homepage quick-calculator fields.
     Japanese pages keep the complete calculator instead of a result-only demo. */
  html.ja-mobile .hero .calculator-card .form-grid .field {
    display: grid !important;
    min-width: 0 !important;
  }

  html.ja-mobile .hero .calculator-card :where(.quick-fields, .field-row) {
    min-width: 0 !important;
    max-width: 100% !important;
  }

  html.ja-mobile :where(.calculator-card, .browse, .calc-panel) .field-row {
    grid-template-columns: minmax(0, 1fr) minmax(76px, 92px) !important;
  }

  html.ja-mobile :where(.calculator-card, .browse, .calc-panel) .field-row select {
    width: 100% !important;
    padding-inline: 10px 28px !important;
    white-space: nowrap !important;
  }

  /* Popular page: replace overlapping desktop collage with a readable flow. */
  html.ja-mobile .img2-art {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 12px !important;
    width: 100% !important;
    max-width: 100% !important;
    min-height: 0 !important;
    padding: 4px 0 !important;
    overflow: visible !important;
  }

  html.ja-mobile .img2-art :where(.img2-hand-note, .img2-tomorrow-note,
    .img2-bubble, .img2-symbol, .img2-mini-percent) {
    display: none !important;
  }

  html.ja-mobile .img2-art .img2-feature {
    position: relative !important;
    inset: auto !important;
    width: auto !important;
    height: auto !important;
    min-height: 112px !important;
    transform: none !important;
    overflow: hidden !important;
  }

  html.ja-mobile .img2-art .img2-feature-percent {
    grid-column: 1 / -1 !important;
    min-height: 170px !important;
  }

  html.ja-mobile .img2-art .img2-feature :where(strong, small) {
    position: relative !important;
    inset: auto !important;
    max-width: 100% !important;
  }

  html.ja-mobile .img2-art .img2-feature > svg {
    position: absolute !important;
    right: 14px !important;
    bottom: 14px !important;
  }

  /* Homepage category browsing: compact, aligned cards with no clipped copy. */
  html.ja-mobile .category-section .categories {
    grid-template-columns: 1fr 1fr !important;
    gap: 10px !important;
  }

  html.ja-mobile .category-section .category {
    align-items: flex-start !important;
    min-height: 132px !important;
    height: auto !important;
    padding: 14px !important;
    text-align: left !important;
  }

  html.ja-mobile .category-section .category .icon-box {
    width: 34px !important;
    height: 34px !important;
    margin: 0 0 8px !important;
  }

  html.ja-mobile .category-section .category :where(h3, p) {
    width: 100% !important;
    max-width: 100% !important;
  }

  html.ja-mobile .category-section .category p {
    display: -webkit-box !important;
    max-height: none !important;
    font-size: 10px !important;
    line-height: 1.35 !important;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden !important;
  }

  html.ja-mobile .category-section .category a {
    align-self: flex-start !important;
  }

  html.ja-mobile .hero .calculator-card :where(input, select, button) {
    min-width: 0 !important;
    max-width: 100% !important;
  }

  /* Keep feedback available without covering calculator fields or actions. */
  html.ja-mobile .atlas-feedback-button {
    right: 8px !important;
    bottom: 8px !important;
    width: 44px !important;
    min-width: 44px !important;
    height: 44px !important;
    padding: 0 !important;
    border-radius: 999px !important;
    font-size: 0 !important;
  }

  html.ja-mobile .atlas-feedback-button::before {
    content: "✉";
    font-size: 18px;
    line-height: 1;
  }

  html.ja-mobile :where(.hero-category-chips, .quick-tags, .img2-filters,
    .guide-links) > * {
    flex: 0 1 auto !important;
    max-width: 100% !important;
  }

  html.ja-mobile :where(.hero-art, .img2-art, .calendar-art,
    .scientific-display, .result-panel, .input-panel) {
    min-width: 0 !important;
    max-width: 100% !important;
    overflow: hidden;
  }

  html.ja-mobile body :where(.faq-item > button, .accordion-trigger,
    summary) {
    min-height: 44px !important;
    padding-block: 10px !important;
  }

  html.ja-mobile :where(.uc-table-wrap, .jpc-table-wrap,
    .table-wrap, .table-responsive, .schedule-table, .result-table,
    .conversion-table) {
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: auto !important;
    overscroll-behavior-inline: contain;
    -webkit-overflow-scrolling: touch;
  }

  html.ja-mobile :where(.uc-table, .jpc-table) {
    min-width: 460px;
  }

  html.ja-mobile :where(.perf-hero-copy, .hundred-hero-copy,
    .month6-copy, .day180-card, .day180-input, .calendar-art,
    .perf-badges, .hundred-badges, .month6-feature-row) {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
  }

  html.ja-mobile .hundred-hero-source-art {
    position: relative !important;
    inset: auto !important;
    display: block;
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    margin-inline: auto;
  }

  html.ja-mobile :where(.perf-hero, .hundred-hero, .month6-hero,
    .day180-layout) {
    grid-template-columns: minmax(0, 1fr) !important;
    width: 100% !important;
    max-width: 100% !important;
  }

  html.ja-mobile :where(.perf-hero-grid, .hundred-hero-grid,
    .month6-hero-grid, .day180-layout, .fc-grid) {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
  }

  html.ja-mobile :where(.perf-hero-grid, .hundred-hero-grid,
    .month6-hero-grid, .day180-layout, .fc-grid) > * {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
  }

  html.ja-mobile .fc-tabs-nav {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    gap: 6px !important;
  }

  html.ja-mobile .fc-tabs-nav button {
    width: 100% !important;
    min-width: 0 !important;
    padding-inline: 8px !important;
    white-space: normal;
  }

  html.ja-mobile .fc-buttons {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    width: 100% !important;
    gap: 8px !important;
  }

  html.ja-mobile .fc-buttons button {
    width: 100% !important;
    min-width: 0 !important;
    padding-inline: 10px !important;
  }

  html.ja-mobile .fc-buttons .fc-calc {
    min-height: 48px !important;
    font-weight: 800;
    box-shadow: 0 6px 16px rgba(14, 159, 110, .18);
  }

  html.ja-mobile .fc-buttons .fc-reset {
    min-height: 44px !important;
    border: 1px solid #d7e1ec !important;
    background: #fff !important;
    box-shadow: none !important;
  }

  html.ja-mobile .related-inner {
    display: block !important;
  }

  html.ja-mobile .related-inner > h2 {
    margin: 0 0 14px !important;
  }

  html.ja-mobile .related-list {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    width: 100% !important;
    gap: 8px !important;
  }

  html.ja-mobile .related-card {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    width: 100% !important;
    min-width: 0 !important;
    min-height: 56px !important;
    padding: 10px 14px !important;
    border: 1px solid #dce6f2 !important;
    border-radius: 10px !important;
    text-align: left !important;
    line-height: 1.4 !important;
  }

  html.ja-mobile .related-card span:first-child {
    display: flex !important;
    min-width: 0 !important;
    gap: 10px !important;
    align-items: center !important;
    white-space: normal !important;
    word-break: normal !important;
  }

  html.ja-mobile .fc-related {
    display: grid;
    gap: 8px;
  }

  html.ja-mobile .fc-related a {
    min-height: 60px;
    padding: 10px 12px !important;
    border: 1px solid #e2e9f1 !important;
    border-radius: 10px;
    background: #fff;
  }

  html.ja-mobile .fc-related a:last-child {
    border-bottom: 1px solid #e2e9f1 !important;
  }

  html.ja-mobile .fc-related span {
    min-width: 0;
    line-height: 1.35;
  }

  html.ja-mobile .fc-related small {
    margin-top: 4px;
    line-height: 1.35;
  }

  html.ja-mobile :where(.calculator-actions, .form-actions, .result-actions) {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 8px !important;
  }

  html.ja-mobile :where(.calculator-actions, .form-actions, .result-actions) > :where(button, .btn, a) {
    width: 100% !important;
    min-height: 44px !important;
  }

  html.ja-mobile :where(.guide-links, .result-toolbar, .scientific-actions) > * {
    min-width: 44px !important;
  }

  html.ja-mobile :where(.scientific-display, .calc-display,
    .formula-display) {
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: auto !important;
  }

  html.ja-mobile :where(.hero-pills, .hero-chips, .quick-links,
    .guide-links) {
    display: flex !important;
    flex-wrap: wrap !important;
    max-width: 100% !important;
    gap: 8px !important;
  }

  html.ja-mobile :where(.img2-orbit, .hero-dot) {
    pointer-events: none;
  }

  html.ja-mobile .img2-orbit-right {
    right: -18px !important;
  }

  html.ja-mobile .img2-orbit-left {
    left: -18px !important;
  }
}

@media (max-width: 760px) {
  html.ja-mobile :where(.mode-tabs, .tip-mode-tabs) {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    width: 100% !important;
    max-width: 100% !important;
    overflow: visible !important;
  }
  html.ja-mobile :where(.mode-tabs, .tip-mode-tabs) > button {
    width: 100% !important;
    min-width: 0 !important;
    white-space: normal !important;
  }
  html.ja-mobile .tip-preset-row {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    overflow: visible !important;
  }
  html.ja-mobile .tip-preset-row > button,
  html.ja-mobile .tip-stepper,
  html.ja-mobile .tip-stepper > * {
    min-width: 0 !important;
    max-width: 100% !important;
  }
  html.ja-mobile .perf-hero-exact {
    width: min(100%, 330px) !important;
    max-width: 100% !important;
    height: auto !important;
    left: 50% !important;
    right: auto !important;
    transform: translateX(-50%) !important;
  }
  html.ja-mobile .adddays-art .calendar-art {
    left: 50% !important;
    right: auto !important;
    width: min(210px, calc(100% - 42px)) !important;
    transform: translateX(-50%) rotate(3deg) !important;
  }
  html.ja-mobile .guide-links {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    width: 100% !important;
    overflow: visible !important;
  }
  html.ja-mobile .guide-links > a {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
  }
  html.ja-mobile :where(.img2-orbit-left, .img2-orbit-right) {
    max-width: 44vw !important;
    transform: scale(.78) !important;
  }
  html.ja-mobile .sci-modes button {
    display: grid !important;
    grid-template-columns: 28px minmax(0, 1fr) !important;
    width: 100% !important;
    min-width: 0 !important;
  }
  html.ja-mobile .sci-modes button :where(strong, small) {
    min-width: 0 !important;
    max-width: 100% !important;
    overflow-wrap: anywhere !important;
  }
}

/* Japanese mobile pages must never require horizontal swiping. */
@media (max-width: 760px) {
  html.ja-mobile,
  html.ja-mobile body {
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: clip !important;
  }

  html.ja-mobile body:not(.popular-page) .popular-grid,
  html.ja-mobile .related-row,
  html.ja-mobile .related-grid {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    width: 100% !important;
    max-width: 100% !important;
    gap: 10px !important;
    overflow: visible !important;
    scroll-snap-type: none !important;
  }

  html.ja-mobile body:not(.popular-page) .popular-grid > .calc-item,
  html.ja-mobile .related-row > *,
  html.ja-mobile .related-grid > * {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    transform: none !important;
  }

  html.ja-mobile :where(.table-wrap, .table-scroll, .schedule-table-wrap,
    .amortization-table-wrap, .matrix-table-wrap, .result-table-wrap) {
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: clip !important;
  }

  html.ja-mobile :where(table, .uc-table, .schedule-table, .amortization-table, .result-table) {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    table-layout: fixed !important;
  }

  html.ja-mobile :where(th, td) {
    min-width: 0 !important;
    padding: 7px 5px !important;
    font-size: 11px !important;
    line-height: 1.3 !important;
    white-space: normal !important;
    overflow-wrap: anywhere !important;
    word-break: break-word !important;
  }
}

@media (max-width: 340px) {
  html.ja-mobile body:not(.popular-page) .popular-grid,
  html.ja-mobile .related-row,
  html.ja-mobile .related-grid {
    grid-template-columns: minmax(0, 1fr) !important;
  }
}

@media (max-width: 760px) {
  html.ja-mobile .hero-dot--yellow {
    right: 2px !important;
    transform: scale(.72) !important;
    transform-origin: right center !important;
  }

  html.ja-mobile body:not(.popular-page) .popular-grid > .calc-item {
    min-height: 112px !important;
    height: auto !important;
    align-items: flex-start !important;
  }

  html.ja-mobile body:not(.popular-page) .popular-grid > .calc-item p {
    display: block !important;
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
    -webkit-line-clamp: unset !important;
    white-space: normal !important;
  }
}

@media (max-width: 380px) {
  html.ja-mobile body :where(.directory-actions .lang-btn, .lang-btn) {
    width: auto !important;
    min-width: 88px;
    padding-inline: 8px !important;
  }
}
/* Keep the desktop locale picker wide enough for Japanese and long European
   language names. Each option owns one flag/name/code row, so labels cannot
   visually drift into the neighbouring country. */
@media (min-width: 901px) {
  html.ja-mobile body .topbar .language-switcher > .language-menu,
  html.ja-mobile body .topbar .language-switcher > .atlas-language-fallback {
    box-sizing: border-box !important;
    left: auto !important;
    right: 0 !important;
    width: 320px !important;
    min-width: 320px !important;
    max-width: calc(100vw - 32px) !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    grid-auto-rows: minmax(44px, auto) !important;
    gap: 4px !important;
    overflow-x: hidden !important;
  }

  html.ja-mobile body .topbar .language-menu > .language-option {
    box-sizing: border-box !important;
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
    grid-template-columns: 26px minmax(0, 1fr) auto !important;
    gap: 8px !important;
  }

  html.ja-mobile body .topbar .language-option > span:nth-child(2) {
    min-width: 0 !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }

  html.ja-mobile body .topbar .language-option > small {
    justify-self: end !important;
    white-space: nowrap !important;
  }
}
