@media (max-width: 767px) {
  /* 1. 基本：2カラム、上線あり、右線あり */
  .gnav .inner .gnav_item {
    width: 50% !important;
    border-top: 1px solid #9f9f9f !important;
    border-right: 1px solid #9f9f9f !important;
    border-bottom: none !important;
    box-sizing: border-box;
    display: flex !important; /* 要素を表示させる */
  }

  /* 2. 1行目（ホーム・京都模型）の上線を消す */
  .gnav .inner .gnav_item:nth-child(1),
  .gnav .inner .gnav_item:nth-child(2) {
    border-top: none !important;
  }

  /* 3. 右カラム（2n）の右線を消す */
  .gnav .inner .gnav_item:nth-child(2n) {
    border-right: none !important;
  }

  /* 4. 【重要】最後から2番目の「お問い合わせ」を100%幅にして底を閉じる */
  .gnav .inner .gnav_item:nth-last-child(2) {
    width: 100% !important;
    border-right: none !important;
    border-bottom: 1px solid #9f9f9f !important;
  }

  /* 5. 一番最後の空のdiv（tb md）は邪魔なので非表示にする */
  .gnav .inner .gnav_item:last-child {
    display: none !important;
  }
}

@media (max-width: 767px) {
  /* 9番目の要素（お問い合わせ）を横いっぱいにし、下に線を引く */
  .gnav .inner .gnav_item:nth-child(9) {
    width: 100% !important;
    border-bottom: 1px solid #9f9f9f !important;
    border-right: none !important;
  }

  /* 10番目の要素（空のdiv）が隙間を作らないよう完全に消す */
  .gnav .inner .gnav_item:nth-child(10) {
    display: none !important;
  }
}