/* メンバー別 劇場公演 出演予定一覧。名前チップ＋クリックでモーダル。 */
#main .ms-note { font-size: .85em; color: #6b7280; }

/* 名前チップの一覧：約5文字幅の固定グリッドで整列させる */
#main .ms-names {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 8px; margin: 14px 0 6px;
}
#main .ms-name {
    display: flex; align-items: center; justify-content: space-between; gap: 7px;
    background: #fff; border: 1px solid #e3e7ec; border-radius: 999px;
    padding: 8px 14px; font-size: .95em; font-weight: 700; color: #1f2937;
    cursor: pointer; box-shadow: 0 1px 2px rgba(16,24,40,.05);
    transition: border-color .15s, box-shadow .15s, transform .1s;
    white-space: nowrap;
}
#main .ms-name:hover { border-color: #e0568f; box-shadow: 0 4px 10px rgba(224,86,143,.18); }
#main .ms-name:active { transform: translateY(1px); }
#main .ms-name .ms-cnt {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 20px; height: 20px; padding: 0 5px;
    background: #fdeef5; color: #b1487c; border-radius: 999px;
    font-size: .78em; font-weight: 800;
}
/* 出演予定なし（0）＝淡色・クリック不可 */
#main .ms-name--zero {
    color: #9aa1ab; background: #f5f6f8; border-color: #e6e9ee;
    cursor: default; box-shadow: none;
}
#main .ms-name--zero:hover { border-color: #e6e9ee; box-shadow: none; transform: none; }
#main .ms-name--zero .ms-cnt { background: #eceef1; color: #9aa1ab; }
#main .ms-noresult { color: #888; margin-top: 12px; }
#main .ms-empty { color: #6b7280; margin: 16px 0; }

/* モーダル（ポップアップ） */
#main .ms-modal { position: fixed; inset: 0; z-index: 1000; display: flex;
    align-items: center; justify-content: center; padding: 16px; }
#main .ms-modal[hidden] { display: none; }
#main .ms-modal-overlay { position: absolute; inset: 0; background: rgba(17,24,39,.55); }
#main .ms-modal-card {
    position: relative; z-index: 1; width: 100%; max-width: 440px;
    max-height: 86vh; display: flex; flex-direction: column;
    background: #fff; border-radius: 16px; padding: 18px 18px 16px;
    box-shadow: 0 18px 50px rgba(0,0,0,.35);
    animation: ms-pop .18s ease-out;
}
@keyframes ms-pop { from { transform: translateY(8px) scale(.98); opacity: 0; } to { transform: none; opacity: 1; } }
#main .ms-modal-head { border-bottom: 1px solid #eef0f3; padding-bottom: 10px; margin-bottom: 4px; }
#main .ms-modal-title { margin: 0; font-size: 1.25em; font-weight: 800; color: #1f2937; }
#main .ms-modal-body { overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; padding: 6px 2px 2px; }

/* 公演リスト（モーダル内） */
#main .ms-list { list-style: none; margin: 0; padding: 0; }
#main .ms-item { margin-bottom: 5px; }
#main .ms-item:last-child { margin-bottom: 0; }
#main .ms-item-head { display: flex; align-items: baseline; gap: 7px; }
/* 公演一覧（メンバー名クリック後）はコンパクトに（1画面に多く並ぶよう圧縮）。出演メンバー側(.ms-cast)は触らない。 */
#main .ms-date { font-weight: 800; color: #1f2937; font-size: 12px; }
#main .ms-time { font-size: 11px; color: #5b6b62; font-weight: 700; }
#main .ms-stage { font-size: 14px; color: #1f2937; font-weight: 700; line-height: 1.35; }
/* 日付＋公演名を1つの枠にまとめる（タップで出演メンバー表示） */
#main .ms-stage-btn,
#main .ms-stage-box {
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
    width: 100%; text-align: left;
    background: #f7f9fb; border: 1px solid #e6ebf1; border-radius: 9px;
    padding: 5px 11px;
}
#main .ms-stage-btn { cursor: pointer; transition: border-color .15s, background .15s; }
#main .ms-stage-main { display: flex; flex-direction: column; gap: 0; min-width: 0; }
#main .ms-stage-btn:hover { border-color: #e0568f; background: #fdf1f6; }
#main .ms-stage-btn:active { transform: translateY(1px); }
#main .ms-stage-arrow { flex-shrink: 0; font-size: 12px; color: #b1487c; font-weight: 800; white-space: nowrap; }

/* 公演の出演メンバー一覧 */
#main .ms-cast { line-height: 2.1; font-size: .97em; }
#main .ms-cast a { color: #b1487c; font-weight: 600; }
#main .ms-cast-note { margin: 12px 0 0; font-size: .82em; color: #8a93a2; font-weight: 700; }

/* モーダル：戻るボタン・日時サブ見出し */
#main .ms-back {
    background: none; border: none; cursor: pointer;
    color: #b1487c; font-weight: 800; font-size: .95em; padding: 0 0 6px;
}
#main .ms-modal-when { margin-top: 3px; font-size: .86em; color: #6b7280; font-weight: 700; }
#main .ms-suppl {
    display: inline-block; margin-left: 4px; font-size: .78em; font-weight: 700;
    color: #c0392b; background: #fdecec; border: 1px solid #f5cccc;
    border-radius: 6px; padding: 1px 7px;
}

#main .ms-modal-link {
    display: block; text-align: center; margin: 12px 0 0;
    color: #b1487c; font-weight: 700; text-decoration: none; font-size: .92em;
}
#main .ms-modal-link[hidden] { display: none; }   /* display:block が hidden属性を上書きしないように */
#main .ms-modal-link:hover { text-decoration: underline; }

/* 大きな閉じるボタン */
#main .ms-close {
    margin-top: 14px; width: 100%;
    border: none; cursor: pointer; -webkit-appearance: none;
    background: linear-gradient(135deg, #ee6ea6, #e0568f);
    color: #fff; font-weight: 800; font-size: 1.15em;
    padding: 16px; border-radius: 14px;
    box-shadow: 0 6px 16px rgba(224,86,143,.32);
    transition: transform .1s;
}
#main .ms-close:active { transform: translateY(1px); }

@media (max-width: 600px) {
    #main .ms-modal {
        padding: 10px;
        /* 下部のアンカー広告に大ボタン（閉じる/戻る）が隠れないよう、下側に広告分の余白を確保。
           中身が多いときは .ms-modal-body が内部スクロールする。 */
        padding-bottom: calc(104px + env(safe-area-inset-bottom, 0px));
        align-items: center;
    }
    #main .ms-modal-card { max-height: calc(100vh - 130px); }
}
