/* ============================================================
手機快捷側邊選單 — 黑紅色系 / iOS 毛玻璃
v2: 對齊截圖視覺，貼合 --color-bg/#16161c 主色
只在 max-width:768px 顯示
============================================================ */

/* ── 主題色變數（局部作用域） ── */
#mobile-quick-menu-wrap,
#mqm-overlay {
    --mqm-bg: #16161c;
    --mqm-nav: #1A1A22;
    --mqm-red: rgba(255, 35, 10, 0.80);
    --mqm-red-dim: rgba(255, 35, 10, 0.18);
    --mqm-red-glow: rgba(255, 35, 10, 0.40);
    --mqm-w82: rgba(255, 255, 255, 0.82);
    --mqm-w55: rgba(255, 255, 255, 0.55);
    --mqm-w14: rgba(255, 255, 255, 0.14);
    --mqm-w08: rgba(255, 255, 255, 0.08);
    --mqm-b55: rgba(0, 0, 0, 0.55);
    --mqm-b80: rgba(0, 0, 0, 0.80);
}

/* ── 顯隱控制（僅手機） ── */
#mobile-quick-menu-wrap {
    display: none;
}

@media (max-width: 768px) {
    #mobile-quick-menu-wrap {
        display: flex;
    }
}

/* ── 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 {
    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;
    /* 截圖：深色半透明底，類似 #1A1A22 加毛玻璃 */
    background: rgba(22, 22, 28, 0.88);
    -webkit-backdrop-filter: blur(20px) saturate(160%);
    backdrop-filter: blur(20px) saturate(160%);
    border: 1px solid rgba(255, 255, 255, 0.13);
    color: rgba(255, 255, 255, 0.88);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.025em;
    white-space: nowrap;
    box-shadow:
        0 2px 10px rgba(0, 0, 0, 0.50),
        inset 0 1px 0 rgba(255, 255, 255, 0.06);
    transition: background 0.2s ease, border-color 0.2s ease;
}

.mqm-item:active .mqm-tag {
    background: rgba(255, 35, 10, 0.20);
    border-color: rgba(255, 35, 10, 0.40);
}

/* ── 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(255, 35, 10, 0.10) 0%,
            rgba(26, 26, 34, 0.95) 60%);
    -webkit-backdrop-filter: blur(20px) saturate(160%);
    backdrop-filter: blur(20px) saturate(160%);
    border: 1px solid rgba(255, 255, 255, 0.16);
    color: rgba(255, 255, 255, 0.85);
    font-size: 16px;
    box-shadow:
        0 4px 16px rgba(0, 0, 0, 0.55),
        inset 0 1px 0 rgba(255, 255, 255, 0.10);
    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(255, 35, 10, 0.30) 0%,
            rgba(26, 26, 34, 0.95) 60%);
    border-color: rgba(255, 35, 10, 0.55);
    box-shadow:
        0 4px 16px rgba(0, 0, 0, 0.55),
        0 0 12px rgba(255, 35, 10, 0.30),
        inset 0 1px 0 rgba(255, 255, 255, 0.10);
}

/* ── 把手包裝 ── */
#mqm-handle-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

/* 呼吸燈：紅色光暈，貼把手左緣向外擴散 */
#mqm-handle-glow {
    position: absolute;
    top: 50%;
    right: 0;
    transform: translateY(-50%);
    width: 32px;
    height: 64px;
    background: radial-gradient(ellipse at right center,
            rgba(255, 35, 10, 0.50) 0%,
            rgba(255, 35, 10, 0.10) 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;
    /* ↑ 加寬：13 → 22px */
    height: 54px;
    border-radius: 10px 0 0 10px;
    /* 圓角跟著加大 */
    /* 深色半透明，毛玻璃 */
    background: rgb(197 0 0 / 10%);
    -webkit-backdrop-filter: blur(16px) saturate(150%);
    backdrop-filter: blur(16px) saturate(150%);
    /* 左/上/下：白色細邊 + 一條極淡紅暈邊 */
    border-top: 1px solid rgba(255, 255, 255, 0.22);
    border-left: 1px solid rgba(255, 255, 255, 0.18);
    border-bottom: 1px solid rgba(255, 255, 255, 0.22);
    border-right: none;
    box-shadow:
        -4px 0 16px rgba(0, 0, 0, 0.50),
        /* 外陰影 */
        -1px 0 8px rgba(255, 35, 10, 0.12),
        /* 微紅光暈 */
        inset 1px 0 0 rgba(255, 255, 255, 0.07);
    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;
}

#mqm-handle-btn.mqm-expanded {
    background: rgba(255, 35, 10, 0.20);
    border-top-color: rgba(255, 35, 10, 0.38);
    border-left-color: rgba(255, 35, 10, 0.28);
    border-bottom-color: rgba(255, 35, 10, 0.38);
    box-shadow:
        -4px 0 16px rgba(0, 0, 0, 0.50),
        -2px 0 12px rgba(255, 35, 10, 0.22),
        inset 1px 0 0 rgba(255, 255, 255, 0.07);
}

#mqm-handle-btn:active {
    background: rgba(255, 35, 10, 0.28);
}

/* 把手內豎條 */
#mqm-handle-bar {
    width: 2px;
    /* 稍粗一點更明顯 */
    height: 22px;
    background: linear-gradient(180deg,
            rgba(255, 255, 255, 0.18) 0%,
            rgba(255, 255, 255, 0.50) 50%,
            /* 中段最亮 */
            rgba(255, 255, 255, 0.18) 100%);
    border-radius: 99px;
    transition:
        height 0.40s cubic-bezier(0.4, 0, 0.2, 1),
        background 0.25s ease;
    flex-shrink: 0;
}

/* ============================================================
RTP 排行彈窗 ── iOS 毛玻璃黑紅風格
所有 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;
}

#rtpRankModal.rtp-modal.show {
    display: flex;
    opacity: 1;
}

/* ── 彈窗主容器 ── */
#rtpRankModal .rtp-modal-content {
    position: relative;
    width: 100%;
    max-width: 420px;
    max-height: 82vh;
    display: flex;
    flex-direction: column;
    background: rgba(20, 20, 28, 0.78);
    -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(255, 35, 10, 0.90);
    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(255, 35, 10, 0.22);
    border-color: rgba(255, 35, 10, 0.38);
    color: #fff;
}

/* ── 主體捲動區 ── */
#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;
    }
}