
  .modal { position: fixed; inset: 0; display: none; }
  .modal.is-open { display: block; }
  .modal__backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.45); }
  .modal__panel {
    position: relative;
    width: min(720px, calc(100% - 24px));
    max-height: calc(100% - 24px);
    margin: 12px auto;
    background: #fff;
    border-radius: 10px;
    overflow: hidden;
  }
  
  

/*======================================
  Modal (overlay + panel)
========================================*/

.modal{
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;

  z-index: 1000;

  opacity: 0;
  visibility: hidden;
  pointer-events: none;

  overflow: hidden; /* 背面はスクロールさせない見せ方 */
  transition: opacity 0.25s ease, visibility 0s linear 0.25s;
}

.modal.is-open{
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition: opacity 0.25s ease, visibility 0s linear 0s;
}

.modal__backdrop{
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.4);
}

/* パネル */
.modal__panel{
  position: relative;
  z-index: 1;

  width: calc(100% - 32px);
  max-width: 800px;

  /* iOSも含め安定させる */
  height: calc(100vh - 90px);
  height: calc(100dvh - 90px);
  margin: 45px auto;

  background: #fff;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);

  display: flex;
  flex-direction: column;

  overflow: hidden; /* 中のスクロールのため必須 */

  /* “やや下からじわっと” */
  transform: translateY(9px);
  opacity: 0;
  transition: transform 0.24s ease-out, opacity 0.20s ease-out;
  will-change: transform, opacity;
}

.modal.is-open .modal__panel{
  transform: translateY(0);
  opacity: 1;
}

/* ヘッダー（固定領域） */
.modal__header{
  position: relative;
  padding: 20px 30px;
  border-bottom: 1px solid #eee;

  flex: 0 0 auto;  /* 固定 */
}

.modal__title{
  font-size: 18px;
  font-weight: 600;
  line-height: 1.4;
  margin: 0;
  text-align: left;
}

/* 閉じるボタン */
.modal__close{
  position: absolute;
  top: 12px;
  right: 16px;

  background: none;
  border: none;
  font-size: 36px;
  line-height: 1;
  cursor: pointer;
}

/* 本文：ここが“残り全部”を使う */
.modal__body{
  flex: 1 1 auto;
  min-height: 0;                /* ← これが無いとスクロールが死にやすい */

  display: flex;
  flex-direction: column;
  gap: 12px;

  padding: 18px 30px 24px;
}

/* 今は検索を隠す方針 */
#modalSearch{
  display: none;
}

/* リストがスクロール担当 */
.modal__list{
  flex: 1 1 auto;
  min-height: 0;

  overflow-y: auto;
  -webkit-overflow-scrolling: touch;

  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px 18px; /* 縦 横 */
  align-content: start;        /* 余白を下に寄せる（均等割りを防ぐ） */
  align-items: start;          /* アイテムを上寄せ */
  grid-auto-rows: max-content; /* 行の高さを中身基準に固定（1fr化を防ぐ） */
  
  padding: 0;     /* 余白は body 側に持たせる */

}

/* items */
.modal__item{
  padding: 16px 12px;
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
  text-align: center;
}

.modal__item > div{
  font-size: 15px;
  font-weight: 400;
  line-height: 1.4;
}

.modal__item > small{
  display: block;
  margin-top: 6px;
  font-size: 12px;
  color: #777;
}

.modal__item:hover{
  background: #f7f7f7;
}

/* SP */
@media (max-width: 600px){
  .modal__panel{
    width: calc(100% - 40px);
    margin: 20px;
    height: calc(100vh - 40px);
    height: calc(100dvh - 40px);
  }

  .modal__header{
    padding: 16px 20px;
  }

  .modal__body{
    padding: 14px 20px 18px;
  }

  .modal__list{
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
  }
}

@media (max-width: 360px){
  .modal__list{
    grid-template-columns: 1fr;
  }
}

/* 閉じるとき少しキュッと（任意） */
.modal:not(.is-open) .modal__panel{
  transition: transform 0.18s ease-in, opacity 0.16s ease-in;
}

/* 動きを減らす設定 */
@media (prefers-reduced-motion: reduce){
  .modal,
  .modal__panel{
    transition: none !important;
    transform: none !important;
  }
}







}/*//end  min-width: 481px ///////////////////////*/











