body {
    font-family: Arial, sans-serif;
    /* background-color: #4CAF50; */
    margin: 0;
    padding: 0;
}

header {
    width: 100%;
    text-align: right;
    padding: 10px;
    position: fixed;
    top: 0;
    right: 20px;
    z-index: 9999; /* 確保在所有元素上層 */
}
@media (max-width: 767px) {
    header {
        right: 0;
    }
}
.menu-container {
    position: absolute; /* Use absolute positioning for fine-tuning */
    top: 22px; /* Adjust as needed */
    right: 20px; /* Adjust as needed */
}

.menu-icon {
    cursor: pointer;
    display: inline-block;
    z-index: 2; /* Ensure the menu icon stays on top */
}

.menu-icon div {
    width: 35px;
    height: 5px;
    background-color: white;
    margin: 6px 0;
    transition: 0.4s;
    border-radius: 5px;
}

.change .bar1 {
    -webkit-transform: rotate(-45deg) translate(-9px, 6px);
    transform: rotate(-45deg) translate(-9px, 6px);
}

.change .bar2 {
    opacity: 0;
}

.change .bar3 {
    -webkit-transform: rotate(45deg) translate(-8px, -8px);
    transform: rotate(45deg) translate(-8px, -8px);
}

.menu {
    display: none; /* Hidden by default */
    position: absolute;
    right: 0; /* Align with the menu icon */
    top: 50px; /* Position below the menu icon */
    background-color: rgba(45, 48, 58, 0.9);
    box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
    z-index: 1;
    padding: 10px;
    border-radius: 8px;
}

.menu ul {
    list-style-type: none;
    padding: 0;
    margin: 0;
}

/* 1. 外層框：取消 padding，讓邊框與形狀維持原樣 */
.menu ul li:not(.awards-menu-item) {
    padding: 0;                    /* 👈 關鍵：把 padding 給裡面的超連結 */
    text-align: center;
    border-radius: 6px;
    border: 1px solid transparent; /* 預留 1px 透明邊框防止跳動 */
    transition: all 0.25s ease;
    cursor: pointer;
}

/* 2. 超連結：繼承原本的 padding 並撐滿整顆按鈕 */
.menu ul li:not(.awards-menu-item) a {
    color: #cbd5e1;
    text-decoration: none;
    display: block;                /* 👈 關鍵：變成完整區塊元素 */
    width: 100%;
    padding: 12px 16px;            /* 👈 關鍵：原本的上下左右留白改由 a 撐開 */
    box-sizing: border-box;
    transition: all 0.25s ease;
}

/* 2. 電光藍綠 Hover 效果（只作用在 HOME、GAMES、LEGAL 等文字連結） */
.menu ul li:not(.awards-menu-item):hover {
    background-color: rgba(0, 240, 255, 0.08);
    border-color: rgba(0, 240, 255, 0.2);
    box-shadow: 0 0 5px rgba(0, 240, 255, 0.25);
}

.menu ul li:not(.awards-menu-item):hover a {
    color: #00f0ff;
    text-shadow: 0 0 5px rgba(0, 240, 255, 0.6);
}

.character {
    text-align: center;
    margin: 20px 0;
}

/* --- Legal Modal 遮罩層 (預設隱藏) --- */
.legal-modal-overlay {
  display: none; 
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(8px);
  z-index: 99999;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.legal-modal-overlay.active {
  display: flex;
  opacity: 1;
}

/* --- 彈窗內容區塊 (加入邊框與陰影) --- */
.legal-modal-content {
  background-color: #2a2d34;
  color: #ffffff;
  padding: 35px 25px 25px 25px;
  width: 90%;
  max-width: 600px;
  max-height: 80vh;
  overflow-y: auto;
  border-radius: 12px;
  position: relative;
  font-family: Arial, sans-serif;
  line-height: 1.6;
  box-sizing: border-box;
  
  /* 更新：邊框加粗到 2px，並調整半透明度 (0.2) 讓質感更好 */
  border: 5px solid rgba(255, 255, 255, 0.1); 
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.5); 
}

.legal-modal-content::-webkit-scrollbar {
  width: 6px;
}
.legal-modal-content::-webkit-scrollbar-thumb {
  background-color: #555;
  border-radius: 10px;
}

