/* style.css - 天空之城樣式表 */

/* --- 1. 全域變數與重置 --- */
:root {
    --bg-body: #121212;
    --bg-card: #1e1e1e;
    --bg-nav: rgba(18, 18, 18, 0.95);
    --primary: #b026ff;
    --secondary: #00ff9d;
    --text-main: #ffffff;
    --text-sub: #aaaaaa;
    --border: #333333;
    --header-h: 70px;
    --bottom-nav-h: 65px;
}

* { box-sizing: border-box; margin: 0; padding: 0; outline: none; -webkit-tap-highlight-color: transparent; }

body {
    overflow-x: hidden; /* 關鍵：強制隱藏橫向超出的內容 */
    width: 100%;

    /* 以下維持原本設定 */
    font-family: 'Segoe UI', 'Microsoft JhengHei', sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    padding-top: var(--header-h);
    padding-bottom: var(--bottom-nav-h);
}

/* 2. (選用) 美化捲軸樣式 (讓右側直向捲軸變更漂亮，符合暗色系) */
/* 適用於 Chrome, Edge, Safari */
::-webkit-scrollbar {
    width: 8px; /* 捲軸寬度 */
}

::-webkit-scrollbar-track {
    background: #121212; /* 捲軸軌道背景色 (跟網頁背景一樣) */
}

::-webkit-scrollbar-thumb {
    background: #333; /* 捲軸本體顏色 */
    border-radius: 4px; /* 圓角 */
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary); /* 滑鼠移過去變亮色 */
}

a { text-decoration: none; color: inherit; cursor: pointer; transition: 0.3s; }
.container-fluid { width: 100%; padding: 0; }
.content-wrapper { padding: 20px 40px; max-width: 100%; }

/* --- 2. 導航列 (Header & Bottom Nav) --- */
.logo { display: flex; align-items: center; text-decoration: none; }
.logo img { height: 50px; width: auto; object-fit: contain; }

header {
    position: fixed; top: 0; left: 0; width: 100%; height: var(--header-h);
    background: var(--bg-nav);
    border-bottom: 1px solid rgba(255,255,255,0.1);
    z-index: 1000;
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 40px;
    backdrop-filter: blur(10px);
}

