.rtp-rank-section {
    position: relative;
    width: 100%;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
}

.rtp-rank-head {
    width: 100%;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 10px;
}

.rtp-rank-head--actions-only {
    justify-content: flex-end;
}

@media screen and (min-width: 768px) {
    .rtp-rank-head--actions-only {
        display: none;
    }
}

.rtp-rank-title {
    min-width: 0;
    flex: 1;
}

.rtp-mobile-btn {
    display: none;
}

.rtp-slider-wrap {
    overflow-x: clip;
    overflow-y: visible;
    width: 100%;
    /* 預留 hover 抬升空間，避免上邊線被裁掉 */
    padding-block: 2px;
    margin-block: -2px;
}

.rtp-slider-track {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    scroll-behavior: auto;
    scrollbar-width: none;
    cursor: grab;
    scroll-snap-type: none;
    touch-action: pan-y;
    overscroll-behavior-x: contain;
}

.rtp-slider-track::-webkit-scrollbar {
    display: none;
}

.rtp-slider-track.is-dragging {
    cursor: grabbing;
    scroll-behavior: auto;
    user-select: none;
}

.rtp-slide {
    flex: 0 0 auto;
}

/* ── Dexsport 風卡片（桌機 / 手機共用） ── */
.rtp-card {
    position: relative;
    overflow: hidden;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: stretch;
    height: 100%;
    box-sizing: border-box;
    border-radius: 16px;
    background: var(--ref-surface, #ffffff);
    border: 1px solid rgba(0, 61, 121, 0.14);
    box-shadow: 0 4px 14px rgba(0, 61, 121, 0.08);
    transition: background 0.22s ease, border-color 0.22s ease, box-shadow 0.22s ease;
    gap: 6px;
    color: var(--ref-text, #363636);
}

.rtp-card__head,
.rtp-card__stats {
    width: 100%;
}

.rtp-card:hover {
    background: #f8fbff;
    border: 1px solid rgba(0, 61, 121, 0.35);
    box-shadow: 0 6px 18px rgba(0, 61, 121, 0.12);
}

.rtp-card__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-width: 0;
}

.rtp-card__head--dual {
    justify-content: space-between;
    gap: 10px;
    width: 100%;
}

.rtp-card__left {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 6px;
    min-width: 0;
    flex: 1 1 auto;
}

.rtp-card__rank {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
}

.rtp-card__store {
    flex: 0 1 auto;
    min-width: 0;
    max-width: 46%;
    margin-left: auto;
    font-size: 12px;
    line-height: 1.3;
    color: rgba(102, 102, 102, 0.95);
    text-align: right;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.rtp-card__game {
    margin: 0;
    min-width: 0;
    flex: 1 1 auto;
    font-size: 14px;
    line-height: 1.35;
    font-weight: 500;
    color: #363636;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.rtp-card__stats {
    display: flex;
    align-items: stretch;
    gap: 6px;
}

.rtp-stat {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    min-height: 38px;
    padding: 6px 8px 5px;
    border-radius: 8px;
    transition: background 0.2s ease, border-color 0.2s ease;
}

/* 左欄 RTP：藍色系 */
.rtp-stat--rtp {
    background: #f4f8fc;
    border: 1px solid rgba(0, 61, 121, 0.12);
}

.rtp-card:hover .rtp-stat--rtp {
    background: #eef5fb;
    border-color: rgba(0, 61, 121, 0.22);
}

/* 右欄近七日：金色系 */
.rtp-stat--trend {
    background: #fffaf0;
    border: 1px solid rgba(212, 161, 80, 0.22);
}

.rtp-card:hover .rtp-stat--trend {
    background: #fff6e4;
    border-color: rgba(212, 161, 80, 0.38);
}

.rtp-stat__inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    min-width: 0;
    width: 100%;
}

.rtp-stat__label {
    display: block;
    flex: 0 0 auto;
    width: 100%;
    font-size: 0.65rem;
    line-height: 1;
    font-weight: 500;
    letter-spacing: 0.02em;
    text-align: center;
    white-space: nowrap;
}

.rtp-stat--rtp .rtp-stat__label {
    color: rgba(0, 61, 121, 0.72);
}

.rtp-stat--trend .rtp-stat__label {
    color: rgba(126, 91, 35, 0.78);
}

.rtp-stat__value {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    gap: 5px;
    min-width: 0;
    font-size: 14px;
    line-height: 1.2;
    font-weight: 600;
    white-space: nowrap;
}

.rtp-stat--rtp .rtp-stat__value {
    font-size: 15px;
    font-weight: 700;
    color: var(--ref-primary, #003d79);
}

/* 近七日：整段數值做底框層次，拿掉漲跌圓底 */
.rtp-stat--trend .rtp-stat__value {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    min-width: 0;
    max-width: 100%;
    padding: 3px 8px;
    border-radius: 6px;
    color: var(--ref-gold-deep, #7e5b23);
    background: rgba(255, 255, 255, 0.78);
    border: 1px solid rgba(212, 161, 80, 0.32);
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.9),
      0 1px 2px rgba(126, 91, 35, 0.06);
}

.rtp-stat__trend-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: auto;
    height: auto;
    border-radius: 0;
    flex-shrink: 0;
    font-size: 11px;
    line-height: 1;
    background: none;
    box-shadow: none;
    color: inherit;
}

.rtp-stat__trend-text {
    font-size: 13px;
    font-weight: 600;
    line-height: 1.2;
}

.rtp-stat--trend.up .rtp-stat__trend-mark,
.rtp-stat--trend.down .rtp-stat__trend-mark,
.rtp-stat--trend.same .rtp-stat__trend-mark {
    background: none;
    box-shadow: none;
}

.rtp-stat--trend.up .rtp-stat__trend-mark,
.rtp-stat--trend.up .rtp-stat__trend-text {
    color: #b8860b;
}

.rtp-stat--trend.down .rtp-stat__trend-mark,
.rtp-stat--trend.down .rtp-stat__trend-text {
    color: #7e5b23;
}

.rtp-stat--trend.same .rtp-stat__trend-mark,
.rtp-stat--trend.same .rtp-stat__trend-text {
    color: rgba(126, 91, 35, 0.9);
}

.rtp-rank-title h2 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--ref-primary, #003d79);
    display: flex;
    align-items: center;
    gap: 8px;
    line-height: 1.3;
}