/* --- 關閉按鈕 --- */
.close-btn {
  position: absolute;
  top: 0px;    /* 距離面板頂部的距離，數字越小越靠上 */
  right: 0px;  /* 距離面板右側的距離，數字越小越靠右 */
  z-index: 10;
  
  /* 關鍵 1：建立一個 48x48 的完美正方形感應區 (符合蘋果/Google的觸控標準) */
  width: 48px;  
  height: 48px; 
  
  /* 關鍵 2：使用 Flexbox 讓裡面的 X 絕對水平與垂直置中 */
  display: flex;
  align-items: center;
  justify-content: center;
  
  font-size: 32px;
  line-height: 1; /* 關鍵 3：消除字體預設行高造成的偏移 */
  color: #fff;
  background: transparent;
  border: none;
  cursor: pointer;
  transition: color 0.2s;
  -webkit-tap-highlight-color: transparent; 
}
.close-btn:hover {
  color: #ff5588;
}

/* --- 文字排版微調 --- */
.legal-text {
  text-align: left; 
}

.legal-text h3 { 
  margin-top: 0;
  margin-bottom: 15px; 
  color: #87CEFA; 
  font-size: 1.5rem; /* 字體可以稍微加大一點點 */
  text-align: center; /* 更新：主標題置中 */
}

.legal-text h4 { 
  margin-top: 20px; 
  margin-bottom: 5px; 
  font-size: 1.1rem;
  color: #ddd;
  text-align: left; /* 標題靠左 */
}

.legal-text p { 
  font-size: 0.9rem; 
  color: #bbb; 
  margin-top: 0;
  text-align: justify; /* 內文滿行左右對齊，最後一行自動靠左 */
}
.legal-text hr { 
  border: 0; 
  border-top: 1px solid #444; 
  margin: 25px 0; 
}

.legal-link {
  color: #87CEFA; /* 呼應主標題的淺藍色 */
  text-decoration: none; /* 預設拿掉底線比較乾淨 */
  transition: color 0.2s, text-decoration 0.2s;
}

.legal-link:hover {
  color: #57ff48; /* 滑鼠移過去變色，增加互動感 */
  text-decoration: underline;
}

@media (max-width: 480px) {
  /* 讓彈窗在手機上靠上對齊，不再強制垂直置中 */
  .legal-modal-overlay {
    align-items: flex-start; /* 從 center 改為靠上對齊 */
    padding-top: 5vh; /* 距離頂部留 5% 的呼吸空間，也可以避開手機瀏海 */
  }

  .legal-modal-content {
    padding: 30px 15px 20px 15px;
    width: 90%;
    max-height: 80vh; /* 因為靠上了，高度可以大膽拉長到 90%，減少捲軸出現的機率 */
  }
  
  .legal-text h3 { font-size: 1.25rem; }
  .legal-text h4 { font-size: 1rem; }
  .legal-text p { font-size: 0.85rem; }
}

/* ============================================================
   🔥 橫向手機模式專用：選單內部滑動防切斷 (零干擾 PC 與直式)
   ============================================================ */
@media screen and (max-height: 500px) and (orientation: landscape) {
    .menu {
        max-height: 60vh !important;  /* 限制選單高度為螢幕高度的 75%，保留底部空間 */
        overflow-y: auto !important;  /* 內容超過高度時，啟動內部上下滑動 */
        
        /* Firefox 捲軸優化 */
        scrollbar-width: thin;
        scrollbar-color: #555 transparent;
    }

    /* WebKit (Chrome/Safari/iOS) 專屬捲軸美化：讓它變得細緻低調，融入黑底 */
    .menu::-webkit-scrollbar {
        width: 4px;
    }
    .menu::-webkit-scrollbar-track {
        background: transparent; 
    }
    .menu::-webkit-scrollbar-thumb {
        background: rgba(255, 255, 255, 0.3); 
        border-radius: 4px;
    }
}

/* 外層容器：尺寸與滑鼠感應區 100% 固定，絕對不移動 */
.menu ul li.awards-menu-item {
    color: #ffb703;
    font-weight: 900;
    font-size: 15px;
    letter-spacing: 1.5px;
    cursor: pointer;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 6px;
    padding-bottom: 12px;
    position: relative;
    overflow: hidden; /* 確保飛出去的獎盃不會超出選單邊界 */
    text-align: center !important;
}

/* 內層容器：負責執行動畫 */
.menu ul li.awards-menu-item .awards-inner {
    display: inline-block;
    transition: color 0.3s ease;
}