.desktop-nav { display: flex; gap: 30px; }
.desktop-nav a { color: var(--text-sub); font-size: 1.1rem; font-weight: 500; position: relative; }
.desktop-nav a.active { color: #fff; }
.desktop-nav a.active::after {
    content: ''; position: absolute; bottom: -24px; left: 0;
    width: 100%; height: 3px; background: var(--primary);
    box-shadow: 0 -2px 10px var(--primary);
}

.bottom-nav {
    position: fixed; bottom: 0; left: 0; width: 100%; height: var(--bottom-nav-h);
    background: #1a1a1a; border-top: 1px solid #333;
    display: flex; justify-content: space-around; align-items: center;
    z-index: 1000;
    padding-bottom: env(safe-area-inset-bottom);
}

.nav-item {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    color: #ffffff; font-size: 0.7rem; width: 20%; height: 100%;
}
.nav-item.active { color: var(--primary); }

/* --- 3. 元件樣式 (按鈕、標題、Badge) --- */
.section-title {
    font-size: 1.6rem; margin: 30px 0 20px 0;
    border-left: 5px solid var(--primary); padding-left: 15px;
    display: flex; justify-content: space-between; align-items: center;
}
.section-title a { font-size: 1rem; color: var(--text-sub); border: 1px solid #444; padding: 5px 15px; border-radius: 20px; }

.btn { border: none; padding: 10px 25px; border-radius: 50px; cursor: pointer; font-weight: bold; transition: 0.2s; text-align: center; }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 4px 15px rgba(176, 38, 255, 0.4); }
.btn-outline { border: 1px solid var(--text-sub); color: var(--text-sub); background: transparent; }
.btn-tiktok { background: #000; color: #fff; border: 1px solid #333; font-size: 0.8rem; padding: 5px 15px; margin-top: 8px; display: inline-block; border-radius: 4px; pointer-events: none; }
.btn-full { width: 100%; display: block; margin-top: 10px; }

.badge { padding: 4px 10px; border-radius: 4px; font-size: 0.75rem; font-weight: bold; display: inline-block; }
.badge-dj { background: rgba(176, 38, 255, 0.2); color: var(--primary); border: 1px solid var(--primary); }
.badge-game { background: rgba(0, 255, 157, 0.2); color: var(--secondary); border: 1px solid var(--secondary); }

.form-input { width: 100%; padding: 12px; margin-bottom: 15px; background: #111; border: 1px solid #444; color: #fff; border-radius: 8px; }

/* --- 4. 首頁 Banner --- */
.hero-banner {
                                                width: 100%; height: 500px; position: relative; overflow: hidden;
                                                mask-image: linear-gradient(to bottom, black 85%, transparent 100%);
                                                -webkit-mask-image: linear-gradient(to bottom, black 85%, transparent 100%);
                                            }
.slide { position: absolute; top: 0; left: 0; width: 100%; height: 100%; opacity: 0; transition: opacity 1s ease-in-out; z-index: 1; display: block; }
.slide.active { opacity: 1; z-index: 2; }
.slide img { width: 100%; height: 100%; object-fit: cover; object-position: center; transition: transform 10s; }
.slide.active img { transform: scale(1.05); }

.hero-content { position: absolute; bottom: 60px; left: 40px; max-width: 600px; z-index: 10; pointer-events: none; }
.hero-title { font-size: 3.5rem; font-weight: 900; line-height: 1.1; margin-bottom: 15px; text-shadow: 2px 2px 10px rgba(0,0,0,0.8); }
.hero-subtitle { font-size: 1.5rem; color: var(--secondary); font-weight: bold; text-shadow: 1px 1px 5px rgba(0,0,0,0.8); }
.hero-content .btn { pointer-events: auto; }

/* --- 5. 卡片與網格 (Grid) --- */
.grid-dj, .grid-game { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 25px; }
.card { background: var(--bg-card); border-radius: 12px; overflow: hidden; border: 1px solid #333; transition: 0.3s; position: relative; cursor: pointer; }
.card:hover { transform: translateY(-10px); border-color: var(--primary); box-shadow: 0 10px 30px rgba(0,0,0,0.5); }

.card-img-box { position: relative; width: 100%; aspect-ratio: 1/1; overflow: hidden; }
.card-img-box.game { aspect-ratio: 16/9; }
.card-img-box img, .card-img-box video { width: 100%; height: 100%; object-fit: cover; transition: 0.5s; }
.card:hover .card-img-box img { transform: scale(1.1); }

.card-info { padding: 15px; }
.card-title { font-size: 1.2rem; font-weight: bold; margin-bottom: 8px; color: #fff; }
.card-desc { font-size: 0.9rem; color: #888; margin-bottom: 5px; height: 2.8em; overflow: hidden; }

/* --- 6. 論壇樣式 --- */
.forum-list .forum-item {
    display: flex; gap: 20px; padding: 20px; background: #1a1a1a;
    margin-bottom: 15px; border-radius: 12px; border: 1px solid #333;
    cursor: pointer; transition: 0.2s;
}
.forum-list .forum-item:hover { background: #252525; border-color: var(--secondary); }

.comment-item { background: #252525; padding: 15px; margin-bottom: 10px; border-radius: 10px; text-align: left; }
.comment-user { color: var(--secondary); font-weight: bold; margin-bottom: 5px; font-size: 0.9rem; }
.comment-content { color: #ddd; font-size: 0.95rem; }
.comment-time { font-size: 0.75rem; color: #666; text-align: right; margin-top: 5px; }

/* --- 7. Modal 彈窗樣式 --- */
.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.9); z-index: 2000;
    display: none; justify-content: center; align-items: center;
    padding: 20px; backdrop-filter: blur(5px);
}
.modal-content {
    background: #222; padding: 30px; border-radius: 15px;
    width: 100%; max-width: 400px;
    border: 1px solid var(--primary); position: relative; text-align: center;
}
.close-modal {
    position: absolute; top: 15px; right: 20px;
    font-size: 1.5rem; color: #fff; cursor: pointer;
}

/* 登入 Modal 特別樣式 */
.login-step { display: none; }
.login-step.active { display: block; }

/* 針對外部廣告彈窗的特製樣式 (加大版) */
#popup-ad .modal-content {
    max-width: 650px;
    width: 95%;
    padding: 20px;
}
#popup-media img, #popup-media video {
    width: 100%; height: auto; max-height: 70vh;
    object-fit: contain; border-radius: 8px; margin-bottom: 15px;
}
#popup-ad .close-modal {
    font-size: 2rem; top: 10px; right: 15px; z-index: 10;
    background: rgba(0,0,0,0.5); width: 30px; height: 30px;
    line-height: 25px; border-radius: 50%;
}

/* --- 8. 頁面切換 --- */
.page-section { display: none; animation: fadeIn 0.4s; }
.page-section.active { display: block; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* --- 9. RWD 響應式 --- */
@media (max-width: 768px) {
    header { padding: 0 20px; }
    .content-wrapper { padding: 20px; }
    .desktop-nav, .header-actions { display: none; }
    .hero-banner { height: 350px; }
    .hero-title { font-size: 2rem; }
    .hero-subtitle { font-size: 1rem; }
    .hero-content { left: 20px; bottom: 40px; }
    .grid-dj { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .grid-game { grid-template-columns: 1fr; }
}

/* --- 針對「精選活動」區塊的樣式 (一列 3 個大圖版) --- */

/* 1. 電腦版預設：強制一列 3 個 */
#external-ad-list {
    display: grid;
    grid-template-columns: repeat(3, 1fr); /* 這裡設定 3 欄，1fr 代表平分寬度 */
    gap: 25px; /* 卡片之間的間距 */
}

/* 2. 圖片比例設定 (16:9 寬螢幕比例) */
#external-ad-list .card-img-box.game {
    aspect-ratio: 16/9;
    width: 100%;
}

/* 3. 字體調整：讓標題比一般卡片稍微大一點 */
#external-ad-list .card-title {
    font-size: 1.35rem;
    margin-bottom: 10px;
}

/* --- RWD 響應式調整 --- */

/* 平板/小筆電 (螢幕寬度小於 1024px)：自動改為一列 2 個，避免太擠 */
@media (max-width: 1024px) {
    #external-ad-list {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* 手機版 (螢幕寬度小於 768px)：自動改為一列 1 個，佔滿畫面 */
@media (max-width: 768px) {
    #external-ad-list {
        grid-template-columns: 1fr;
    }
    /* 手機版字體可以稍微修小一點，比較協調 */
    #external-ad-list .card-title {
        font-size: 1.2rem;
    }
}

/* --- 針對「精選娛樂城」區塊的樣式 (一列 4 個版) --- */

/* 1. 電腦版大螢幕：強制設定為一列 4 個 */
#home-gambling-list {
    display: grid;
    grid-template-columns: repeat(4, 1fr); /* 這裡設定 4 欄，1fr 代表平分 */
    gap: 20px; /* 4張比較擠，間距稍微縮小一點 */
}

/* 2. 圖片比例維持 16:9 */
#home-gambling-list .card-img-box.game {
    aspect-ratio: 16/9;
    width: 100%;
}

/* 3. 字體調整：因為卡片變窄了，字體適中即可 */
#home-gambling-list .card-title {
    font-size: 1.15rem;
    margin-bottom: 8px;
}

