/* Mobile-only layout for the static BOCHK pages. Desktop rules are untouched. */
.mobile-site-header,
.mobile-nav-backdrop,
.mobile-nav-drawer,
.mobile-home-hero { display: none; }

@media (max-width: 767px) {
  html, body {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    overflow-x: hidden !important;
  }
  body { margin: 0 !important; background: #fff; }
  img { max-width: 100%; height: auto; }

  /* Hide the desktop-only header and floating desktop widgets. */
  #header { display: none !important; }
  #top-search,
  .myCollectionContainer,
  #top-tools,
  #toptools,
  #btn-top,
  #qrCode { display: none !important; }

  /* Mobile header inspired by the supplied reference: language strip + directory/logo/login. */
  .mobile-site-header {
    display: block;
    width: 100%;
    background: #fff;
    position: relative;
    z-index: 10020;
    box-shadow: 0 1px 0 rgba(0,0,0,.12);
  }
  .mobile-language-bar {
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 22px;
    padding: 0 16px;
    background: #d8dada;
    border-bottom: 1px solid #222;
    box-sizing: border-box;
    font-family: Arial, "Microsoft JhengHei", sans-serif;
  }
  .mobile-language-bar a {
    color: #555 !important;
    text-decoration: none !important;
    font-size: 18px;
    line-height: 1;
  }
  .mobile-header-main {
    height: 84px;
    display: grid;
    grid-template-columns: 74px 1fr 74px;
    align-items: center;
    background: #fff;
    border-bottom: 5px solid #a50024;
    box-sizing: border-box;
  }
  .mobile-menu-trigger {
    width: 74px;
    height: 79px;
    padding: 7px 0 4px;
    border: 0;
    background: transparent;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    color: #555;
    cursor: pointer;
    font-family: Arial, "Microsoft JhengHei", sans-serif;
  }
  .mobile-menu-trigger .hamburger-lines {
    width: 34px;
    height: 26px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
  }
  .mobile-menu-trigger .hamburger-lines i {
    display: block;
    width: 100%;
    height: 4px;
    background: #666;
    border-radius: 1px;
  }
  .mobile-menu-trigger .mobile-menu-label,
  .mobile-login-link .mobile-login-label {
    font-size: 15px;
    line-height: 1;
    color: #555;
    white-space: nowrap;
  }
  .mobile-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    padding: 0 8px;
  }
  .mobile-brand img {
    display: block;
    width: auto;
    max-width: 190px;
    max-height: 50px;
  }
  .mobile-login-link {
    width: 74px;
    height: 79px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 7px;
    text-decoration: none !important;
    color: #555 !important;
  }
  .mobile-lock-icon {
    position: relative;
    width: 25px;
    height: 22px;
    background: #777;
    border-radius: 3px;
    box-sizing: border-box;
  }
  .mobile-lock-icon:before {
    content: "";
    position: absolute;
    left: 5px;
    top: -13px;
    width: 15px;
    height: 14px;
    border: 4px solid #777;
    border-bottom: 0;
    border-radius: 11px 11px 0 0;
    box-sizing: border-box;
  }
  .mobile-lock-icon:after {
    content: "";
    position: absolute;
    left: 11px;
    top: 7px;
    width: 4px;
    height: 8px;
    border-radius: 3px;
    background: #fff;
  }

  /* Off-canvas navigation. */
  .mobile-nav-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 10030;
    background: rgba(0,0,0,.5);
    opacity: 0;
    visibility: hidden;
    transition: opacity .25s ease, visibility .25s ease;
  }
  .mobile-nav-drawer {
    display: block;
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 10040;
    width: min(84vw, 330px);
    background: #fff;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    transform: translateX(-105%);
    transition: transform .28s ease;
    box-shadow: 4px 0 16px rgba(0,0,0,.2);
    font-family: Arial, "Microsoft JhengHei", sans-serif;
  }
  body.mobile-menu-open .mobile-nav-backdrop {
    opacity: 1;
    visibility: visible;
  }
  body.mobile-menu-open .mobile-nav-drawer { transform: translateX(0); }
  body.mobile-menu-open { overflow: hidden !important; }
  .mobile-nav-titlebar {
    min-height: 62px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 14px 0 18px;
    background: #990000;
    color: #fff;
  }
  .mobile-nav-titlebar strong { font-size: 20px; font-weight: 600; }
  .mobile-nav-close {
    width: 40px;
    height: 40px;
    border: 0;
    background: transparent;
    color: #fff;
    font-size: 34px;
    line-height: 40px;
    cursor: pointer;
  }
  .mobile-nav-section-title {
    margin: 0;
    padding: 12px 18px 8px;
    color: #990000;
    background: #f1f1f1;
    border-top: 1px solid #ddd;
    border-bottom: 1px solid #ddd;
    font-size: 15px;
    font-weight: 700;
  }
  .mobile-nav-list { margin: 0; padding: 0; list-style: none; }
  .mobile-nav-list li { margin: 0; padding: 0; border-bottom: 1px solid #e6e6e6; }
  .mobile-nav-list a {
    display: block;
    padding: 13px 18px;
    color: #333 !important;
    background: #fff;
    text-decoration: none !important;
    font-size: 15px;
    line-height: 1.25;
  }
  .mobile-nav-list a:hover,
  .mobile-nav-list a:focus,
  .mobile-nav-list a.current-mobile-page {
    color: #990000 !important;
    background: #faf4f4;
  }

  /* Remove desktop minimum widths that cause the whole site to shrink on phones. */
  #nav-path,
  #content,
  #notice-board,
  #nav-icon,
  #footer,
  #notice-board-nav,
  #notice-board-items,
  #footer > #sitemap > div,
  #footer > div#footer-nav {
    min-width: 0 !important;
    max-width: none !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  /* Mobile homepage hero. The old desktop slider remains untouched and is hidden only on phones. */
  .banner_reference { display: none !important; }
  .mobile-home-hero {
    display: block;
    position: relative;
    width: 100%;
    height: 168px;
    overflow: hidden;
    background: #eee;
  }
  .mobile-home-hero .mobile-hero-slide {
    position: absolute;
    inset: 0;
    display: block;
    opacity: 0;
    visibility: hidden;
    transition: opacity .45s ease;
    text-decoration: none;
  }
  .mobile-home-hero .mobile-hero-slide.active {
    opacity: 1;
    visibility: visible;
  }
  .mobile-home-hero img {
    display: block;
    width: 100%;
    height: 168px;
    object-fit: cover;
    object-position: center center;
  }
  .mobile-hero-dots {
    position: absolute;
    right: 13px;
    top: 12px;
    z-index: 2;
    display: flex;
    gap: 6px;
  }
  .mobile-hero-dot {
    width: 11px;
    height: 11px;
    padding: 0;
    border: 1px solid #666;
    background: rgba(255,255,255,.9);
    box-sizing: border-box;
    cursor: pointer;
  }
  .mobile-hero-dot.active { background: #777; }

  /* Homepage notice tabs and cards: match the compact proportions of the reference mobile site. */
  #notice-board {
    background: #d0d0d0 !important;
    padding-bottom: 24px !important;
    overflow-x: hidden !important;
  }
  #notice-board-nav {
    padding: 0 !important;
    margin: 0 !important;
    background: #eee !important;
    overflow: hidden !important;
  }
  #notice-board-nav .categories_tabs {
    display: grid !important;
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    float: none !important;
    list-style: none !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
  }
  #notice-board-nav .categories_tabs > li {
    display: block !important;
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
    border-right: 1px solid #999 !important;
    border-bottom: 1px solid #888 !important;
    box-sizing: border-box !important;
    background: linear-gradient(#f8f8f8, #dedede) !important;
    overflow: hidden !important;
  }
  #notice-board-nav .categories_tabs > li:last-child { border-right: 0 !important; }
  #notice-board-nav .categories_tabs > li > a {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 4px !important;
    width: 100% !important;
    min-width: 0 !important;
    min-height: 46px !important;
    margin: 0 !important;
    padding: 0 2px !important;
    background: none !important;
    color: #777 !important;
    text-align: center !important;
    text-decoration: none !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    line-height: 1.12 !important;
    letter-spacing: 0 !important;
    white-space: nowrap !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
  }
  #notice-board-nav .categories_tabs > li > a::before {
    content: "";
    display: inline-block;
    flex: 0 0 auto;
    width: 0;
    height: 0;
    border-top: 6px solid transparent;
    border-bottom: 6px solid transparent;
    border-left: 9px solid #c1022f;
  }
  #notice-board-nav .categories_tabs > li.blue > a::before { border-left-color: #faaf40; }
  #notice-board-nav .categories_tabs > li.green > a::before { border-left-color: #1b8ebb; }
  #notice-board-nav .categories_tabs > li.red > a::before { border-left-color: #783c64; }
  #notice-board-nav .categories_tabs > li > a.active { color: #333 !important; }
  #nav-share { display: none !important; }

  #notice-board-items {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    padding: 18px 0 0 !important;
    margin: 0 !important;
    overflow: hidden !important;
    box-sizing: border-box !important;
  }
  #notice-board-items > div,
  #notice-board-items > div > div,
  #notice-board-items ul.component-boxframe {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    border-left: 0 !important;
    box-sizing: border-box !important;
    overflow: visible !important;
  }
  #notice-board-items ul.component-boxframe > li.card {
    display: block !important;
    float: none !important;
    width: calc(100% - 48px) !important;
    max-width: 316px !important;
    min-width: 0 !important;
    height: 195px !important;
    min-height: 0 !important;
    margin: 0 auto 14px !important;
    padding: 0 !important;
    background: #fff !important;
    box-shadow: 0 2px 7px rgba(0,0,0,.22) !important;
    overflow: hidden !important;
    box-sizing: border-box !important;
  }
  #notice-board-items ul.component-boxframe > li.card[style*="display: none"] { display: none !important; }
  #notice-board-items ul.component-boxframe > li.card > .span_component {
    position: relative !important;
    display: block !important;
    width: 100% !important;
    height: 191px !important;
    min-height: 0 !important;
    padding: 12px 13px 34px !important;
    box-sizing: border-box !important;
    background: #fff !important;
    overflow: hidden !important;
  }
  #notice-board-items ul.component-boxframe > li.card h1 {
    margin: 0 0 10px !important;
    padding: 0 !important;
    color: #990000 !important;
    font-size: 18px !important;
    line-height: 1.2 !important;
  }
  #notice-board-items ul.component-boxframe > li.card ul {
    margin: 0 !important;
    padding: 0 0 0 20px !important;
    font-size: 0 !important;
  }
  #notice-board-items ul.component-boxframe > li.card li {
    margin: 0 0 7px !important;
    padding: 0 !important;
    font-size: 13px !important;
    line-height: 1.36 !important;
  }
  #notice-board-items ul.component-boxframe > li.card li a {
    line-height: inherit !important;
    overflow-wrap: anywhere !important;
  }

  /* Image cards keep their original 450:300 artwork ratio, but at the same compact card width. */
  #notice-board-items ul.component-boxframe > li.card.type-d {
    height: auto !important;
    min-height: 0 !important;
  }
  #notice-board-items ul.component-boxframe > li.card.type-d > .span_component {
    height: auto !important;
    min-height: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
  }
  #notice-board-items ul.component-boxframe > li.card.type-d img {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    margin: 0 !important;
    object-fit: contain !important;
  }
  #notice-board-items ul.component-boxframe > li.card .morelink {
    top: auto !important;
    left: auto !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 72px !important;
    height: 30px !important;
    min-height: 0 !important;
    padding: 0 !important;
    background: #a90028 !important;
    color: #fff !important;
    text-align: center !important;
    line-height: 30px !important;
    font-size: 13px !important;
    z-index: 3 !important;
  }
  #notice-board-items ul.component-boxframe > li.card.type-d .morelink {
    width: 72px !important;
    height: 30px !important;
  }
  #notice-board-items ul.component-boxframe > li.card .morelink span {
    position: static !important;
    width: auto !important;
    line-height: inherit !important;
  }
  #notice-board-show {
    display: block !important;
    width: calc(100% - 48px) !important;
    max-width: 316px !important;
    margin: 3px auto 0 !important;
    padding: 9px 0 !important;
    background: #8a8a8a !important;
    color: #fff !important;
    text-align: center !important;
    text-decoration: none !important;
    box-sizing: border-box !important;
  }

  /* Any desktop-only empty content sections should not reserve wide layout. */
  .style-a.ui-accordion { width: 100% !important; box-sizing: border-box; }
  .style-a.ui-accordion .paragraph { margin-left: 12px !important; margin-right: 12px !important; }

  /* Compact mobile footer. Navigation is available from the hamburger, so hide the huge desktop sitemap. */
  #footer { background: #d2dadd !important; }
  #footer #sitemap { display: none !important; }
  #footer div#footer-nav {
    padding: 18px 16px 20px !important;
    overflow: visible !important;
    text-align: left;
  }
  #footer div#footer-nav #footer-leftSide,
  #footer div#footer-nav #footer-rightSide {
    display: block !important;
    position: static !important;
    width: 100% !important;
    padding: 0 !important;
    background: none !important;
    box-sizing: border-box;
  }
  #footer div#footer-nav #footer-leftSide {
    margin-bottom: 12px;
    color: #666;
    font-size: 12px !important;
  }
  #footer div#footer-nav #footer-rightSide ul {
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    text-align: left !important;
  }
  #footer div#footer-nav #footer-rightSide ul li {
    display: block !important;
    margin: 0 !important;
    border-top: 1px solid #b9c0c3;
  }
  #footer div#footer-nav #footer-rightSide ul li a {
    display: block;
    padding: 8px 0;
    color: #555 !important;
    font-size: 12px;
    line-height: 1.35 !important;
  }

  /* Loan status page already has responsive fields; make it align with the new mobile shell. */
  #loan-status-page {
    width: 100% !important;
    min-width: 0 !important;
    padding-top: 16px !important;
  }
  #loan-status-page .loan-status-shell { width: calc(100% - 20px) !important; }
  #loan-status-page .form-container { box-shadow: none !important; }
  #loan-status-page .h2-title { font-size: 22px !important; }
  #loan-status-page .approval-letter { overflow-wrap: anywhere; }
}

@media (max-width: 380px) {
  .mobile-language-bar { gap: 17px; padding-right: 12px; }
  .mobile-header-main { grid-template-columns: 66px 1fr 66px; }
  .mobile-menu-trigger,
  .mobile-login-link { width: 66px; }
  .mobile-brand img { max-width: 165px; }
  .mobile-home-hero,
  .mobile-home-hero img { height: 154px; }
  #notice-board-nav .categories_tabs > li > a {
    font-size: 11px !important;
    gap: 3px !important;
  }
  #notice-board-nav .categories_tabs > li > a::before {
    border-top-width: 5px;
    border-bottom-width: 5px;
    border-left-width: 8px;
  }
  #notice-board-items ul.component-boxframe > li.card,
  #notice-board-show {
    width: calc(100% - 42px) !important;
    max-width: 304px !important;
  }
}
