:root {
    --primary-bg: #d14b5f;
    --secondary-bg: #e66b7a;
    --sidebar-btn-start: #e97c88;
    --sidebar-btn-end: #d65a6b;
    --accent-yellow: #fdd835;
    --text-white: #ffffff;
    --nav-bg: #c04353;
}

* { box-sizing: border-box; margin: 0; padding: 0; font-family: 'Arial', sans-serif; }
body { background-color: var(--primary-bg); color: var(--text-white); display: flex; flex-direction: column; min-height: 100vh; overflow-x: hidden; }
a { text-decoration: none; color: inherit; }

/* Header */
.top-header { display: flex; justify-content: space-between; align-items: center; padding: 10px 20px; background-color: #b93b4d; height: 60px; position: sticky; top: 0; z-index: 1000; box-shadow: 0 2px 5px rgba(0,0,0,0.2); }

/* Logo Area */
.logo { font-size: 24px; font-weight: bold; display: flex; align-items: center; gap: 10px; }
.logo img { max-height: 40px; max-width: 180px; } /* 限制 Logo 圖片大小 */
.logo i { color: var(--accent-yellow); }

.auth-buttons { display: flex; gap: 10px; }
.btn-login { background: none; color: white; font-weight: bold; padding: 8px 15px; border: none; cursor: pointer; }
.btn-register { background-color: var(--accent-yellow); color: #b93b4d; font-weight: bold; padding: 8px 15px; border-radius: 5px; border: none; cursor: pointer; transition: transform 0.2s; }
.btn-register:hover { transform: scale(1.05); }

/* Notification */
.notification-bar { background-color: #e04f63; padding: 8px 20px; font-size: 14px; display: flex; align-items: center; gap: 10px; position: relative; z-index: 900; }
.notification-bar .fa-bullhorn { animation: ring 4s ease-in-out infinite; color: var(--accent-yellow); }
.marquee { flex: 1; white-space: nowrap; overflow: hidden; }
.marquee span { display: inline-block; animation: scroll 15s linear infinite; }
.info-btn { background: var(--accent-yellow); color: #333; padding: 2px 8px; border-radius: 3px; font-size: 12px; font-weight: bold; }

/* Layout */
.layout-container { display: flex; flex: 1; padding-bottom: 70px; }

/* Sidebar */
.sidebar { width: 240px; padding: 15px; display: flex; flex-direction: column; gap: 10px; flex-shrink: 0; overflow-y: auto; max-height: calc(100vh - 100px); }
.sidebar-btn { display: flex; align-items: center; padding: 12px 15px; background: linear-gradient(90deg, var(--sidebar-btn-start), var(--sidebar-btn-end)); border-radius: 8px; color: white; font-size: 14px; cursor: pointer; transition: transform 0.2s; opacity: 0; animation: slideIn 0.5s forwards; }
.sidebar-btn:nth-child(n) { animation-delay: calc(0.1s * var(--i)); }
.sidebar-btn:hover {
    /* 1. 重點：讓背景變成跟 btn-blue 一樣的藍色漸層 */
    background: linear-gradient(90deg, #4facfe, #00f2fe);

    /* 2. 保持原本的位移效果 (往上浮) */
    transform: translateY(-3px);

    /* 3. 確保文字顏色維持白色 */
    color: white;

    /* 4. (選用) 如果想要加強發光感，可以加這行 */
    box-shadow: 0 0 15px rgba(79, 172, 254, 0.6);
}

/* 確保原本的流光特效 (.before) 依然能在藍色背景上運作 */
.sidebar-btn:hover::before {
    left: 100%;
}
.sidebar-btn i { margin-right: 10px; font-size: 18px; width: 20px; text-align: center; }
.btn-blue { background: linear-gradient(90deg, #4facfe, #00f2fe); }
.lang-selector { margin-top: 20px; display: flex; justify-content: space-between; align-items: center; padding: 10px; background: rgba(0,0,0,0.1); border-radius: 5px; cursor: pointer; }

/* Main Content */
.main-content { flex: 1; padding: 15px; overflow-y: auto; }

/* Hero Banner Slider */
.hero-banner { position: relative; width: 100%; height: 480px; border-radius: 15px; overflow: hidden; margin-bottom: 20px; background: #222; box-shadow: 0 4px 15px rgba(0,0,0,0.2); }
.banner-slides, .slide { width: 100%; height: 100%; position: relative; }
.slide { position: absolute; top: 0; left: 0; opacity: 0; transition: opacity 0.8s; }
.slide.active { opacity: 1; z-index: 1; }
.slide a {
    display: block;
    width: 100%;
    height: 100%;
    cursor: pointer;
}
.slide img { width: 100%; height: 100%; object-fit: cover;  display: block;  }
.banner-nav-dots { position: absolute; bottom: 15px; left: 50%; transform: translateX(-50%); display: flex; gap: 8px; z-index: 2; }
.dot { width: 10px; height: 10px; background: rgba(255,255,255,0.5); border-radius: 50%; cursor: pointer; transition: 0.3s; }
.dot.active { background: #fff; transform: scale(1.3); }

/* Filters & Grid */
.game-filters { background: rgba(255,255,255,0.15); padding: 10px; border-radius: 10px; display: flex; justify-content: space-between; margin-bottom: 20px; }
.filter-tabs { display: flex; gap: 15px; overflow-x: auto; }
.filter-item { display: flex; align-items: center; gap: 5px; font-size: 13px; opacity: 0.7; cursor: pointer; white-space: nowrap; }
.filter-item.active { font-weight: bold; opacity: 1; color: var(--accent-yellow); border-bottom: 2px solid var(--accent-yellow); }

.section-header { display: flex; justify-content: space-between; margin-bottom: 15px; }
.games-grid { display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 15px;}
.game-card {  border-radius: 12px;
    overflow: hidden;
    transition: transform 0.2s;
    position: relative;
    cursor: pointer;
    aspect-ratio: 1 / 1;

    /* 新增：讓縮小後的圖片置中 */
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: rgba(255, 255, 255, 0.1); /* (選用) 加個半透明底色 */ }
.game-card:hover { transform: scale(1.05); }
.game-card::before { content: ''; position: absolute; top: 0; left: -75%; width: 50%; height: 100%; background: linear-gradient(to right, transparent, rgba(255,255,255,0.4)); transform: skewX(-25deg); transition: .5s; pointer-events: none; }
.game-card:hover::before { left: 125%; }
.game-card img {  width: 85%;  /* 從 100% 改成 85% (或你自己喜歡的大小) */
    height: 85%; /* 跟寬度一樣，保持正方形 */
    object-fit: cover;
    display: block;
    border-radius: 8px; /* (選用) 幫圖片本身也加一點圓角 */ }
.game-tag { position: absolute; top: 5px; right: 5px; background: red; color: white; font-size: 11px; padding: 3px 6px; border-radius: 4px; font-weight: bold; }
#live-jackpot { background: linear-gradient(45deg, #ffd700, #ff8c00); color: #b90000; border: 1px solid white; min-width: 70px; text-align: center; }

/* Floating & Bottom Nav */
.floating-actions { position: fixed; right: 20px; bottom: 100px; display: flex; flex-direction: column; gap: 15px; z-index: 990; }
.float-btn { width: 55px; height: 55px; border-radius: 50%; display: flex; justify-content: center; align-items: center; font-size: 26px; color: white; cursor: pointer; box-shadow: 0 4px 10px rgba(0,0,0,0.3); border: 2px solid rgba(255,255,255,0.2); transition: transform 0.2s; }
.float-btn:hover { transform: scale(1.1); }
.fb-wheel { background: linear-gradient(45deg, #FF512F, #DD2476); }
.fb-wheel i { animation: spin 4s linear infinite; }
.fb-cal { background: linear-gradient(45deg, #DA22FF, #9733EE); }
.fb-support { background: linear-gradient(45deg, #ff9966, #ff5e62); }

.bottom-nav { position: fixed; bottom: 0; left: 0; width: 100%; height: 65px; background: var(--nav-bg); display: flex; justify-content: space-around; align-items: center; z-index: 1000; }
.nav-item { display: flex; flex-direction: column; align-items: center; color: rgba(255,255,255,0.6); font-size: 11px; cursor: pointer; flex: 1; }
.nav-item.active { color: #fff; transform: translateY(-5px); }
.nav-item.active i { color: var(--accent-yellow); }
.nav-item i { font-size: 22px; }
.game-section {
    margin-bottom: 40px;
}
.game-section:last-child {
    margin-bottom: 0;
}

/* 側邊欄圖片容器 */
.sidebar-banners {
    margin-top: 15px;      /* 與上方按鈕保持距離 */
    display: flex;
    flex-direction: column; /* 讓圖片垂直排列 */
    gap: 12px;             /* 圖片之間的間距 */
}

/* 圖片樣式 */
.banner-item img {
    width: 100%;           /* 寬度自動填滿 Sidebar */
    height: auto;          /* 高度自動計算，保持比例 */
    border-radius: 10px;   /* 圓角 */
    display: block;        /* 消除圖片下方空隙 */
    box-shadow: 0 4px 6px rgba(0,0,0,0.1); /* 陰影效果 */
    transition: transform 0.2s, filter 0.2s;
}

/* 滑鼠懸停效果 */
.banner-item:hover img {
    transform: scale(1.03); /* 輕微放大 */
    filter: brightness(1.1); /* 稍微變亮 */
}

/* 遮罩層樣式 (預設隱藏) */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5); /* 半透明黑 */
    z-index: 1090; /* 比 sidebar 小一點，但比 header 大 */
    opacity: 0;
    visibility: hidden;
    transition: 0.3s;
}

/* 當遮罩層被啟動時 */
.sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* --- 手機版 RWD 設定 --- */
@media (max-width: 768px) {
    /* 1. 顯示漢堡選單按鈕 */
    #menu-btn {
        display: block !important;
        font-size: 24px;
    }

    /* 2. 修改 Sidebar 行為：從 display:none 改為 滑動抽屜 */
    .sidebar {
        display: flex !important; /* 強制顯示，因為原本你設了 none */
        position: fixed;
        top: 0;
        left: -280px; /* 預設藏在左邊螢幕外面 (寬度要比 sidebar 寬一點) */
        height: 100vh;
        width: 260px; /* 設定手機版側邊欄寬度 */
        z-index: 1100; /* 最上層，蓋過 Header */
        background-color: var(--primary-bg); /* 確保有背景色，不然會透明 */
        box-shadow: 2px 0 10px rgba(0,0,0,0.5);
        transition: left 0.3s ease-in-out; /* 滑動動畫 */
    }

    /* 3. 當 Sidebar 被加上 active class 時，滑出來 */
    .sidebar.active {
        left: 0;
    }
}

/* 包覆層：設為 relative 以便內部的絕對定位參考 */
.lang-wrapper {
    position: relative;
    margin-top: auto; /* 確保它推到 Sidebar 最底部 */
}

/* 原本的選擇器樣式 (微調) */
.lang-selector {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    background: rgba(0,0,0,0.2);
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
    color: white;
}

.lang-selector:hover {
    background: rgba(0,0,0,0.3);
}

/* 下拉選單 (核心部分) */
.lang-dropdown {
    position: absolute;

    /* --- 修改 1：位置 --- */
    top: 100%;       /* 設定為 100% 代表緊貼在按鈕底部 */
    margin-top: 5px; /* 加一點間距，不要黏太緊 */
    bottom: auto;    /* 覆蓋掉原本的 bottom 設定，避免衝突 */

    left: 0;
    width: 100%;
    background: #fff;
    color: #333;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    overflow: hidden;

    /* 預設隱藏狀態 */
    opacity: 0;
    visibility: hidden;

    /* --- 修改 2：動畫方向 --- */
    /* 設定 -10px，讓它預設位置稍微偏上，展開時會有「滑下來」的感覺 */
    transform: translateY(-10px);

    transition: all 0.2s ease-in-out;
    z-index: 100;
}

/* 當選單被啟動時 (.active) */
.lang-dropdown.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* 選單選項樣式 */
.lang-option {
    padding: 12px 15px;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 14px;
    border-bottom: 1px solid #eee;
}

.lang-option:last-child {
    border-bottom: none;
}

.lang-option:hover {
    background-color: #f0f0f0;
}

/* 讓箭頭選轉的動畫 */
.lang-selector .fa-chevron-down {
    transition: transform 0.3s;
}
.lang-selector.active .fa-chevron-down {
    transform: rotate(180deg);
}



@media (max-width: 768px) {
    .sidebar { display: none; }
    /* 修改這裡：改成 3 或是 4 */
    .games-grid { grid-template-columns: repeat(3, 1fr); }
    .hero-banner { height: 300px; }
}

@keyframes scroll { 0% { transform: translateX(100%); } 100% { transform: translateX(-100%); } }
@keyframes slideIn { from { opacity: 0; transform: translateX(-30px); } to { opacity: 1; transform: translateX(0); } }
@keyframes ring { 0%,100% { transform: rotate(0); } 5% { transform: rotate(20deg); } 10% { transform: rotate(-18deg); } 15% { transform: rotate(16deg); } 20% { transform: rotate(-14deg); } 25% { transform: rotate(12deg); } 30% { transform: rotate(-10deg); } }
@keyframes spin { 100% { transform: rotate(360deg); } }