/* ============================================================
手機快捷側邊選單 — 藍金色系 / iOS 毛玻璃
v3: 對齊首頁改版 --color-bg / 金色系
只在 max-width:768px 顯示
============================================================ */

/* ── 主題色變數（局部作用域） ── */
#mobile-quick-menu-wrap,
#mqm-overlay {
    --mqm-bg: #0b1833;
    --mqm-nav: #101f3d;
    --mqm-gold: rgba(215, 177, 106, 0.92);
    --mqm-gold-dim: rgba(199, 164, 95, 0.22);
    --mqm-gold-glow: rgba(215, 177, 106, 0.42);
    --mqm-w82: rgba(255, 248, 244, 0.88);
    --mqm-w55: rgba(229, 213, 178, 0.72);
    --mqm-w14: rgba(199, 164, 95, 0.28);
    --mqm-w08: rgba(199, 164, 95, 0.12);
    --mqm-b55: rgba(0, 0, 0, 0.55);
    --mqm-b80: rgba(0, 0, 0, 0.80);
}

/* ── 顯隱控制（手機優先，避免舊版 .home-rzu-shell 隱藏規則誤殺） ── */
#mobile-quick-menu-wrap {
    display: flex;
}

#mqm-overlay {
    display: block;
}

@media (min-width: 769px) {
    #mobile-quick-menu-wrap,
    #mqm-overlay {
        display: none !important;
    }
}

/* ── Keyframes ── */
@keyframes mqm-breathe {

    0%,
    100% {
        opacity: 0.20;
        transform: translateY(-50%) scaleY(1);
    }

    50% {
        opacity: 0.55;
        transform: translateY(-50%) scaleY(1.12);
    }
}

/* 每個 item 從右側飛入 */
@keyframes mqm-flyIn {
    from {
        opacity: 0;
        transform: translateX(22px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ── 背景遮罩 ── */
#mqm-overlay {
    position: fixed;
    inset: 0;
    background: transparent;
    z-index: 1040;
    pointer-events: none;
    transition: background 0.35s ease;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
}

#mqm-overlay.mqm-open {
    background: rgba(0, 0, 0, 0.52);
    -webkit-backdrop-filter: blur(2.5px);
    backdrop-filter: blur(2.5px);
    pointer-events: all;
}

/* ── 側邊容器：固定右側、垂直置中、避開底部 nav ── */
#mobile-quick-menu-wrap {
    position: fixed;
    right: 0;
    top: 50%;
    transform: translateY(-56px);
    /* 稍微往上偏，視覺偏中段 */
    z-index: 1050;
    flex-direction: row;
    align-items: center;
    /* 容器本身不吃觸控：收起時 #mqm-items 仍佔版面寬度，會把容器邊界框撐寬而攔截後方觸控。
       只讓「把手」與「展開後的項目」吃觸控即可。 */
    pointer-events: none;
}

/* ── 選單項目容器 ── */
#mqm-items {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
    padding-right: 4px;
    /* 收起：整體往右滑出 */
    transform: translateX(calc(100% + 24px));
    opacity: 0;
    pointer-events: none;
    transition:
        transform 0.40s cubic-bezier(0.16, 1, 0.3, 1),
        opacity 0.32s ease;
}

#mqm-items.mqm-open {
    transform: translateX(0);
    opacity: 1;
    pointer-events: all;
}

