/* Crypto Shorts — Inshorts-style card deck */

.cc-shorts-page {
    --cc-shorts-card-w: min(420px, 92vw);
    --cc-shorts-deck-h: calc(100vh - 200px);
    --cc-shorts-deck-h-mobile: calc(100svh - 280px);
    min-height: var(--cc-shorts-deck-h);
    padding: 12px 0 28px;
    background: var(--cc-page);
}

.cc-shorts-page.cc-page {
    overflow-x: hidden;
}

.cc-shorts-toolbar {
    max-width: 960px;
    margin: 0 auto 12px;
    padding: 0 16px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    justify-content: space-between;
}

.cc-shorts-toolbar__head {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.cc-shorts-toolbar__saved {
    border-radius: 999px;
    flex-shrink: 0;
}

.cc-shorts-toolbar__title {
    margin: 0;
    font-size: 22px;
    font-weight: 800;
    color: var(--cc-ink);
}

.cc-shorts-toolbar__meta {
    font-size: 13px;
    color: var(--cc-muted);
    font-weight: 600;
}

.cc-shorts-cats {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    width: 100%;
}

.cc-shorts-cats__pill {
    display: inline-flex;
    align-items: center;
    padding: 5px 12px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    text-decoration: none !important;
    border: 1px solid var(--cc-border);
    color: var(--cc-muted);
    background: var(--cc-surface);
    transition: border-color .2s, color .2s, background .2s;
}

.cc-shorts-cats__pill.is-active,
.cc-shorts-cats__pill:hover {
    border-color: var(--cc-accent);
    color: var(--cc-accent);
    background: var(--cc-surface-2);
}

.cc-shorts-stage {
    position: relative;
    max-width: 960px;
    margin: 0 auto;
    padding: 0 56px;
    height: var(--cc-shorts-deck-h);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.cc-shorts-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 20;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1px solid var(--cc-border);
    background: var(--cc-surface);
    color: var(--cc-ink);
    box-shadow: 0 4px 20px rgba(0, 0, 0, .12);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform .15s, border-color .15s, opacity .15s;
}

.cc-shorts-nav:hover:not(:disabled) {
    border-color: var(--cc-accent);
    transform: translateY(-50%) scale(1.05);
}

.cc-shorts-nav:disabled {
    opacity: .35;
    cursor: not-allowed;
}

.cc-shorts-nav--prev { left: 8px; }
.cc-shorts-nav--next { right: 8px; }

.cc-shorts-deck {
    position: relative;
    width: 100%;
    height: 100%;
    max-height: 720px;
    perspective: 1200px;
    touch-action: pan-y pinch-zoom;
    user-select: none;
    isolation: isolate;
    overflow: hidden;
}

.cc-shorts-card {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    border-radius: 20px;
    overflow: hidden;
    background: var(--cc-surface);
    border: 1px solid var(--cc-border);
    box-shadow: 0 16px 48px rgba(0, 0, 0, .18);
    will-change: transform, opacity;
    transition: transform .38s cubic-bezier(.22, 1, .36, 1), opacity .32s ease, filter .38s ease;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

.cc-shorts-card.is-behind {
    pointer-events: none;
}

.cc-shorts-card[data-offset="0"] {
    z-index: 20 !important;
}

.cc-shorts-card__media {
    position: relative;
    flex: 0 0 32%;
    min-height: 130px;
    background: #111;
    overflow: hidden;
}

.cc-shorts-card__media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.cc-shorts-card__media img.cc-logo-placeholder,
.cc-shorts-card__media img[src*="logo.png"] {
    object-fit: contain !important;
    object-position: center center;
    background: #1a1d24;
    padding: clamp(16px, 8%, 36px);
    box-sizing: border-box;
}

.cc-shorts-card__ad-image.cc-logo-placeholder,
.cc-shorts-card__ad-media img[src*="logo.png"] {
    object-fit: contain !important;
    object-position: center center;
    background: #1a1d24;
    padding: clamp(16px, 8%, 36px);
    box-sizing: border-box;
}

.cc-shorts-card__source-pill {
    position: absolute;
    left: 14px;
    bottom: 14px;
    padding: 6px 14px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.96) !important;
    color: #1a1d24 !important;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .02em;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.18);
    max-width: calc(100% - 28px);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

[data-theme="dark"] .cc-shorts-card__source-pill {
    background: rgba(255, 255, 255, 0.96) !important;
    color: #1a1d24 !important;
}

.cc-shorts-card__bookmark {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 3;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 0;
    background: rgba(0, 0, 0, .45);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    backdrop-filter: blur(6px);
    transition: background .2s, transform .15s;
}

.cc-shorts-card__bookmark:hover {
    background: rgba(0, 0, 0, .65);
    transform: scale(1.06);
}

.cc-shorts-card__bookmark.is-saved {
    color: #ffd166;
}

.cc-shorts-card__body {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 14px 16px 10px;
    min-height: 0;
    background: var(--cc-surface);
}

.cc-shorts-card__category {
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--cc-accent);
    margin-bottom: 8px;
}

.cc-shorts-card__title {
    margin: 0 0 8px;
    font-size: 16px;
    font-weight: 800;
    line-height: 1.3;
    color: var(--cc-ink);
}

.cc-shorts-card__summary {
    margin: 0;
    flex: 1;
    overflow-y: auto;
    font-size: 13px;
    line-height: 1.5;
    color: var(--cc-muted);
}

.cc-shorts-card__meta {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--cc-border);
    font-size: 12px;
    color: var(--cc-muted);
    display: flex;
    flex-wrap: wrap;
    gap: 6px 12px;
    max-width: 100%;
    overflow: hidden;
    word-break: break-word;
}

