/* WeQuant shared mobile layout, 2026-10-04. Desktop layout stays with each page. */
@media (max-width: 760px) {
  html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: 120px; }
  body { font-size: 16px; line-height: 1.75; }
  main, .container, .card, .panel, .tile, .box, .route, .journey-card,
  .hero-copy, .detailgrid > *, .account-layout > *, .grid > * { min-width: 0; }
  main { padding-inline: max(20px, env(safe-area-inset-left, 0px)); }
  h1 { font-size: clamp(28px, 7.5vw, 34px); line-height: 1.4; }
  h2 { font-size: 25px; line-height: 1.45; }
  p, li { overflow-wrap: break-word; }
  .eyebrow, .hero-kicker { font-size: 12px; letter-spacing: .13em; line-height: 1.8; }
  input:not([type=checkbox]):not([type=radio]), select, textarea { min-width: 0; max-width: 100%; font-size: 16px; }
  button, .btn, .button { min-height: 44px; line-height: 1.5; white-space: normal; }
  .btn, .button { text-align: center; }
  img.guide, .guide-image, .backtest-curve, video, iframe { max-width: 100%; }
  code, .number, .badge, .pill, .status, .product-name { overflow-wrap: anywhere; }
  .badge, .pill, .status { max-width: 100%; white-space: normal; }
  .card, .panel, .tile, .box, .route { padding: 20px; }
  .card h2, .card h3 { margin-bottom: 12px; }
  .card p:last-child, .panel p:last-child { margin-bottom: 0; }

  /* Primary tasks stack; small filters and tabs remain compact. */
  .entry-actions, .hero-actions, .hero .actions, .home-closing .actions,
  main .actions, dialog .actions, .card-actions, .card-actions > div,
  .business-card-action { display: flex; flex-direction: column; align-items: stretch; gap: 10px; }
  .entry-actions > .herocta, .hero-actions > button,
  .actions > .btn, .actions > .button, .actions > button,
  .card-actions .btn, .business-card-action .btn,
  .card > .button, .card > button, .engineering > .button,
  .empty > .btn, #welcome > .btn, form > button:not([type=button]) {
    width: 100%; max-width: none; flex: none; min-height: 48px; padding: 12px 18px;
    display: inline-flex; justify-content: center; align-items: center; margin-inline: 0;
  }
  .chips { gap: 8px; }
  .chip, .tab { min-height: 44px; padding: 9px 12px; line-height: 1.5; }
  dialog .tabs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; overflow: visible; white-space: normal; }
  dialog .tabs .tab { min-width: 0; width: 100%; white-space: normal; }
  .bookmark { min-width: 44px; min-height: 44px; }
  .filters { grid-template-columns: minmax(0, 1fr); gap: 14px; padding: 16px; }
  .filters label, .filters .search-label, .filters label:last-child { grid-column: auto; }
  .sectionhead, .section-title, .section-heading, .home-section-tail {
    flex-direction: column; align-items: stretch; gap: 14px;
  }
  .sectionhead { display: flex; }
  .library-count { font-size: 28px; }
  .library-count small { display: inline; font-size: 12px; margin-inline-start: 10px; }
  .routes, .cards, .three, .grid, .detailgrid, .split, .about-heading,
  .home-editorial, .home-benefit-grid, .home-business-grid { grid-template-columns: minmax(0, 1fr); }
  .reportnumbers, .stats, .task-progress { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .row { flex-wrap: wrap; gap: 8px; }
  .row > * { min-width: 0; max-width: 100%; }

  /* Keep brand, language and menu on one row on the product homepage. */
  header:has(.mobilemenu) { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; padding: 12px 16px; gap: 8px; align-items: center; }
  header:has(.mobilemenu) .brand { grid-column: 1; grid-row: 1; min-width: 0; gap: 8px; }
  header:has(.mobilemenu) .brand img { width: 28px; height: 28px; flex: none; }
  header:has(.mobilemenu) .brand .brand-word { font-size: 21px; }
  header:has(.mobilemenu) .brand .brand-word small { font-size: 9px; letter-spacing: .1em; margin-top: 5px; }
  header:has(.mobilemenu) > .wq-language { grid-column: 2; grid-row: 1; width: 90px !important; min-width: 0; min-height: 44px; font-size: 16px !important; }
  header:has(.mobilemenu) > .mobilemenu { grid-column: 3; grid-row: 1; width: 40px; margin: 0; padding: 8px; min-height: 44px; }
  header:has(.mobilemenu) #nav.mobile-open { max-height: calc(100dvh - 80px); padding-bottom: 30px; }
  header:not(.nav):not(:has(.mobilemenu)) { padding: 16px 20px; gap: 14px; flex-wrap: wrap; align-items: flex-start; }
  header:not(.nav):not(:has(.mobilemenu)) .brand { min-width: 0; max-width: 100%; font-size: 23px; }
  header:not(.nav):not(:has(.mobilemenu)) .brand img { width: 28px; height: 28px; }
  header:not(.nav):not(:has(.mobilemenu)) .brand small,
  header:not(.nav):not(:has(.mobilemenu)) .brand-word small { font-size: 11px; letter-spacing: .12em; }
  header:not(.nav):not(:has(.mobilemenu)) nav {
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; width: 100%;
    order: 3; flex-basis: 100%; align-items: stretch; padding-top: 0;
  }
  header:not(.nav):not(:has(.mobilemenu)) nav > a,
  header:not(.nav):not(:has(.mobilemenu)) nav > button {
    display: flex; align-items: center; justify-content: center; text-align: center;
    min-height: 44px; padding: 8px 10px; font-size: 14px; line-height: 1.5;
    white-space: normal; border: 1px solid #7ca39930; border-radius: 8px;
  }
  header:not(.nav):not(:has(.mobilemenu)) nav > select { max-width: 100% !important; width: 100% !important; min-height: 44px; }

  /* The mobile hero reserves a quiet area for text and actions. */
  .hero.cinematic { margin-inline: -20px; width: auto; height: auto; min-height: 860px; max-height: none; padding: 40px 20px 240px; }
  .hero.cinematic .hero-copy { width: 100%; max-width: 460px; margin-inline: auto; }
  .hero.cinematic .hero-kicker { position: relative; margin-bottom: 16px; padding-inline: 10px; }
  .hero.cinematic .hero-copy h1.bot-brand-title { font-size: clamp(28px, 8vw, 35px); line-height: 1.4; letter-spacing: .035em; margin: 18px 0; }
  html:lang(en) .hero.cinematic .hero-copy h1.bot-brand-title { letter-spacing: -.02em; }
  .hero.cinematic .hero-copy p { max-width: 360px; margin: 0 auto 24px; font-size: 16px; line-height: 1.85; letter-spacing: 0; }
  .hero.cinematic .entry-actions { flex-direction: column; flex-wrap: nowrap; gap: 10px; max-width: 360px; margin-inline: auto; }
  .hero.cinematic .entry-actions .herocta { width: 100%; flex: none; padding: 13px 18px; min-height: 48px; font-size: 16px; white-space: normal; }
  .hero.cinematic .hero-fine { font-size: 13px; line-height: 1.8; margin-top: 16px; }
  .hero.cinematic .hero-shade { background: linear-gradient(180deg, #03080bed 0%, #03080be0 53%, #03080b50 78%, #09111d 100%); }
  .hero.cinematic .hero-foreground { opacity: .3; }
  .hero.cinematic .hero-bottom { left: 20px; right: 20px; gap: 10px; }
  .hero.cinematic .scene-chapters > span { font-size: 12px; line-height: 1.6; }
  .hero.cinematic .hero-bottom .quiet { font-size: 14px; }
  .hero.hero-orbit { height: auto; min-height: 840px; max-height: none; }
  .hero-orbit .hero-copy { padding-top: 42px; }
  .hero-orbit .hero-copy .actions { width: 100%; max-width: 340px; margin-inline: auto; }
  .hero-orbit .hero-copy .btn { width: 100%; }
  .hero-orbit .eyebrow { font-size: 12px; letter-spacing: .12em; }
  .region-rail { gap: 16px 10px; }
  .region-rail > span, .region-rail small { font-size: 12px; line-height: 1.7; }

  /* Account sections wrap as a visible menu instead of running off-screen. */
  .account-layout { grid-template-columns: minmax(0, 1fr); gap: 18px; }
  #sidebar { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; overflow: visible; }
  #sidebar button { min-height: 44px; padding: 10px; text-align: center; white-space: normal; font-size: 14px; }
  .account-layout #content { padding: 20px; min-height: 0; }
  #welcome { margin-bottom: 24px; }
  #welcome p { font-size: 16px; }
  #welcome > .btn { margin-top: 6px; }
  .account-layout #content .empty { padding: 12px 0; }
  .account-layout #content .btn { width: 100%; }
  .member-tabs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .member-tabs a { min-height: 44px; text-align: center; padding: 10px; font-size: 14px; }
  #flow { padding: 22px 18px; scroll-margin-top: 150px; }
  .journey-card { padding: 22px; }
  .journey-card h2 { font-size: 23px; }
  .flow-bottom, .engineering { flex-direction: column; align-items: stretch; gap: 14px; }
  .license-row { grid-template-columns: minmax(0, 1fr); }

  /* Tables scroll inside their cards; dialogs keep their controls reachable. */
  .scroll, .table, .tablewrap, .table-wrap, .review-table { max-width: 100%; min-width: 0; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .scroll table, .table table, .tablewrap table, .table-wrap table { min-width: 560px; }
  #totals { max-width: 100%; overflow-x: auto; }
  .card > .button + .button { margin-top: 10px; }
  dialog { width: calc(100% - 24px); max-width: 650px; max-height: calc(100dvh - 32px); padding: 22px 18px; overflow: auto; }
  dialog .close, dialog #close, .support-close, #close-login, .dialog-head button {
    width: 44px; min-width: 44px; height: 44px; min-height: 44px; padding: 6px; flex: none;
  }
  .human-support { width: calc(100% - 24px); padding: 22px 18px; }
  .human-support h2 { font-size: 25px; }
  .human-support p { font-size: 16px; }
  .support-options a { padding: 16px; }
  .support-options strong { font-size: 18px; }
  .comparebar { left: 12px; right: 12px; bottom: 80px; transform: none; width: auto; max-width: none; flex-wrap: wrap; justify-content: center; }
  .comparebar .btn { min-height: 44px; }
  footer { padding-bottom: calc(100px + env(safe-area-inset-bottom, 0px)); }
  body:has(> h1) { margin: 24px auto; padding: 0 20px calc(90px + env(safe-area-inset-bottom, 0px)); }
  body:has(> h1) h1 { font-size: 28px; line-height: 1.45; }
  body:has(> h1) h2 { font-size: 23px; }
  body:has(> h1) code { overflow-wrap: anywhere; }
  body:has(> h1) ol { padding-left: 24px; }
  body:has(> div[align=center] > table) { margin: 0; padding: 16px; max-width: 100%; }
  body > div[align=center]:has(> table) { width: 100%; max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  body > div[align=center]:has(> table)::before { content: '表格可左右滑动 / Swipe table horizontally'; display: block; position: sticky; left: 0; width: 100%; padding: 10px 0; text-align: left; color: #31544e; font: 13px/1.6 system-ui, sans-serif; }
  body > div[align=center] > table td, body > div[align=center] > table th { font-size: 12px; line-height: 1.6; }
  body > div[align=center] > table tr[align=center] > td[colspan="13"] { text-align: left; }
}
@media (max-width: 360px) {
  header:has(.mobilemenu) .brand .brand-word small { display: none; }
  .hero.cinematic .hero-copy h1.bot-brand-title { font-size: 28px; }
  .stats, .task-progress, .reportnumbers { gap: 10px; }
  .stats .card { padding: 14px; }
  .number { font-size: 27px; }
  .market-support-badge { flex-wrap: wrap; }
}
/* Phone landscape and compact tablets need the same collapsible site menu. */
@media (min-width: 761px) and (max-width: 1000px) {
  header:has(.mobilemenu) { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; padding: 12px 20px; gap: 12px; }
  header:has(.mobilemenu) .brand { grid-column: 1; grid-row: 1; }
  header:has(.mobilemenu) .brand .brand-word small { display: block; font-size: 11px; }
  header:has(.mobilemenu) > .wq-language { grid-column: 2; grid-row: 1; min-height: 44px; }
  header:has(.mobilemenu) > .mobilemenu { display: inline-flex; grid-column: 3; grid-row: 1; margin: 0; min-width: 44px; min-height: 44px; align-items: center; justify-content: center; }
  header:has(.mobilemenu) #nav { display: none; }
  header:has(.mobilemenu) #nav.mobile-open { display: flex; position: absolute; top: 100%; left: 0; right: 0; margin: 0; padding: 16px 24px; max-height: calc(100dvh - 80px); overflow-y: auto; flex-direction: column; align-items: stretch; background: #081420; }
  #nav.mobile-open .nav-direct, #nav.mobile-open .navitem { display: flex; padding: 12px 0; }
  #nav.mobile-open .navtrigger { width: 100%; padding: 12px 0; justify-content: space-between; }
  #nav.mobile-open .submenu { position: static; min-width: 0; width: 100%; padding: 12px; box-shadow: none; flex-wrap: wrap; }
  #nav.mobile-open .submenu > div { flex-basis: 100%; min-width: 0; }
}
@media (min-width: 761px) and (max-width: 1000px) {
  body:has(> div[align=center] > table) { margin: 0; padding: 16px; max-width: 100%; }
  body > div[align=center]:has(> table) { width: 100%; max-width: 100%; overflow-x: auto; }
}