/* Hover 時，外層感應區不動，只讓內層執行躍遷動畫 */
.menu ul li.awards-menu-item:hover .awards-inner {
    color: #ffffff;
    text-shadow: 0 0 12px rgba(255, 183, 3, 0.9);
    animation: trophyJump 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* 向上飛出並從下方回歸的 Keyframe */
@keyframes trophyJump {
    0% {
        transform: translateY(0);
        opacity: 1;
    }
    35% {
        transform: translateY(-25px); /* 向上飛出 */
        opacity: 0;
    }
    36% {
        transform: translateY(25px);  /* 瞬移至下方預備 */
        opacity: 0;
    }
    100% {
        transform: translateY(0);    /* 順暢彈回原位 */
        opacity: 1;
    }
}

/* 🌟 最快修復：讓獎盃圖標獨立成塊並留出下方間距 */
.menu ul li.awards-menu-item .trophy-icon {
    display: block !important;
    margin-bottom: 8px !important; /* 👈 留出與 AWARDS 文字的完美空隙 */
    font-size: 17px !important;    /* 確保獎盃大小適中 */
    line-height: 1 !important;
}

/* ==========================================================================
   桌機專屬：漢堡免死金牌（延長優雅淡入時間 + 徹底根除退場回彈跳動）
   ========================================================================== */
@media screen and (min-width: 769px) {

    /* 🌟 1. 全域解除 header 的位移抽飛 */
    html body.nav-hidden header,
    html body.nav-is-hidden header,
    html body header {
        transform: none !important;
        opacity: 1 !important;
        pointer-events: none !important;
    }

    /* 🌟 2. 漢堡退場時（未 active 時）：
       - 強制將 container 與 menu-icon 鎖死在 -4px！
       - 徹底粉碎 honors.css 的 translateY(-160%) 抽飛與彈回跳動！
       - 退場時間放寬至 0.45s，原地柔和散去
    🌟 */
    html body .menu-container,
    html body .menu-container .menu-icon,
    html body .menu-container .menu-icon.nav-is-hidden,
    html body .menu-container #menu-icon {
        opacity: 0 !important;
        visibility: hidden !important;
        pointer-events: none !important;
        transform: translateY(-4px) !important;
        transition: opacity 0.45s cubic-bezier(0.25, 1, 0.5, 1), 
                    transform 0.45s cubic-bezier(0.25, 1, 0.5, 1), 
                    visibility 0.45s cubic-bezier(0.25, 1, 0.5, 1) !important;
    }

    /* 基礎定位常駐鎖定在右上角 */
    html body .menu-container {
        position: fixed !important;
        top: 22px !important;
        right: 28px !important;
        left: auto !important;
        bottom: auto !important;
        z-index: 99999999 !important;
    }

    /* 🌟 3. 漢堡進場時（帶有 nav-is-active）：
       - 淡入時間加長至 0.55s（緩慢悠閒優雅浮現）
       - 絲滑降到 translateY(0)
    🌟 */
    html body .menu-container.nav-is-active,
    html body .menu-container.nav-is-active .menu-icon,
    html body .menu-container.nav-is-active .menu-icon.nav-is-hidden,
    html body .menu-container.nav-is-active #menu-icon {
        opacity: 1 !important;
        visibility: visible !important;
        pointer-events: auto !important;
        transform: translateY(0) !important;
        transition: opacity 0.55s cubic-bezier(0.16, 1, 0.3, 1), 
                    transform 0.55s cubic-bezier(0.16, 1, 0.3, 1) !important;
    }
}/* ==========================================================================
   桌機專屬：漢堡免死金牌（延長優雅淡入時間 + 徹底根除退場回彈跳動）
   ========================================================================== */
@media screen and (min-width: 769px) {

    /* 🌟 1. 全域解除 header 的位移抽飛 */
    html body.nav-hidden header,
    html body.nav-is-hidden header,
    html body header {
        transform: none !important;
        opacity: 1 !important;
        pointer-events: none !important;
    }

    /* 🌟 2. 漢堡退場時（未 active 時）：
       - 強制將 container 與 menu-icon 鎖死在 -4px！
       - 徹底粉碎 honors.css 的 translateY(-160%) 抽飛與彈回跳動！
       - 退場時間放寬至 0.45s，原地柔和散去
    🌟 */
    html body .menu-container,
    html body .menu-container .menu-icon,
    html body .menu-container .menu-icon.nav-is-hidden,
    html body .menu-container #menu-icon {
        opacity: 0 !important;
        visibility: hidden !important;
        pointer-events: none !important;
        transform: translateY(-4px) !important;
        transition: opacity 0.45s cubic-bezier(0.25, 1, 0.5, 1), 
                    transform 0.45s cubic-bezier(0.25, 1, 0.5, 1), 
                    visibility 0.45s cubic-bezier(0.25, 1, 0.5, 1) !important;
    }

    /* 基礎定位常駐鎖定在右上角 */
    html body .menu-container {
        position: fixed !important;
        top: 22px !important;
        right: 28px !important;
        left: auto !important;
        bottom: auto !important;
        z-index: 99999999 !important;
    }

    /* 🌟 3. 漢堡進場時（帶有 nav-is-active）：
       - 淡入時間加長至 0.55s（緩慢悠閒優雅浮現）
       - 絲滑降到 translateY(0)
    🌟 */
    html body .menu-container.nav-is-active,
    html body .menu-container.nav-is-active .menu-icon,
    html body .menu-container.nav-is-active .menu-icon.nav-is-hidden,
    html body .menu-container.nav-is-active #menu-icon {
        opacity: 1 !important;
        visibility: visible !important;
        pointer-events: auto !important;
        transform: translateY(0) !important;
        transition: opacity 0.55s cubic-bezier(0.16, 1, 0.3, 1), 
                    transform 0.55s cubic-bezier(0.16, 1, 0.3, 1) !important;
    }
}