/* ── 單一項目列 ── */
.mqm-item {
    display: flex;
    align-items: center;
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
    /* 展開時逐一飛入 */
    animation: mqm-flyIn 0.38s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.mqm-item:active {
    opacity: 0.72;
    transform: scale(0.95);
}

/* ── 文字標籤膠囊（左側） ── */
.mqm-tag {
    margin-right: 8px;
    padding: 6px 14px;
    border-radius: 20px;
    background: rgba(11, 24, 48, 0.9);
    -webkit-backdrop-filter: blur(20px) saturate(160%);
    backdrop-filter: blur(20px) saturate(160%);
    border: 1px solid var(--mqm-w14);
    color: var(--mqm-w82);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.025em;
    white-space: nowrap;
    box-shadow:
        0 2px 10px rgba(0, 0, 0, 0.45),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
    transition: background 0.2s ease, border-color 0.2s ease;
}

.mqm-item:active .mqm-tag {
    background: rgba(22, 38, 68, 0.95);
    border-color: var(--mqm-gold-dim);
    color: #fff8f4;
}

/* ── Icon 方塊（右側，正方形） ── */
.mqm-icon-box {
    position: relative;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background:
        linear-gradient(145deg,
            rgba(215, 177, 106, 0.16) 0%,
            rgba(11, 24, 48, 0.96) 62%);
    -webkit-backdrop-filter: blur(20px) saturate(160%);
    backdrop-filter: blur(20px) saturate(160%);
    border: 1px solid var(--mqm-w14);
    color: var(--mqm-gold);
    font-size: 16px;
    box-shadow:
        0 4px 16px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.08);
    transition:
        background 0.22s ease,
        border-color 0.22s ease,
        box-shadow 0.22s ease;
}

/* 頂部玻璃高光 */
.mqm-icon-box::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 48%;
    background: linear-gradient(180deg,
            rgba(255, 255, 255, 0.09) 0%,
            rgba(255, 255, 255, 0) 100%);
    pointer-events: none;
}

.mqm-item:active .mqm-icon-box {
    background:
        linear-gradient(145deg,
            rgba(215, 177, 106, 0.32) 0%,
            rgba(11, 24, 48, 0.96) 62%);
    border-color: rgba(215, 177, 106, 0.55);
    box-shadow:
        0 4px 16px rgba(0, 0, 0, 0.5),
        0 0 12px var(--mqm-gold-glow),
        inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

/* ── 把手包裝 ── */
#mqm-handle-wrap {
    position: relative;
    display: flex;
    align-items: center;
    pointer-events: auto;
    /* 把手要可點（容器是 none）*/
}

/* 呼吸燈：金色光暈，貼把手左緣向外擴散 */
#mqm-handle-glow {
    position: absolute;
    top: 50%;
    right: 0;
    transform: translateY(-50%);
    width: 32px;
    height: 64px;
    background: radial-gradient(ellipse at right center,
            var(--mqm-gold-glow) 0%,
            rgba(215, 177, 106, 0.12) 55%,
            transparent 80%);
    filter: blur(5px);
    border-radius: 50% 0 0 50%;
    animation: mqm-breathe 2.6s ease-in-out infinite;
    pointer-events: none;
    z-index: 0;
    transition: opacity 0.30s ease;
}

#mqm-handle-glow.mqm-hidden {
    opacity: 0;
    animation-play-state: paused;
}

/* 把手本體：金色立體膠囊，貼右邊緣 */
#mqm-handle-btn {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 54px;
    border-radius: 10px 0 0 10px;
    background:
        linear-gradient(
            180deg,
            #f8e6b8 0%,
            #e9d29a 18%,
            #d9bf7d 48%,
            #c9a35a 78%,
            #a98843 100%
        );
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    border-top: 1px solid rgba(255, 248, 230, 0.85);
    border-left: 1px solid rgba(248, 230, 184, 0.7);
    border-bottom: 1px solid rgba(90, 68, 28, 0.55);
    border-right: none;
    box-shadow:
        -3px 2px 10px rgba(0, 0, 0, 0.42),
        -1px 0 6px rgba(201, 163, 90, 0.35),
        inset 1px 1px 0 rgba(255, 255, 255, 0.55),
        inset -1px -2px 4px rgba(90, 68, 28, 0.35),
        inset 0 -3px 6px rgba(0, 0, 0, 0.18);
    cursor: pointer;
    outline: none;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
    transition:
        height 0.40s cubic-bezier(0.4, 0, 0.2, 1),
        background 0.25s ease,
        border-color 0.25s ease,
        box-shadow 0.25s ease,
        filter 0.2s ease;
}

