/* モーダル全体の黒透過背景 */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0,0,0,0.75);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 9998;
    padding: 10px; /* 画面端の余白確保 */
    box-sizing: border-box;
}

/* モーダル中身 */
.modal-content {
    position: relative;
    background-color: #1a1a1a;
    padding: 15px;
    border-radius: 10px;
    width: 90vw;
    max-width: 980px;
    max-height: 90vh; /* 画面縦幅を超えない */
    overflow-y: auto; /* 縦に溢れたらスクロール */
    box-shadow: 0 8px 24px rgba(0,0,0,0.6);
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 9999;
    box-sizing: border-box;
}

/* ✕ボタン */
.modal-close {
    position: absolute;
    top: 10px;
    right: 10px;
    background: transparent;
    border: none;
    color: #888;
    font-weight: 600;
    font-size: 28px;
    width: 36px;
    height: 36px;
    line-height: 36px;
    text-align: center;
    cursor: pointer;
    transition: color 0.3s ease;
    padding: 0;
    user-select: none;
    border-radius: 4px;
    z-index: 10002;
}

.modal-close:hover {
    color: #444;
    background: rgba(0,0,0,0.05);
}

/* スライダーコンテナ */
.slider-container {
    width: 100%;
    height: auto;
    position: relative;
    display: flex;
    align-items: center;
    overflow: hidden;
    margin-top: 10px; /* 40px→10pxで縮小 */
}

/* 各スライド */
.video-slide {
    display: none;
    width: 100%;
    flex-shrink: 0;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 18px rgba(0,0,0,0.4);
    position: relative;
}

.video-slide.active {
    display: block;
}

/* 動画を囲むコンテナ */
.video-wrapper {
    position: relative;
    width: 100%;
    max-height: 80vh; /* 追加：動画の最大高さ制限 */
    aspect-ratio: 16 / 9; /* 追加：アスペクト比保持 */
    margin: 0 auto;
}

/* iframe動画 */
.modal-content iframe {
    position: static; /* 変更：絶対配置解除 */
    width: 100%;
    height: 100%;
    max-height: 100%;
    border: none;
    display: block;
    aspect-ratio: 16 / 9; /* 追加：アスペクト比保持 */
}

/* 追加：PCやスマホ横画面は固定最大幅で表示 */
@media screen and (min-width: 601px) {
    .video-wrapper {
        max-height: 80vh;
        width: 560px; /* 最大幅 */
    }
}

/* スマホ縦画面は幅100%で最大80vh */
@media screen and (max-width: 600px) {
    .video-wrapper {
        width: 100%;
        max-height: 80vh;
    }
}

/* ナビボタン */
.nav-button {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background-color: rgba(255,255,255,0.25);
    border: none;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    font-size: 24px;
    color: #333;
    cursor: pointer;
    transition: background-color 0.3s ease;
    user-select: none;
    z-index: 10;

    pointer-events: auto; /* クリック可能 */
}

.nav-button:hover {
    background-color: rgba(255,255,255,0.7);
    color: #111;
}

#prev {
    left: 12px;
}

#next {
    right: 12px;
}

/* スマホ縦画面でナビボタンを少し小さくして被りを防止 */
@media screen and (max-width: 600px) {
    .nav-button {
        width: 36px;
        height: 36px;
        font-size: 20px;
        top: 55%;
    }
}

/* 番号ボタンコンテナ（下部へ配置） */
.video-number-buttons {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
    margin-top: 20px;
    margin-bottom: 10px;
}

/* シンプルで角丸少なめなボタン */
.video-num-btn {
    background: #f0f0f0;
    border: 1px solid #bbb;
    border-radius: 4px;
    color: #444;
    width: 34px;
    height: 34px;
    font-weight: 500;
    font-size: 15px;
    cursor: pointer;
    box-shadow: none;
    transition: background-color 0.2s ease, transform 0.15s ease;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    line-height: 1;
}

.video-num-btn:hover {
    background-color: #ddd;
    border-color: #999;
    transform: translateY(-1px);
}

.video-num-btn.active {
    background-color: #aaa;
    color: #fff;
    cursor: default;
    transform: scale(1.05);
    border-color: #888;
}

/* モバイル対応 */
@media screen and (max-width: 480px) {
    .video-num-btn {
        width: 28px;
        height: 28px;
        font-size: 13px;
    }
}