/* --- RWD 響應式調整 (讓縮放更平滑) --- */

/* 筆電/平板橫放 (螢幕 < 1200px)：自動改為一列 3 個 */
@media (max-width: 1200px) {
    #home-gambling-list {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* 平板直立 (螢幕 < 900px)：自動改為一列 2 個 */
@media (max-width: 900px) {
    #home-gambling-list {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* 手機版 (螢幕 < 768px)：維持一列 1 個 */
@media (max-width: 768px) {
    #home-gambling-list {
        grid-template-columns: 1fr;
    }
}

/* --- 針對「熱門 DJ 陣容」區塊的樣式 (一列 4 個版) --- */

/* 1. 電腦版大螢幕：強制設定為一列 4 個 */
#home-dj-list {
    display: grid;
    grid-template-columns: repeat(4, 1fr); /* 設定 4 欄，平分寬度 */
    gap: 20px; /* 間距 */
}

/* 2. 圖片與卡片設定 */
/* DJ 的圖片通常是正方形 (1:1)，這裡確保它填滿格子 */
#home-dj-list .card-img-box {
    width: 100%;
    /* aspect-ratio: 1/1; (原本的全域樣式已有設定，這裡不需重複寫) */
}

/* --- RWD 響應式調整 (讓縮放更平滑) --- */