.cc-shorts-card__meta strong {
    color: var(--cc-ink);
    font-weight: 700;
}

.cc-shorts-card__footer {
    flex: 0 0 auto;
    display: block;
    padding: 10px 16px;
    background: #1a1d24;
    color: #f5f5f5;
    text-decoration: none !important;
    cursor: pointer;
    transition: background .2s;
}

[data-theme="dark"] .cc-shorts-card__footer {
    background: #0d0f14;
    border-top: 1px solid var(--cc-border);
}

.cc-shorts-card__footer:hover {
    background: #252932;
}

.cc-shorts-card__footer-source {
    font-size: 13px;
    font-weight: 700;
    margin-bottom: 4px;
    color: #fff;
}

.cc-shorts-card__footer-cta {
    font-size: 12px;
    opacity: .75;
}

/* Portrait ad cards (same footprint as shorts) */
.cc-shorts-card--ad {
    padding: 0;
    overflow: hidden;
    background: var(--cc-surface);
    cursor: pointer;
}

.cc-shorts-card__ad-label {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 3;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
}

.cc-shorts-card__ad-media {
    position: relative;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
    background: #111;
    display: flex;
    flex-direction: column;
}

.cc-shorts-card__ad-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.cc-shorts-card__ad-custom {
    width: 100%;
    height: 100%;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cc-shorts-card__ad-custom iframe,
.cc-shorts-card__ad-custom img {
    max-width: 100%;
    max-height: 100%;
}

.cc-shorts-card__ad-footer {
    flex: 0 0 auto;
    padding: 14px 16px 16px;
    background: linear-gradient(180deg, #1a1d26 0%, #0d0f14 100%);
    color: #fff;
}

.cc-shorts-card__ad-title {
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 4px;
}

.cc-shorts-card__ad-cta {
    font-size: 12px;
    opacity: 0.8;
}

[data-theme="dark"] .cc-shorts-card--ad {
    background: #0d0f14;
}

.cc-shorts-hint {
    text-align: center;
    margin-top: 10px;
    font-size: 12px;
    color: var(--cc-muted);
}

.cc-shorts-hint__desktop { display: inline; }
.cc-shorts-hint__mobile { display: none; }

.cc-shorts-empty {
    max-width: 420px;
    margin: 40px auto;
    padding: 32px 24px;
    text-align: center;
    border-radius: 16px;
    border: 1px solid var(--cc-border);
    background: var(--cc-surface);
    color: var(--cc-muted);
}

.cc-shorts-loading {
    position: absolute;
    bottom: -28px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 12px;
    color: var(--cc-muted);
}

/* Mobile: full-height vertical deck */
@media (max-width: 767px) {
    .cc-shorts-page {
        display: flex;
        flex-direction: column;
        min-height: calc(100svh - 120px);
        min-height: calc(100dvh - 120px);
        padding: 0;
        overflow: hidden;
    }

    body.cc-shorts-mobile-lock {
        overscroll-behavior-y: contain;
    }

    body.cc-shorts-mobile-lock .cc-shorts-page {
        min-height: calc(100svh - var(--cc-app-topbar-h, 48px) - var(--cc-app-tabbar-h, 56px));
        min-height: calc(100dvh - var(--cc-app-topbar-h, 48px) - var(--cc-app-tabbar-h, 56px));
    }

    .cc-shorts-toolbar {
        position: relative;
        z-index: 10;
        margin-bottom: 0;
        flex-direction: column;
        flex-wrap: nowrap;
        align-items: stretch;
        gap: 0;
        padding: 0;
        flex-shrink: 0;
    }

    .cc-shorts-toolbar__head,
    .cc-shorts-toolbar__saved {
        display: none !important;
    }

    .cc-shorts-cats {
        order: 0;
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        width: 100%;
        max-width: 100%;
        margin: 0;
        padding: 8px 14px;
        gap: 8px;
        touch-action: pan-x;
    }

    body.cc-mobile-app.cc-app-tab-shorts .cc-shorts-cats {
        padding-left: var(--cc-app-shell-pad, 14px);
        padding-right: var(--cc-app-shell-pad, 14px);
        background: transparent;
        border-bottom: none;
    }

    .cc-shorts-cats::-webkit-scrollbar {
        display: none;
    }

    .cc-shorts-cats__pill {
        flex: 0 0 auto;
        white-space: nowrap;
    }

    .cc-shorts-stage {
        position: relative;
        z-index: 1;
        flex: 1 1 auto;
        display: flex;
        align-items: stretch;
        width: 100%;
        min-height: var(--cc-app-shorts-deck-h, 360px);
        height: var(--cc-app-shorts-deck-h, 360px);
        padding: 8px 12px 12px;
        overflow: hidden;
    }

    .cc-shorts-nav {
        display: none;
    }

    .cc-shorts-deck {
        position: relative;
        flex: 1 1 auto;
        width: 100%;
        max-width: none;
        height: var(--cc-app-shorts-deck-h, 360px) !important;
        min-height: var(--cc-app-shorts-deck-h, 360px) !important;
        max-height: var(--cc-app-shorts-deck-h, 360px) !important;
        margin: 0;
        perspective: 1200px;
        perspective-origin: center top;
        isolation: isolate;
        overflow: hidden;
        touch-action: none;
        -webkit-user-select: none;
        user-select: none;
    }

    .cc-shorts-deck.is-dragging .cc-shorts-card {
        transition: none;
    }

    .cc-shorts-card {
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        height: 100%;
        transform-origin: center top;
        backface-visibility: hidden;
        -webkit-backface-visibility: hidden;
        box-shadow:
            0 6px 0 rgba(0, 0, 0, 0.05),
            0 20px 48px rgba(0, 0, 0, 0.28);
    }

    .cc-shorts-card[data-offset="0"] {
        z-index: 30 !important;
        filter: none !important;
    }

    .cc-shorts-card[data-offset="0"] .cc-shorts-card__body,
    .cc-shorts-card[data-offset="0"] .cc-shorts-card__footer,
    .cc-shorts-card[data-offset="0"] .cc-shorts-card__ad-footer {
        background: var(--cc-surface);
        position: relative;
        z-index: 2;
    }

    [data-theme="dark"] .cc-shorts-card[data-offset="0"] .cc-shorts-card__footer,
    [data-theme="dark"] .cc-shorts-card[data-offset="0"] .cc-shorts-card__ad-footer {
        background: #0d0f14;
    }

    .cc-shorts-card--ad {
        display: flex;
        flex-direction: column;
    }

    .cc-shorts-card--ad .cc-shorts-card__ad-media {
        flex: 1 1 72%;
    }

    .cc-shorts-card.is-behind {
        filter: blur(10px) brightness(0.72) saturate(0.85);
        box-shadow:
            0 3px 0 rgba(0, 0, 0, 0.04),
            0 10px 28px rgba(0, 0, 0, 0.2);
        pointer-events: none;
    }

    .cc-shorts-card__media {
        flex: 0 0 36%;
        min-height: 0;
    }

    .cc-shorts-card__title {
        font-size: 15px;
    }

    .cc-shorts-card__summary {
        flex: 1;
        min-height: 0;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        max-height: none;
    }

    .cc-shorts-hint {
        display: none !important;
    }

    .cc-shorts-swipe-coach.is-visible {
        display: flex;
    }

    .cc-shorts-card.cc-shorts-card--enter-next {
        animation: ccShortsDeckEnterNext .42s cubic-bezier(.22, 1, .36, 1);
    }

    .cc-shorts-card.cc-shorts-card--enter-prev {
        animation: ccShortsDeckEnterPrev .42s cubic-bezier(.22, 1, .36, 1);
    }

    .cc-shorts-card.cc-shorts-card--exit-up {
        animation: ccShortsDeckExitUp .24s cubic-bezier(.4, 0, .2, 1) forwards;
        pointer-events: none;
    }

    .cc-shorts-card.cc-shorts-card--exit-down {
        animation: ccShortsDeckExitDown .24s cubic-bezier(.4, 0, .2, 1) forwards;
        pointer-events: none;
    }
}

@media (min-width: 768px) {
    .cc-shorts-deck.is-dragging .cc-shorts-card {
        transition: none;
    }

    .cc-shorts-card {
        inset: auto;
        top: 0;
        left: 50%;
        width: min(400px, calc(100% - 96px));
        height: 100%;
        transform-origin: center center;
    }

    .cc-shorts-card.is-behind {
        filter: blur(7px) brightness(0.88) saturate(0.9);
    }

    .cc-shorts-card[data-offset="0"] {
        filter: none;
    }

    .cc-shorts-card.cc-shorts-card--enter-next {
        animation: ccShortsEnterNext .38s cubic-bezier(.22, 1, .36, 1);
    }

    .cc-shorts-card.cc-shorts-card--enter-prev {
        animation: ccShortsEnterPrev .38s cubic-bezier(.22, 1, .36, 1);
    }
}

@keyframes ccShortsDeckExitUp {
    to { transform: translateY(-108%) scale(0.9); opacity: 0; }
}

@keyframes ccShortsDeckExitDown {
    to { transform: translateY(108%) scale(0.9); opacity: 0; }
}

@keyframes ccShortsEnterNext {
    from { opacity: 0; transform: translateX(calc(-50% + 40px)) scale(.94); }
    to { opacity: 1; transform: translateX(-50%) scale(1); }
}

@keyframes ccShortsEnterPrev {
    from { opacity: 0; transform: translateX(calc(-50% - 40px)) scale(.94); }
    to { opacity: 1; transform: translateX(-50%) scale(1); }
}

@keyframes ccShortsDeckEnterNext {
    from { opacity: 0.82; transform: translateY(32px) scale(0.96); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes ccShortsDeckEnterPrev {
    from { opacity: 0.82; transform: translateY(-24px) scale(0.96); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Swipe instruction overlay (mobile) */
.cc-shorts-swipe-coach {
    position: absolute;
    inset: 0;
    z-index: 40;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    pointer-events: none;
    opacity: 1;
    visibility: visible;
    transition: opacity 0.4s ease, visibility 0.4s ease;
}

.cc-shorts-swipe-coach.is-dismissed {
    opacity: 0;
    visibility: hidden;
}

.cc-shorts-swipe-coach__inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 28px;
    padding: 24px;
    text-align: center;
}

.cc-shorts-swipe-coach__row {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-shadow: 0 1px 8px rgba(0, 0, 0, 0.4);
}

.cc-shorts-swipe-coach__icon {
    font-size: 28px;
    opacity: 0.9;
}

.cc-shorts-swipe-coach__row--up .cc-shorts-swipe-coach__icon {
    animation: ccCoachBounceUp 1.4s ease-in-out infinite;
}

.cc-shorts-swipe-coach__row--down .cc-shorts-swipe-coach__icon {
    animation: ccCoachBounceDown 1.4s ease-in-out infinite 0.2s;
}

@keyframes ccCoachBounceUp {
    0%, 100% { transform: translateY(6px); opacity: 0.5; }
    50% { transform: translateY(-10px); opacity: 1; }
}

@keyframes ccCoachBounceDown {
    0%, 100% { transform: translateY(-6px); opacity: 0.5; }
    50% { transform: translateY(10px); opacity: 1; }
}
