/* Mobile homepage layout, consolidated V51. Desktop and other routes untouched. */
@media (min-width:701px){.sg-mobile-image-editor,.sg-mobile-guest-account{display:none!important}}
@media (max-width:700px){
  /* Keep account controls directly below the registered homepage logo. */
  .sg-mobile-guest-account{display:flex;justify-content:center;align-items:center;gap:9px;flex-wrap:nowrap;padding:7px 9px;margin:0 auto 5px;max-width:100%;font-size:11px;line-height:1.3;color:#83909e;background:#f6f9ff;border-bottom:1px solid #e6ecf5;}
  .sg-mobile-guest-account a{white-space:nowrap;text-decoration:none;color:#40566d;}
  .sg-mobile-guest-account a:focus-visible{outline:2px solid #1765d1;outline-offset:3px}
  .sg-mobile-guest-account span{color:#c0c8d2}
  /* Align the small editor control to the right of the existing top-left settings gear. */
  header.site-header > #site-brand-row > .sg-mobile-image-editor{position:absolute!important;top:4px!important;left:30px!important;z-index:10002!important;display:grid!important;place-items:center!important;width:22px!important;height:22px!important;min-width:22px!important;min-height:22px!important;padding:1px!important;margin:0!important;border:0!important;border-radius:5px!important;background:#ffffffd9!important;color:#1765bb!important;cursor:pointer!important;box-shadow:none!important;}
  header.site-header > #site-brand-row > .sg-mobile-image-editor:focus-visible{outline:2px solid #1765d1;outline-offset:2px}
  /* Remove the redundant account/control strip on the mobile home only. */
  header.site-header>.utility-bar{display:none!important}
  header.site-header>.gnb .gnb-inner>a.gnb-admin{display:none!important}
  .home-sidebar .member-card,.home-sidebar .login-card,.home-sidebar .standalone-image-card{display:none!important}
  /* Existing board buttons and permissions are preserved; enforce compact total tile height and spacing. */
  header.site-header>.gnb .gnb-inner{gap:5px!important;padding:4px 10px!important;grid-auto-rows:44px!important;height:auto!important;min-height:0!important;align-items:stretch!important;}
  header.site-header>.gnb .gnb-inner>a.sg-nav-board{display:flex!important;flex-direction:column!important;gap:1px!important;height:44px!important;min-height:0!important;max-height:44px!important;box-sizing:border-box!important;overflow:hidden!important;background:#fff!important;border:1px solid #d7e4f5!important;border-radius:12px!important;box-shadow:0 2px 7px #25477a0b!important;padding:4px 3px!important;line-height:1.2!important;font-size:12px!important;}
  header.site-header>.gnb .gnb-inner>a.sg-nav-board:before{content:"";display:block;width:16px;height:16px;flex:0 0 16px;background-color:currentColor;mask:url('data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="black" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"%3E%3Cpath d="M5 3h9l5 5v13H5z"/%3E%3Cpath d="M14 3v6h5M8 13h8M8 17h8"/%3E%3C/svg%3E') center/contain no-repeat;}
  header.site-header>.gnb .gnb-inner>a.sg-nav-board:not(.active){color:#1765bb!important}
  header.site-header>.gnb .gnb-inner>a.sg-nav-board.active{background:#1765d1!important;color:#fff!important}
  /* One-line notice immediately above the board posts. */
  .home-notice{display:flex!important;align-items:center!important;min-width:0;height:43px!important;min-height:43px!important;gap:9px!important;padding:7px 10px!important;margin:0 0 10px!important;border:1px solid #e0eaff!important;background:#edf5ff!important;border-radius:10px!important;white-space:nowrap!important;}
  .home-notice strong{flex:0 0 auto!important;font-size:12px!important;border:0!important;color:#174e99!important;white-space:nowrap!important}
  .home-notice > a,.home-notice > .notice-empty{flex:1 1 auto;min-width:0!important;display:block!important;overflow:hidden!important;white-space:nowrap!important;text-overflow:ellipsis!important;font-size:12px!important;line-height:1.3!important}
  .home-notice time{display:none!important}
  /* Compact rows; no modification to board content or click targets. */
  .portal-panel:not(.gallery-panel) .latest-list{padding:3px 9px!important;min-height:131px!important;box-sizing:border-box!important}
  .portal-panel:not(.gallery-panel) .latest-list li>a{height:25px!important;min-height:25px!important;padding:1px 2px!important;gap:7px!important;font-size:12px!important;line-height:1.2!important}
  .portal-panel:not(.gallery-panel) .latest-list time{font-size:10px!important}
  /* Keep at least five compact post rows, but no surplus full-screen blank area. */
  .main-area{min-height:0!important;padding-bottom:12px!important;}
  .home-layout .board-panels{margin-bottom:0!important;}
  .home-layout .board-panels>.home-board-panel{margin-bottom:0!important;}
  .site-footer{padding-top:12px!important;padding-bottom:12px!important;}
}

/* V146: mobile home - each board title directly above its own configured posts.
   Scoped to the homepage; all PC and board/post pages remain unchanged. */
@media (max-width:700px) {
  .home-layout #home-board-panels {display:flex!important;flex-direction:column!important;gap:10px!important;margin:0 0 8px!important;}
  .home-layout #home-board-panels > .home-board-panel,
  .home-layout #home-board-panels > .home-board-panel.sg-top-board-active,
  .home-layout #home-board-panels > .home-board-panel.mobile-tab-inactive {
    display:block!important;width:100%!important;margin:0!important;min-width:0!important;
    border:1px solid #dde7ee!important;border-radius:13px!important;
    background:#fff!important;box-shadow:0 3px 12px rgba(27,54,80,.055)!important;
    overflow:hidden!important;
  }
  .home-layout #home-board-panels .panel-head {
    height:43px!important;min-height:43px!important;padding:0 12px!important;
    border:0!important;border-bottom:1px solid #e9eff5!important;
    background:linear-gradient(105deg,#dcefea 0%,#eaf3fb 100%)!important;
    display:flex!important;align-items:center!important;gap:8px!important;
  }
  .home-layout #home-board-panels .panel-head > div {flex:1!important;min-width:0!important;gap:8px!important;}
  .home-layout #home-board-panels .panel-head h2 {flex:0 1 auto!important;min-width:0!important;font-size:14px!important;font-weight:800!important;line-height:1.25!important;color:#164e47!important;}
  .home-layout #home-board-panels .panel-head > a:focus-visible {outline:2px solid #177f77;outline-offset:2px;}
  .home-layout #home-board-panels .panel-head > div > span {flex:none!important;border-radius:20px!important;padding:3px 7px!important;background:#fff!important;color:#55766e!important;font-size:10px!important;font-weight:700!important;}
  .home-layout #home-board-panels .panel-head > a {display:flex!important;align-items:center!important;justify-content:center!important;gap:2px!important;flex:none!important;
    padding:7px 9px!important;border:1px solid #cae1de!important;border-radius:8px!important;background:#fff!important;color:#167267!important;font-size:11px!important;font-weight:700!important;text-decoration:none!important;}
  .home-layout #home-board-panels .panel-head > a b {font-size:14px!important;line-height:1!important;}
  .home-layout #home-board-panels .latest-list {padding:3px 11px!important;min-height:0!important;}
  .home-layout #home-board-panels .latest-list li > a {height:29px!important;min-height:29px!important;line-height:1.25!important;gap:5px!important;}
  .home-layout #home-board-panels .latest-list li:not(:last-child){border-bottom:1px solid #f0f3f6!important;}
  .home-layout #home-board-panels .latest-list .latest-title {font-size:12px!important;min-width:0!important;overflow:hidden!important;text-overflow:ellipsis!important;white-space:nowrap!important;}
  .home-layout #home-board-panels .latest-list time{font-size:10px!important;}
  .home-layout #home-board-panels .locked-panel,
  .home-layout #home-board-panels .panel-empty {min-height:56px!important;padding:10px!important;box-sizing:border-box!important;}
  /* Gallery board contents retain their existing per-board gallery/list setting. */
  .home-layout #home-board-panels .home-gallery-grid {padding:8px!important;}
}