#mqm-handle-btn.mqm-expanded {
    background:
        linear-gradient(
            180deg,
            #fff2cc 0%,
            #f0d9a0 22%,
            #d9bf7d 52%,
            #be9446 100%
        );
    border-top-color: rgba(255, 252, 240, 0.95);
    border-left-color: rgba(248, 230, 184, 0.88);
    border-bottom-color: rgba(90, 68, 28, 0.5);
    box-shadow:
        -3px 2px 12px rgba(0, 0, 0, 0.45),
        -2px 0 10px rgba(215, 177, 106, 0.4),
        inset 1px 1px 0 rgba(255, 255, 255, 0.62),
        inset -1px -2px 4px rgba(90, 68, 28, 0.32),
        inset 0 -3px 6px rgba(0, 0, 0, 0.16);
}

#mqm-handle-btn:active {
    background:
        linear-gradient(
            180deg,
            #c9a35a 0%,
            #a98843 45%,
            #8f7238 100%
        );
    border-top-color: rgba(201, 163, 90, 0.55);
    border-bottom-color: rgba(60, 45, 18, 0.6);
    box-shadow:
        -2px 1px 6px rgba(0, 0, 0, 0.4),
        inset 0 2px 5px rgba(0, 0, 0, 0.28),
        inset 1px 0 0 rgba(255, 255, 255, 0.2);
    filter: brightness(0.96);
}

/* 把手內豎條（深色線條壓在金底上） */
#mqm-handle-bar {
    width: 2px;
    height: 22px;
    background: linear-gradient(180deg,
            rgba(45, 32, 12, 0.25) 0%,
            rgba(45, 32, 12, 0.72) 50%,
            rgba(45, 32, 12, 0.25) 100%);
    border-radius: 99px;
    box-shadow: 0 0 0 1px rgba(255, 248, 230, 0.2);
    transition:
        height 0.40s cubic-bezier(0.4, 0, 0.2, 1),
        background 0.25s ease;
    flex-shrink: 0;
}

/* ============================================================
RTP 排行彈窗 ── 藍金毛玻璃風格
所有 selector 都加 #rtpRankModal 前綴，
確保只作用在彈窗內，不影響首頁 .rtp-rank-section
============================================================ */

/* ── 全螢幕遮罩 ── */
#rtpRankModal.rtp-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: rgba(0, 0, 0, 0.62);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    align-items: center;
    justify-content: center;
    padding: 0 12px;
    box-sizing: border-box;
    opacity: 0;
    transition: opacity 0.28s ease;
    pointer-events: none;
}

#rtpRankModal.rtp-modal.show {
    display: flex !important;
    opacity: 1;
    pointer-events: auto;
}

/* ── 彈窗主容器 ── */
#rtpRankModal .rtp-modal-content {
    position: relative;
    width: 100%;
    max-width: 420px;
    max-height: 82vh;
    display: flex;
    flex-direction: column;
    background: rgba(12, 22, 44, 0.82);
    -webkit-backdrop-filter: blur(28px) saturate(180%);
    backdrop-filter: blur(28px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.13);
    border-radius: 20px;
    box-shadow:
        0 24px 60px rgba(0, 0, 0, 0.70),
        inset 0 0 0 1px rgba(255, 255, 255, 0.05);
    overflow: hidden;
    transform: scale(0.95) translateY(8px);
    transition: transform 0.30s cubic-bezier(0.16, 1, 0.3, 1);
}

#rtpRankModal.rtp-modal.show .rtp-modal-content {
    transform: scale(1) translateY(0);
}

/* ── 標題列 ── */
#rtpRankModal .rtp-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    flex-shrink: 0;
}

#rtpRankModal .rtp-modal-header h3 {
    display: flex;
    align-items: center;
    gap: 9px;
    font-size: 16px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.95);
    margin: 0;
    letter-spacing: 0.01em;
}

#rtpRankModal .rtp-modal-header h3 i {
    color: rgba(215, 177, 106, 0.95);
    font-size: 15px;
}

/* ── 關閉按鈕 ── */
#rtpRankModal .rtp-modal-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.14);
    color: rgba(255, 255, 255, 0.70);
    font-size: 13px;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
    -webkit-tap-highlight-color: transparent;
    outline: none;
    padding: 0;
    line-height: 1;
}

#rtpRankModal .rtp-modal-close:hover,
#rtpRankModal .rtp-modal-close:active {
    background: rgba(215, 177, 106, 0.2);
    border-color: rgba(215, 177, 106, 0.42);
    color: #fff8f4;
}