/* 🌟 768px 以下（手機／小平板）：顯示漢堡選單 */
@media screen and (max-width: 768px) {
    .menu-container,
    .menu-icon {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
        pointer-events: auto !important;
    }
}

/* ==========================================================================
   漢堡選單：純 Transition 3D 平滑翻轉（外層感應鎖死，徹底根除連續轉兩次與中斷問題）
   ========================================================================== */

/* 1. 外層感應熱區：確保 3D 透視，且熱區面積永遠實心固定，絕不中斷判定 */
.menu-icon {
    perspective: 500px !important;
    transform-style: preserve-3d !important;
}

/* 2. 平常/離開狀態（Mouse Leave）：三條線依序（下至上）慢速翻回 0deg */
@media screen and (min-width: 769px) {
    .menu-icon:not(.change) .bar1 {
        transform: rotateY(0deg) !important;
        transition: transform 0.9s cubic-bezier(0.25, 1, 0.5, 1) 0.3s !important;
    }
    .menu-icon:not(.change) .bar2 {
        transform: rotateY(0deg) !important;
        transition: transform 0.9s cubic-bezier(0.25, 1, 0.5, 1) 0.15s !important;
    }
    .menu-icon:not(.change) .bar3 {
        transform: rotateY(0deg) !important;
        transition: transform 0.9s cubic-bezier(0.25, 1, 0.5, 1) 0s !important;
    }

    /* 3. 移入狀態（Hover）：由外層 menu-icon 觸發，三條線依序（上至下）從容翻轉 180 度 */
    .menu-icon:not(.change):hover .bar1 {
        transform: rotateY(180deg) !important;
        transition: transform 0.9s cubic-bezier(0.25, 1, 0.5, 1) 0s !important;
    }
    .menu-icon:not(.change):hover .bar2 {
        transform: rotateY(180deg) !important;
        transition: transform 0.9s cubic-bezier(0.25, 1, 0.5, 1) 0.15s !important;
    }
    .menu-icon:not(.change):hover .bar3 {
        transform: rotateY(180deg) !important;
        transition: transform 0.9s cubic-bezier(0.25, 1, 0.5, 1) 0.3s !important;
    }
}

/* ==========================================================================
   4. 點擊展開變正 X：bar1 為 1.5s 慢速，bar3 為 0.4s 快速到位
   ========================================================================== */

/* 上線：1.5s 慢速滑入旋轉 */
.change .bar1 {
    -webkit-transform: rotate(-45deg) translate(-9px, 6px) !important;
    transform: rotate(-45deg) translate(-9px, 6px) !important;
    transition: transform 1.5s cubic-bezier(0.2, 0.8, 0.2, 1) !important;
}

/* 中線：淡出 */
.change .bar2 {
    opacity: 0 !important;
    transition: opacity 0.4s ease !important;
}

/* 下線：0.4s 快速到位 */
.change .bar3 {
    -webkit-transform: rotate(45deg) translate(-8px, -8px) !important;
    transform: rotate(45deg) translate(-8px, -8px) !important;
    transition: transform 0.4s cubic-bezier(0.25, 1, 0.5, 1) !important;
}

.legal-collab-btn {
    background: transparent;
    color: #ffffff;
    font-size: 13px;
    font-weight: 700;
    font-family: 'Comfortaa', sans-serif, 'Arial Black';
    letter-spacing: 2px;
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 8px;
    padding: 8px 18px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    transition: all 0.25s ease;
}

.legal-collab-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: #00ffff;
    color: #00ffff;
    box-shadow: 0 0 15px rgba(0, 255, 255, 0.4);
    transform: translateY(-2px);
}
