body {
    font-family: Arial, sans-serif;
    background-color: #f0f0f0;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    margin: 0;
    height: 100vh;
    box-sizing: border-box;
    position: relative;
}

h1 {
    color: #333;
}

.menu-btn {
    position: fixed;
    top: 20px;
    left: 20px;
    background-color: #333;
    color: white;
    border: none;
    padding: 15px;
    font-size: 16px;
    cursor: pointer;
    border-radius: 5px;
    z-index: 1000;
    transition: background-color 0.3s, transform 0.3s, left 0.5s ease;
}

.menu-btn:hover {
    background-color: #555;
}

.sidebar {
    position: fixed;
    top: 0;
    left: -250px;
    width: 220px;
    height: 100%;
    background-color: #333;
    color: white;
    display: flex;
    flex-direction: column;
    transition: left 0.5s ease;
    z-index: 999;
}

.sidebar a {
    color: white;
    text-decoration: none;
    margin: 10px 0;
    padding: 10px;
    width: 100%;
    text-align: center;
    transition: background-color 0.3s;
    border-bottom: 1px solid #444;
}

.sidebar a:hover {
    background-color: #555;
}

.sidebar.hide #music-player {
    opacity: 0;
    pointer-events: none;
}

#album-list {
    flex: 1;
    width: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
}

#album-list a {
    color: white;
    text-decoration: none;
    padding: 10px;
    width: 100%;
    text-align: center;
    border-bottom: 1px solid #444;
    transition: background-color 0.3s;
}

#album-list a:hover {
    background-color: #555;
}

#music-player {
    width: 100%;
    height: 150px;
}

.gallery {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    width: 100%;
    max-width: 100vw;
    padding: 20px;
    overflow: auto;
    box-sizing: border-box;
    max-height: 80vh;
}

.photo {
    width: 250px;
    height: 250px;
    margin: 15px;
    border: 2px solid #ccc;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    transition: transform 0.2s;
    position: relative;
    cursor: pointer;
    background-color: #000;
}

.photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.photo video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.photo:hover {
    transform: scale(1.05);
}

/* 改良的影片縮圖樣式 */
.video-thumbnail {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.video-thumbnail.loaded {
    background: none;
}

.video-thumbnail video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.video-thumbnail video.loaded {
    opacity: 1;
}

/* 影片播放圖示覆蓋 */
.photo .play-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60px;
    height: 60px;
    background-color: rgba(0, 0, 0, 0.7);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 24px;
    pointer-events: none;
    z-index: 10;
}

.photo .play-icon::after {
    content: '▶';
    margin-left: 3px;
}

/* 載入中動畫 */
.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top: 3px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* 彈出視窗樣式 */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
}

.modal-content {
    position: relative;
    margin: 5% auto;
    width: 80%;
    max-width: 800px;
    background-color: #000;
    border-radius: 8px;
    overflow: hidden;
}

.modal video {
    width: 100%;
    height: auto;
    max-height: 70vh;
    object-fit: contain;
}

.close {
    position: absolute;
    top: 15px;
    right: 25px;
    color: #fff;
    font-size: 35px;
    font-weight: bold;
    cursor: pointer;
    z-index: 2001;
}

.close:hover {
    color: #ccc;
}

/* 媒體類型標籤 */
.media-type {
    position: absolute;
    top: 8px;
    left: 8px;
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: bold;
    z-index: 5;
}

.media-type.video {
    background-color: rgba(220, 20, 60, 0.8);
    width: auto;
    height: auto;
    max-width: 80px;
    max-height: 24px;
    display: inline-block;
}

.media-type.photo {
    background-color: rgba(34, 139, 34, 0.8);
    display: none;
}