html {
    scroll-behavior: smooth;
    overflow-x: hidden; 
}

body {
    margin: 0px;
    padding: 0px;
    border: none;
    text-align: center;
    width: 100%;
}

.flex {
    display: flex;
    width: 80%;
    margin: 0px auto;
    padding: 0px 0px 30vh 0px;
    flex-direction: column;
    border: none;    
    box-sizing: border-box;
}

.item {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: auto;
    padding: 0px;
    box-sizing: border-box;
}

.index {
    position: fixed;
    width: 100%;
    left: 0%;
    bottom: 0;
    z-index: 999;
    margin: 0px;
    padding: 0px;
    border: none;
    pointer-events: none; 
}

.index > #Btn {
    float: right;
    width: 6em;
    height: auto;
    margin: -4em 20px 10px 0px;
    transition: 0.5s;
    pointer-events: auto; 
}

.index > #Btn:hover {
    animation: swing 1s 1;
}

@keyframes swing {
    15% { transform: translateY(5px); }
    40% { transform: translateY(-5px); }
    60% { transform: translateY(2px); }
    85% { transform: translateY(-2px); }
    100% { transform: translateY(0px); }
}

.list {
    display: flex;
    height: auto;
    width: 100%;
    flex-wrap: nowrap; 
    justify-content: center; 
    align-items: stretch; 
    background-color: transparent;
    margin-top: -5px;
}

.itemBtn {
    flex: 1; 
    min-width: 0; 
    height: auto;
    padding: 5px;
    box-sizing: border-box;
    cursor: pointer;    
}

.itemBtn > a {
    display: block; 
    width: 100%;
    height: 100%;
}

.itemBtn img {
    width: 100%;
    height: 100%;
    object-fit: contain; 
    object-position: bottom; 
}

.itemBtn:hover {
    transition: .2s;
    transform: scale(0.95);
}

.img,
img {
    background-position: center;
    background-size: cover;
    background-repeat: no-repeat;
    width: 100%;
    box-sizing: border-box;
    height: auto;
    border: none;
    display: block;
    scroll-margin-top: 20px; 
}

/* --- 影片區塊樣式修正 (對應 HTML 的 class) --- */
.custom-video-section {
    width: 100%;
    padding: 40px 20px; /* 上下留白，讓影片不會緊貼著上一張圖片 */
    box-sizing: border-box;
}

/* --- 撐開影片外層容器，避免被 flex 擠壓至 0 --- */
.video-frame {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center; /* 讓裡面的標題和影片都能水平置中 */
}
.video-frame {
    width: 100%;
    max-width: 860px;
    display: flex;
    flex-direction: column;
    align-items: center;
    background-color: #ffe666; /* 您的黃色底色 */
    padding: 10px 25px;        /* 這裡！把第一個數字(上下)調小 */
    border: 4px solid #222222; 
    border-radius: 8px;        
    box-shadow: 8px 8px 0px rgba(0, 0, 0, 0.15); 
    box-sizing: border-box;
}



.frame-header h1 {
    margin-top: 0px;      
    margin-bottom: 1px;   
}

.frame-header p {
    margin-top: 0px;
    margin-bottom: 0px;  
}

.frame-body {
    width: 100%;
    display: flex;
    justify-content: center; 
}

.frame-body iframe {
    width: 100%;
    max-width: 800px; /* 限制電腦版的最大寬度 */
    aspect-ratio: 16 / 9; /* 保持標準 16:9 影片比例，手機上也會自動縮放 */
    border-radius: 12px; 
    box-shadow: 0px 8px 20px rgba(0, 0, 0, 0.15); 
    border: none;
}

.frame-header {
  font-weight: 600;
  margin-bottom: 16px;
}

.video-container {
  aspect-ratio: 16 / 9;
  width: 100%;
  overflow: hidden;
}

/* --- 手機版設定 (螢幕寬度 768px 以下，已合併重複項目) --- */
@media screen and (max-width: 768px) { 
    .flex {
        display: flex;
        width: 100%;
        margin: 0px auto;
        padding: 0px 0px 30vh 0px;
        flex-direction: column;
        box-sizing: border-box;
    }
    
    .list {
        flex-wrap: wrap; 
    }
    
    .itemBtn {
        flex: none; 
        width: 25%; 
    }
    
    .custom-video-section {
        padding: 20px 10px; 
    }
}