.deck {
    --deck-accent: var(--cyan-accent, #00e5ff);
    --deck-line: var(--border-subtle, rgba(255, 255, 255, .1));
    --deck-muted: var(--text-muted, #9a9ab0);
    --deck-text: var(--text, #f1f1f8);
    --deck-gap: clamp(10px, 2cqw, 24px);
    --deck-slide: min(70cqw, 800px);
    container-type: inline-size;
    margin-top: 1.5rem;
}

.deck-track {
    position: relative;
    display: flex;
    gap: var(--deck-gap);
    overflow-x: auto;
    overflow-y: hidden;
    padding: 1.4rem calc((100cqw - var(--deck-slide)) / 2) 1.6rem;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    overscroll-behavior-x: contain;
    perspective: 1400px;
    perspective-origin: 50% 50%;
    outline: none;
    -webkit-overflow-scrolling: touch;
}

.deck-track::-webkit-scrollbar {
    display: none;
}

.deck-track:focus-visible {
    box-shadow: inset 0 0 0 2px rgba(0, 229, 255, .45);
    border-radius: 18px;
}

.deck-track.is-dragging {
    scroll-snap-type: none;
    scroll-behavior: auto;
}

.deck-slide {
    flex: 0 0 var(--deck-slide);
    margin: 0;
    scroll-snap-align: center;
    scroll-snap-stop: always;
    -webkit-tap-highlight-color: transparent;
}

.deck-frame {
    display: flex;
    flex-direction: column;
    aspect-ratio: var(--deck-ratio, 3 / 2);
    border-radius: 16px;
    overflow: hidden;
    background: rgba(14, 14, 22, .74);
    border: 1px solid var(--deck-line);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transform: translateZ(calc(var(--a, 0) * -170px)) rotateY(calc(var(--d, 0) * -26deg));
    opacity: var(--o, 1);
    will-change: transform, opacity;
    transition: border-color .4s ease, box-shadow .4s ease;
    user-select: none;
    -webkit-user-select: none;
}

.deck-slide.is-active .deck-frame {
    border-color: rgba(0, 229, 255, .5);
    box-shadow: 0 0 0 1px rgba(0, 229, 255, .16), 0 34px 90px -34px rgba(0, 229, 255, .4);
}

.deck-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: .6rem .95rem;
    border-bottom: 1px solid var(--deck-line);
    font-family: 'JetBrains Mono', monospace;
    font-size: .66rem;
    font-weight: 600;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--deck-muted);
}

.deck-idx {
    color: var(--deck-accent);
}

.deck-shot {
    position: relative;
    flex: 1;
    min-height: 0;
    --pad: clamp(8px, 1.8cqw, 20px);
    background: radial-gradient(120% 90% at 50% 0%, rgba(124, 77, 255, .10), transparent 60%);
}

.deck-shot img {
    position: absolute;
    top: var(--pad);
    left: var(--pad);
    width: calc(100% - var(--pad) * 2);
    height: calc(100% - var(--pad) * 2);
    object-fit: contain;
    border-radius: 6px;
    -webkit-user-drag: none;
    pointer-events: none;
}

.deck-sr {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

.deck-hud {
    display: grid;
    gap: .9rem;
    max-width: var(--deck-slide);
    margin: 0 auto;
}

.deck-progress {
    height: 2px;
    border-radius: 2px;
    background: rgba(255, 255, 255, .08);
    overflow: hidden;
}

.deck-progress i {
    display: block;
    width: 100%;
    height: 100%;
    transform-origin: left center;
    transform: scaleX(calc(.125 + var(--p, 0) * .875));
    background: linear-gradient(90deg, var(--deck-accent), #7c4dff, #ff2d95);
    box-shadow: 0 0 12px rgba(0, 229, 255, .6);
}

.deck-meta {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: .4rem 1rem;
    align-items: center;
}

.deck-line {
    min-width: 0;
}

.deck-count {
    font-family: 'JetBrains Mono', monospace;
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .12em;
    color: var(--deck-accent);
}

.deck-title {
    margin-left: .7rem;
    font-weight: 700;
    color: var(--deck-text);
}

.deck-desc {
    margin: .25rem 0 0;
    font-size: .88rem;
    line-height: 1.5;
    color: var(--deck-muted);
}

.deck-nav {
    display: flex;
    gap: .5rem;
}

.deck-btn {
    position: relative;
    box-sizing: border-box;
    flex: none;
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    min-width: 0;
    min-height: 0;
    margin: 0;
    padding: 0;
    overflow: hidden;
    -webkit-appearance: none;
    appearance: none;
    border-radius: 50%;
    border: 1px solid var(--deck-line);
    background: rgba(21, 21, 32, .6);
    color: var(--deck-text);
    line-height: 0;
    transform: none;
    transition: border-color .25s ease, box-shadow .25s ease, opacity .25s ease;
}

.deck-btn::before,
.deck-btn::after {
    content: none;
}

.deck-btn svg {
    display: block;
    width: 18px;
    height: 18px;
    pointer-events: none;
}

.deck-btn:hover:not(:disabled),
.deck-btn:focus-visible,
.deck-btn:active {
    transform: none;
    border-color: var(--deck-accent);
    box-shadow: 0 0 14px rgba(0, 229, 255, .3);
    outline: none;
}

.deck-btn:disabled {
    opacity: .3;
    pointer-events: none;
}

.deck-rail {
    position: relative;
    display: flex;
    gap: .5rem;
    justify-content: center;
    justify-content: safe center;
    overflow-x: auto;
    padding: .5rem .3rem .6rem;
    scrollbar-width: none;
}

.deck-rail::-webkit-scrollbar {
    display: none;
}

.deck-thumb {
    flex: 0 0 auto;
    width: 84px;
    height: 56px;
    padding: 0;
    border-radius: 9px;
    border: 1px solid var(--deck-line);
    background: #0b0b12;
    overflow: hidden;
    opacity: .5;
    transition: opacity .3s ease, border-color .3s ease, box-shadow .3s ease, transform .3s ease;
}

.deck-thumb img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: left top;
    pointer-events: none;
}

.deck-thumb:hover,
.deck-thumb:focus-visible {
    opacity: .85;
    outline: none;
}

.deck-thumb[aria-current="true"] {
    opacity: 1;
    border-color: var(--deck-accent);
    box-shadow: 0 0 16px rgba(0, 229, 255, .4);
    transform: translateY(-2px);
}

@container (max-width: 640px) {
    .deck-track {
        --deck-slide: 76cqw;
    }

    .deck-hud {
        max-width: none;
        padding: 0 1rem;
    }

    .deck-frame {
        aspect-ratio: var(--deck-ratio-sm, 1 / 1);
    }

    .deck-btn {
        width: 34px;
        height: 34px;
    }

    .deck-thumb {
        width: 64px;
        height: 44px;
    }

    .deck-desc {
        font-size: .82rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .deck-frame,
    .deck-thumb {
        transition: none;
    }
}