.rtp-rank-title p {
    margin: 4px 0 0;
    font-size: 13px;
    color: rgba(102, 102, 102, 0.9);
    display: flex;
    align-items: center;
    gap: 6px;
}

.rtp-rank-badge {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    line-height: 1;
}

.rtp-rank-badge.top-1 {
    background: linear-gradient(180deg, #f7e08f 0%, #d4a150 52%, #7e5b23 100%);
    color: #3a2a0c;
    box-shadow: 0 0 10px rgba(212, 161, 80, 0.4);
}

.rtp-rank-badge.top-2 {
    background: linear-gradient(180deg, #f3f5f8 0%, #c5ccd6 100%);
    color: #333;
}

.rtp-rank-badge.top-3 {
    background: linear-gradient(180deg, #e8b07a 0%, #b87333 100%);
    color: #2a1608;
    box-shadow: 0 0 8px rgba(184, 115, 51, 0.28);
}

.rtp-rank-badge.normal {
    background: #f1f6fb;
    color: #c2c8d3;
}

.rtp-card__rank .rtp-rank-badge {
    width: 26px;
    height: 26px;
    font-size: 11px;
}

@media screen and (min-width: 768px) {
    .rtp-rank-section {
        margin: 0;
        gap: 14px;
    }

    .rtp-rank-title h2 {
        font-size: 1.25rem;
        font-weight: 700;
    }

    .rtp-slider-track {
        gap: 16px;
    }

    /* 桌機一列 4 格 */
    .rtp-slide {
        flex: 0 0 calc((100% - 48px) / 4);
        min-width: calc((100% - 48px) / 4);
        max-width: calc((100% - 48px) / 4);
    }

    .rtp-card {
        height: auto;
        min-height: 116px;
        padding: 12px 14px;
        border-radius: 18px;
        gap: 6px;
    }

    .rtp-card:hover {
        transform: none;
        border: 1px solid rgba(0, 61, 121, 0.35);
        box-shadow: 0 6px 18px rgba(0, 61, 121, 0.12);
    }

    .rtp-card__left {
        gap: 8px;
    }

    .rtp-card__store {
        font-size: 13px;
        max-width: 42%;
    }

    .rtp-card__game {
        font-size: 15px;
    }

    .rtp-card__rank .rtp-rank-badge {
        width: 28px;
        height: 28px;
        font-size: 12px;
    }

    .rtp-stat {
        min-height: 40px;
        padding: 7px 8px 6px;
    }

    .rtp-stat__value {
        font-size: 15px;
    }

    .rtp-stat--rtp .rtp-stat__value {
        font-size: 16px;
    }

    .rtp-stat--trend .rtp-stat__value {
        padding: 4px 9px;
    }

    .rtp-stat__trend-mark {
        width: auto;
        height: auto;
        font-size: 12px;
    }

    .rtp-stat__trend-text {
        font-size: 14px;
    }
}

@media (max-width: 767px) {
    .rtp-rank-section {
        margin: 0;
        gap: 10px;
    }

    .rtp-rank-head {
        align-items: center;
    }

    .rtp-rank-title h2 {
        font-size: 0.92rem;
    }

    .rtp-rank-title p {
        display: none;
    }

    .rtp-mobile-btn {
        display: inline-flex;
        align-items: center;
        gap: 3px;
        flex-shrink: 0;
        min-height: 28px;
        padding: 4px 10px;
        border-radius: 999px;
        border: 1px solid rgba(0, 61, 121, 0.35);
        background: var(--ref-surface, #ffffff);
        color: var(--ref-primary, #003d79);
        font-size: 0.72rem;
        font-weight: 600;
        cursor: pointer;
        white-space: nowrap;
        -webkit-tap-highlight-color: transparent;
    }

    .rtp-mobile-btn:active {
        filter: brightness(0.92);
    }

    .rtp-slider-track {
        gap: 10px;
        padding-bottom: 1px;
    }

    .rtp-slide {
        flex: 0 0 min(72vw, 248px);
        min-width: min(72vw, 248px);
        max-width: min(72vw, 248px);
    }

    .rtp-card {
        height: auto;
        min-height: 92px;
        padding: 9px 10px;
        border-radius: 14px;
        gap: 5px;
    }

    .rtp-card__left {
        gap: 5px;
    }

    .rtp-card__store {
        font-size: 11px;
        max-width: 44%;
    }

    .rtp-card__game {
        font-size: 12px;
    }

    .rtp-card__stats {
        gap: 5px;
    }

    .rtp-stat {
        min-height: 34px;
        padding: 5px 6px 4px;
        border-radius: 7px;
    }

    .rtp-stat__value {
        font-size: 13px;
    }

    .rtp-stat--rtp .rtp-stat__value {
        font-size: 14px;
    }

    .rtp-stat--trend .rtp-stat__value {
        padding: 2px 7px;
    }

    .rtp-stat__trend-mark {
        width: auto;
        height: auto;
        font-size: 10px;
    }

    .rtp-stat__trend-text {
        font-size: 12px;
    }

    .rtp-card__rank .rtp-rank-badge {
        width: 24px;
        height: 24px;
        font-size: 10px;
    }
}

/* 保留舊版列表樣式供其他頁面參考（若仍引用 .rtp-item） */
.rtp-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 14px;
    background: #f8fbff;
    border: 1px solid rgba(0, 61, 121, 0.12);
}

.rtp-rank-wrap {
    width: 34px;
    display: flex;
    justify-content: center;
    flex-shrink: 0;
}

.rtp-game-info {
    flex: 1;
    min-width: 0;
}

.rtp-game-info h4 {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    color: #fff;
}

.rtp-game-info p {
    margin: 4px 0 0;
    font-size: 12px;
    color: #8f97aa;
}

.rtp-data {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    flex-shrink: 0;
}

.rtp-data strong {
    font-size: 15px;
    font-weight: 800;
    color: #fff;
}

.rtp-data .trend {
    margin-top: 4px;
    font-size: 11px;
}

.rtp-data .trend.up { color: #2dd36f; }
.rtp-data .trend.down { color: #a78bfa; }
.rtp-data .trend.same { color: #9aa3b2; }

/* ============================================================
   RTP 手機彈窗 — 與桌機 .rtp-item / .rtp-rank-badge 共用樣式
   ============================================================ */

#rtpRankModal.rtp-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: rgba(15, 23, 42, 0.35);
    -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;
    margin: 0;
    padding: 0;
    border-radius: 16px;
    background: var(--ref-surface, #ffffff);
    border: 1px solid rgba(0, 61, 121, 0.12);
    box-shadow: 0 14px 36px rgba(0, 61, 121, 0.14), 0 2px 10px rgba(15, 23, 42, 0.06);
    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;
    gap: 12px;
    padding: 14px 16px 12px;
    background: var(--ref-bg, #f7f9fc);
    border-bottom: 1px solid rgba(0, 61, 121, 0.1);
    flex-shrink: 0;
}

#rtpRankModal .rtp-modal-header .rtp-rank-title {
    width: auto;
    margin: 0;
    flex: 1;
    min-width: 0;
}

#rtpRankModal .rtp-modal-header .rtp-rank-title h2 {
    margin: 0;
    font-size: 1.1rem;
    color: var(--ref-primary, #003d79);
}

#rtpRankModal .rtp-modal-header .rtp-rank-title h2 i {
    color: var(--ref-primary-hover, #0056a3);
}

#rtpRankModal .rtp-modal-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--ref-surface, #ffffff);
    border: 1px solid rgba(0, 61, 121, 0.2);
    color: var(--ref-text-muted, #666666);
    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;
    flex-shrink: 0;
}

#rtpRankModal .rtp-modal-close:hover,
#rtpRankModal .rtp-modal-close:active {
    background: rgba(0, 61, 121, 0.08);
    border-color: rgba(0, 61, 121, 0.35);
    color: var(--ref-primary, #003d79);
}

#rtpRankModal .rtp-modal-body {
    overflow-y: auto;
    flex: 1;
    padding: 12px 14px 18px;
    background: var(--ref-bg, #f7f9fc);
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 61, 121, 0.28) transparent;
    max-height: none;
}

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

#rtpRankModal .rtp-modal-body::-webkit-scrollbar-thumb {
    background: rgba(0, 61, 121, 0.28);
    border-radius: 4px;
}

#rtpRankModal .rtp-modal-meta {
    width: 100%;
    margin: 0 0 12px;
}

#rtpRankModal .rtp-modal-meta p {
    margin: 0;
    font-size: 13px;
    color: var(--ref-text-muted, #666666);
}

#rtpRankModal .rtp-modal-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

#rtpRankModal .rtp-card--modal {
    height: auto;
    min-height: 104px;
    padding: 10px 11px;
    border-radius: 14px;
    gap: 10px;
}

@media (max-width: 767px) {
    #rtpRankModal .rtp-modal-content {
        width: 95%;
        max-height: 78vh;
        border-radius: 14px;
    }

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

    #rtpRankModal .rtp-modal-header .rtp-rank-title h2 {
        font-size: 1rem;
    }

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

    #rtpRankModal .rtp-modal-list {
        gap: 8px;
    }

    #rtpRankModal .rtp-card--modal {
        min-height: 100px;
        padding: 9px 10px;
    }
}