/* ── 主體捲動區 ── */
#rtpRankModal .rtp-modal-body {
    overflow-y: auto;
    flex: 1;
    padding: 14px 16px 20px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.12) transparent;
    /* 覆蓋 rtp-rank.css 的 max-height 設定 */
    max-height: none;
}

#rtpRankModal .rtp-modal-body::-webkit-scrollbar {
    width: 4px;
}

#rtpRankModal .rtp-modal-body::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.14);
    border-radius: 4px;
}

/* ── 日期副標 ── */
#rtpRankModal .rtp-modal-subtitle {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.50);
    margin-bottom: 14px;
    padding: 0 4px;
}

#rtpRankModal .rtp-modal-subtitle i {
    font-size: 11px;
}

/* ── 排行清單容器 ── */
#rtpRankModal .rtp-modal-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* ── 每一個排行 item：玻璃卡片 ── */
#rtpRankModal .rtp-modal-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 13px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.09);
    transition: background 0.2s ease;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

#rtpRankModal .rtp-modal-item:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.14);
}

#rtpRankModal .rtp-modal-item:active {
    background: rgba(255, 255, 255, 0.09);
}

/* ── 名次區塊 ── */
#rtpRankModal .rtp-modal-rank {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
}

/* ── 彈窗內專用徽章（覆蓋 rtp-rank.css，尺寸獨立） ── */
#rtpRankModal .rtp-rank-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 13px;
    font-weight: 700;
    line-height: 1;
}

#rtpRankModal .rtp-rank-badge.top-1 {
    background: linear-gradient(145deg, #f5c842 0%, #e09c10 100%);
    color: #3a2000;
    box-shadow: 0 2px 10px rgba(229, 163, 20, 0.45);
}

#rtpRankModal .rtp-rank-badge.top-2 {
    background: linear-gradient(145deg, #d4d4d4 0%, #9e9e9e 100%);
    color: #2a2a2a;
    box-shadow: 0 2px 8px rgba(180, 180, 180, 0.35);
}

#rtpRankModal .rtp-rank-badge.top-3 {
    background: linear-gradient(145deg, #e07f3a 0%, #b85c18 100%);
    color: #fff;
    box-shadow: 0 2px 8px rgba(200, 100, 30, 0.40);
}

#rtpRankModal .rtp-rank-badge.normal {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.16);
    color: rgba(255, 255, 255, 0.60);
    font-size: 12px;
}

/* ── 遊戲資訊區 ── */
#rtpRankModal .rtp-modal-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

#rtpRankModal .rtp-modal-info h4 {
    font-size: 14px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.92);
    margin: 0 0 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

#rtpRankModal .rtp-modal-info p {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.45);
    margin: 0;
    font-weight: 500;
    letter-spacing: 0.02em;
}

/* ── RTP 數字 ── */
#rtpRankModal .rtp-modal-data {
    flex-shrink: 0;
    text-align: right;
    padding-left: 8px;
}

#rtpRankModal .rtp-modal-data strong {
    display: block;
    font-size: 15px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.95);
    letter-spacing: -0.01em;
}

/* ── 手機版微調（彈窗內） ── */
@media (max-width: 767px) {
    #rtpRankModal .rtp-modal-content {
        width: 95%;
        max-height: 85vh;
        border-radius: 16px;
    }

    #rtpRankModal .rtp-modal-header {
        padding: 14px 16px 12px;
    }

    #rtpRankModal .rtp-modal-body {
        padding: 12px 14px 18px;
    }

    #rtpRankModal .rtp-modal-item {
        padding: 11px 12px;
        gap: 10px;
    }

    #rtpRankModal .rtp-modal-rank {
        width: 34px;
    }

    #rtpRankModal .rtp-rank-badge {
        width: 32px;
        height: 32px;
    }

    #rtpRankModal .rtp-modal-info h4 {
        font-size: 13px;
    }

    #rtpRankModal .rtp-modal-info p {
        font-size: 11px;
    }

    #rtpRankModal .rtp-modal-data strong {
        font-size: 14px;
    }
}