/* Hide scrollbar for the horizontal filter navigation */
    .cw-widget .cw-scrollbar-hide::-webkit-scrollbar {
        display: none;
    }

    .cw-widget .cw-scrollbar-hide {
        -ms-overflow-style: none;
        scrollbar-width: none;
    }

    /* Real-time price tracking animations */
    @keyframes crypto-flash-up {
        0% {
            background-color: rgba(22, 199, 132, 0.25);
            color: #109c65;
        }

        100% {
            background-color: transparent;
            color: #111827;
        }
    }

    @keyframes crypto-flash-down {
        0% {
            background-color: rgba(234, 57, 67, 0.25);
            color: #b91c24;
        }

        100% {
            background-color: transparent;
            color: #111827;
        }
    }

    .cw-widget .cw-flash-up {
        animation: crypto-flash-up 2s ease-out;
    }

    .cw-widget .cw-flash-down {
        animation: crypto-flash-down 2s ease-out;
    }

    /* Sortable column headers */
    .cw-widget .cw-sortable-th {
        cursor: pointer;
        user-select: none;
        white-space: nowrap;
        transition: color 0.15s;
    }

    .cw-widget .cw-sortable-th:hover {
        color: #990f3d;
    }

    .cw-widget .cw-sortable-th.cw-active-sort {
        color: #990f3d;
    }

    .cw-widget .cw-sort-icon {
        display: inline-flex;
        align-items: center;
        margin-left: 4px;
        opacity: 0.4;
        transition: opacity 0.15s, transform 0.15s;
    }

    .cw-widget .cw-sortable-th:hover .cw-sort-icon,
    .cw-widget .cw-sortable-th.cw-active-sort .cw-sort-icon {
        opacity: 1;
    }
    /* Isolate widget from page layout - prevent stretching parent sections */
    .cw-widget-isolated {
        overflow-x: clip;
        max-width: 100%;
    }

    /* Allow filter chip row to scroll (Ape Zone must not be clipped) */
    .cw-widget--v2.cw-widget-isolated {
        overflow-x: visible;
    }

    /* Prices page: OG filters — scroll on .ci-prices-toolbar__filters parent */
    .ci-prices-page .cw-widget--v2 #cw-filter-container.ci-prices-filters {
        display: flex !important;
        flex-wrap: nowrap !important;
        overflow: visible;
        grid-template-columns: none !important;
        min-width: 0;
        width: max-content;
    }

    .ci-prices-page .cw-widget--v2 #cw-filter-container.ci-prices-filters .cw-ape-tooltip-wrap {
        display: inline-flex;
        flex: 0 0 auto;
        flex-shrink: 0;
    }

    /* Filter chips: horizontal scroll on narrow viewports */
    @media (max-width: 767px) {
        .cw-widget--v2 #cw-filter-container.ci-prices-filters {
            gap: 6px;
        }
    }

    /* Ape Zone custom tooltip - fixed position so never clipped */
    .cw-widget .cw-ape-tooltip-wrap {
        position: relative;
        display: inline-flex;
    }
    #cw-ape-tooltip-root {
        position: fixed;
        z-index: 99999;
        min-width: 200px;
        max-width: min(380px, calc(100vw - 24px));
        width: max-content;
        padding: 10px 20px;
        background: #efdad9;
        color: #990f3d;
        font-size: 13px;
        line-height: 1.4;
        text-align: center;
        border-radius: 8px;
        border: 1px solid #990f3d;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
        pointer-events: none;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.2s ease, visibility 0.2s ease;
        box-sizing: border-box;
    }
    @media (max-width: 480px) {
        #cw-ape-tooltip-root {
            max-width: calc(100vw - 24px);
            min-width: 160px;
            padding: 8px 14px;
            font-size: 12px;
            line-height: 1.35;
        }
    }
    #cw-ape-tooltip-root.cw-ape-tooltip-visible {
        opacity: 1;
        visibility: visible;
    }
    #cw-ape-tooltip-root::after {
        content: '';
        position: absolute;
        top: 100%;
        left: 50%;
        transform: translateX(-50%);
        border: 8px solid transparent;
        border-top-color: #efdad9;
        filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.08));
    }
    #cw-ape-tooltip-root.cw-ape-tooltip-below::after {
        top: auto;
        bottom: 100%;
        border-top-color: transparent;
        border-bottom-color: #efdad9;
        filter: drop-shadow(0 -2px 2px rgba(0, 0, 0, 0.06));
    }

    
    /* Table container: spacing between border and content */
    .cw-widget .cw-table-scroll.cw-table-container {
        padding: 12px 16px 12px 16px;
    }
    .cw-widget--v2 .cw-table-scroll.cw-table-container {
        padding-right: 16px;
    }
    /* First column (#): padding for breathing room */
    .cw-widget .cw-table-scroll .cw-col-rank {
        padding-left: 12px !important;
        padding-right: 12px !important;
    }

    /* Desktop: horizontal scroll only, vertical expands with page */
    .cw-widget .cw-table-scroll {
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        touch-action: pan-x;
    }

    /* Prices v2: keep table within page width on desktop (no stray scrollbar on paginated pages) */
    .cw-widget--v2 .cw-table-scroll {
        overflow-x: hidden;
        max-width: 100%;
    }

    @media (max-width: 767px) {
        .cw-widget--v2 .cw-table-scroll {
            overflow-x: auto;
        }
    }

    /* Desktop: show full coin info, hide compact */
    .cw-widget .cw-table-scroll .cw-coin-full { display: block; }
    .cw-widget .cw-table-scroll .cw-coin-compact { display: none; }

    /* Sticky header row - column names (#, Coin, Price, 1h, 24h, etc.) stay visible when scrolling */
    .cw-widget .cw-table-scroll table {
        border-collapse: separate;
        border-spacing: 0;
    }
    .cw-widget .cw-table-scroll thead {
        position: -webkit-sticky;
        position: sticky;
        top: 0;
        z-index: 10;
        background: #f7f7f7;
    }
    .cw-widget .cw-table-scroll thead th {
        position: -webkit-sticky;
        position: sticky;
        top: 0;
        z-index: 5;
        background: #f7f7f7 !important;
        box-shadow: 0 1px 0 0 #e5e7eb;
    }
    /* Mobile: enable vertical + horizontal scroll inside the table box */
    @media (max-width: 767px) {
        .cw-widget .cw-table-scroll {
            overflow-x: auto;
            overflow-y: auto;
            max-height: 70vh;
            -webkit-overflow-scrolling: touch;
            touch-action: pan-x pan-y;
        }
        .cw-widget .cw-table-scroll table {
            min-width: 980px;
        }
    }