.rtp-play-veil {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 14px;
    pointer-events: none;
    opacity: 0;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0) 8%, rgba(0, 61, 121, 0.05) 48%, rgba(0, 61, 121, 0.16) 100%);
    transform: translateX(22%);
    transition: opacity 0.28s ease, transform 0.38s ease;
}

.rtp-slide.is-open .rtp-play-veil,
.rtp-card--modal.is-open .rtp-play-veil {
    opacity: 1;
    transform: translateX(0);
    pointer-events: auto;
}

.rtp-play-shine {
    position: absolute;
    top: -30%;
    bottom: -30%;
    width: 42%;
    right: -70%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.95), rgba(0, 61, 121, 0.28), transparent);
    transform: skewX(-18deg);
    pointer-events: none;
    opacity: 0;
}

.rtp-slide.is-open .rtp-play-shine,
.rtp-card--modal.is-open .rtp-play-shine {
    animation: rtpShineIn 0.55s ease forwards;
}

@keyframes rtpShineIn {
    0% { right: -70%; opacity: 0; }
    18% { opacity: 1; }
    100% { right: 120%; opacity: 0; }
}

.rtp-play-btn {
    position: relative;
    z-index: 1;
    opacity: 0;
    transform: translateX(14px);
    pointer-events: none;
    border: 0;
    border-radius: 999px;
    padding: 7px 16px;
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.12em;
    line-height: 1;
    color: #fff;
    background: var(--color-btn, #003d79);
    box-shadow: 0 0 14px rgba(0, 61, 121, 0.28);
    cursor: pointer;
}

.rtp-slide.is-open .rtp-play-btn,
.rtp-card--modal.is-open .rtp-play-btn {
    animation: rtpPlayIn 0.32s ease 0.28s forwards;
    pointer-events: auto;
}

.rtp-play-btn:hover {
    filter: brightness(1.12);
}

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