/* 筆電/平板橫放 (螢幕 < 1200px)：自動改為一列 3 個 */
@media (max-width: 1200px) {
    #home-dj-list {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* 平板直立 (螢幕 < 900px)：自動改為一列 2 個 */
@media (max-width: 900px) {
    #home-dj-list {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* 手機版 (螢幕 < 768px)：維持一列 1 個 (或您想在手機顯示2個也可以改成 repeat(2, 1fr)) */
@media (max-width: 768px) {
    #home-dj-list {
        grid-template-columns: 1fr; /* 一列一個 */
        gap: 15px;
        padding: 0 10px; /* 左右留一點白邊 */
    }

    #home-dj-list .card {
        max-width: 100%;
        margin: 0 auto;
    }

    /* 針對 DJ 頁面的列表容器 */
    .grid-dj, #dj-page-list {
        display: grid;
        /* 強制改為單欄 (一列一個) */
        grid-template-columns: 1fr;
        gap: 20px; /* 卡片間距加大一點，讓視覺更舒適 */
        padding: 0 10px; /* 左右留白，避免卡片貼邊 */
    }

    /* 確保卡片最大寬度，避免在平板直立時太寬 */
    .grid-dj .card {
        width: 100%;
        max-width: 450px; /* 限制最大寬度，避免在大手機上太巨大 */
        margin: 0 auto;   /* 置中 */
    }

    /* 確保圖片比例維持正方形 (1:1)，這是 DJ 卡片的標準比例 */
    .grid-dj .card-img-box {
        aspect-ratio: 1/1;
        width: 100%;
    }

    /* 字體大小微調 (單欄時空間夠，可以用正常大小) */
    .grid-dj .card-title {
        font-size: 1.2rem;
    }

    .grid-dj .card-desc {
        font-size: 0.9rem;
        height: auto; /* 單欄空間夠，可以讓描述完整顯示，或是設個上限 */
        max-height: 3.6em; /* 最多顯示 3 行 */
        overflow: hidden;
    }
}


/* --- 手機版側邊選單樣式 --- */

/* 漢堡按鈕 (預設隱藏，手機版顯示) */
.mobile-toggle {
    display: none;
    font-size: 1.5rem;
    color: #fff;
    cursor: pointer;
    padding: 10px;
}

/* 遮罩層 */
#mobile-menu-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.7); z-index: 1999;
    display: none; backdrop-filter: blur(3px);
}

/* 側邊選單本體 */
#mobile-menu-drawer {
    position: fixed; top: 0; right: -280px; /* 預設藏在右邊 */
    width: 280px; height: 100%;
    background: #1a1a1a;
    z-index: 2000;
    padding: 20px;
    transition: right 0.3s ease-in-out;
    border-left: 1px solid #333;
    display: flex; flex-direction: column;
}

/* 選單開啟狀態 */
#mobile-menu-drawer.active { right: 0; }

.drawer-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 30px;
}
.close-drawer { font-size: 1.5rem; color: #888; cursor: pointer; }

.drawer-nav a {
    display: block; padding: 15px 0;
    color: #ddd; font-size: 1.1rem;
    border-bottom: 1px solid #333;
}
.drawer-nav a i { width: 30px; color: var(--primary); }
.drawer-nav a:hover { color: var(--primary); padding-left: 10px; }

/* RWD 顯示控制 */
@media (max-width: 768px) {
    .mobile-toggle { display: block; }
    /* 原本的 header-actions 已經在之前的 CSS 被隱藏了 */
}