/* Breaking crypto news band (crypto site only). Colors follow the site theme (Sneat light/dark). */
.crypto-news-ticker {
    --cnt-bg: #ffffff;
    --cnt-fg: #566a7f;
    --cnt-muted: #8592a3;
    --cnt-border: rgba(67, 89, 113, 0.14);
    --cnt-hover: #696cff;
    --cnt-red: #ff3e1d;
    --cnt-urgent-fg: #d93a1f;
    --cnt-sep: #ffab00;
    --cnt-telegram: #229ed9;
    --cnt-telegram-hover: #1c88bb;
    --cnt-fade: 24px;

    position: relative;
    z-index: 22;
    display: flex;
    align-items: stretch;
    height: 40px;
    overflow: hidden;
    background: var(--cnt-bg);
    color: var(--cnt-fg);
    border-bottom: 1px solid var(--cnt-border);
    box-shadow: 0 1px 4px rgba(67, 89, 113, 0.08);
    font-size: 0.875rem;
    line-height: 1.2;
}

.theme-dark .crypto-news-ticker {
    --cnt-bg: #2b2c40;
    --cnt-fg: #cbcbe2;
    --cnt-muted: #7e7f96;
    --cnt-border: rgba(255, 255, 255, 0.08);
    --cnt-hover: #8f91ff;
    --cnt-urgent-fg: #ff8b78;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
}

.crypto-news-ticker[hidden] {
    display: none !important;
}

body.chart-page-maximized .crypto-news-ticker {
    display: none !important;
}

/* Fixed label on the right (first child in RTL). */
.cnt-label {
    flex: none;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0 0.9rem;
    background: var(--cnt-red);
    color: #fff;
    font-weight: 700;
    white-space: nowrap;
}

.cnt-label-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #fff;
    animation: cnt-pulse 1.6s ease-in-out infinite;
}

@keyframes cnt-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.25; }
}

.cnt-viewport {
    position: relative;
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    -webkit-mask-image: linear-gradient(to left, transparent 0, #000 var(--cnt-fade), #000 calc(100% - var(--cnt-fade)), transparent 100%);
    mask-image: linear-gradient(to left, transparent 0, #000 var(--cnt-fade), #000 calc(100% - var(--cnt-fade)), transparent 100%);
}

.cnt-track {
    display: flex;
    width: max-content;
    height: 100%;
    align-items: center;
}

/*
 * RTL reading: the track is anchored on the right and moves to the right, so each headline
 * enters from the left with its first word leading. The track holds two identical groups,
 * so shifting it by 50% loops without a jump. The script sets --cnt-duration from the group
 * width to keep the same speed however many items there are.
 */
.cnt-track.is-animated {
    animation: cnt-scroll var(--cnt-duration, 60s) linear infinite;
    will-change: transform;
}

@keyframes cnt-scroll {
    from { transform: translateX(0); }
    to { transform: translateX(50%); }
}

.cnt-viewport:hover .cnt-track,
.cnt-viewport:focus-within .cnt-track,
.crypto-news-ticker.is-paused .cnt-track {
    animation-play-state: paused;
}

.cnt-group {
    flex: none;
    display: flex;
    align-items: center;
    height: 100%;
    margin: 0;
    padding: 0;
    list-style: none;
}

.cnt-entry {
    display: inline-flex;
    align-items: center;
    height: 100%;
    white-space: nowrap;
}

.cnt-item {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    height: 100%;
    padding: 0 0.6rem;
    border: 0;
    background: none;
    color: inherit;
    font: inherit;
    cursor: pointer;
    white-space: nowrap;
}

.cnt-item:hover .cnt-headline,
.cnt-item:focus-visible .cnt-headline {
    color: var(--cnt-hover);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.cnt-item:focus-visible {
    outline: 2px solid var(--cnt-hover);
    outline-offset: -4px;
    border-radius: 4px;
}

.cnt-item.is-urgent .cnt-headline {
    color: var(--cnt-urgent-fg);
    font-weight: 600;
}

.cnt-badge {
    display: inline-block;
    padding: 0.15rem 0.45rem;
    border-radius: 4px;
    background: var(--cnt-red);
    color: #fff;
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1.2;
}

.cnt-headline {
    font-weight: 500;
}

.cnt-time {
    color: var(--cnt-muted);
    font-size: 0.75rem;
}

.cnt-sep {
    padding: 0 0.35rem;
    color: var(--cnt-sep);
}

.cnt-item.is-new {
    animation: cnt-flash 1.2s ease-in-out 3;
    border-radius: 4px;
}

@keyframes cnt-flash {
    0%, 100% { background: transparent; }
    50% { background: rgba(255, 62, 29, 0.14); }
}

/* "Follow the channel" on the left (last child in RTL). */
.cnt-follow {
    flex: none;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin: 6px 8px;
    padding: 0 0.75rem;
    border-radius: 999px;
    background: var(--cnt-telegram);
    color: #fff !important;
    font-size: 0.78rem;
    font-weight: 600;
    white-space: nowrap;
    text-decoration: none;
}

.cnt-follow:hover,
.cnt-follow:focus-visible {
    background: var(--cnt-telegram-hover);
    color: #fff;
}

/* Reduced motion: no scrolling and no pulse; the list can be swiped or scrolled by hand. */
.crypto-news-ticker.is-static .cnt-track {
    animation: none !important;
    transform: none !important;
}

.crypto-news-ticker.is-static .cnt-viewport {
    overflow-x: auto;
    scrollbar-width: none;
}

.crypto-news-ticker.is-static .cnt-viewport::-webkit-scrollbar {
    display: none;
}

@media (prefers-reduced-motion: reduce) {
    .cnt-track,
    .cnt-track.is-animated {
        animation: none !important;
        transform: none !important;
    }

    .cnt-viewport {
        overflow-x: auto;
        scrollbar-width: none;
    }

    .cnt-label-dot,
    .cnt-item.is-new {
        animation: none;
    }
}

@media (max-width: 575.98px) {
    .crypto-news-ticker {
        font-size: 0.8125rem;
        --cnt-fade: 14px;
    }

    .cnt-label {
        padding: 0 0.6rem;
        gap: 0.35rem;
    }

    .cnt-follow {
        margin: 6px;
        padding: 0 0.6rem;
    }
}

@media (max-width: 400px) {
    .cnt-follow-text {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
        white-space: nowrap;
    }
}

.crypto-news-modal .cnm-body {
    white-space: pre-line;
    line-height: 1.8;
}

.crypto-news-modal .modal-title {
    line-height: 1.5;
}
