.theme-options-viewport {
    position: relative;
    overflow: hidden;
}

.theme-options-glass {
    padding: 20px 28px 30px;
    scroll-behavior: smooth;
}

.theme-scroll-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 38px;
    height: 38px;
    margin: 0;
    padding: 0;
    /* Kill any inline baseline gap so the glyph sits dead-centre */
    line-height: 0;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    color: rgba(15, 23, 42, 0.7);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow:
        0 3px 12px rgba(15, 23, 42, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.45);
    backdrop-filter: blur(10px) saturate(150%);
    -webkit-backdrop-filter: blur(10px) saturate(150%);
    cursor: pointer;
    /* Hidden until the surrounding card area is hovered/focused,
       so the buttons don't intrude otherwise. */
    opacity: 0;
    pointer-events: none;
    transition:
        opacity 0.3s ease,
        transform 0.28s cubic-bezier(0.16, 1, 0.3, 1),
        background-color 0.25s ease,
        color 0.25s ease,
        box-shadow 0.25s ease,
        border-color 0.25s ease;
    z-index: 3;
}

/* Reveal the scroll buttons only while the user is interacting with
   the theme card scroll area (hover or keyboard focus). */
.theme-options-viewport:hover .theme-scroll-btn,
.theme-options-viewport:focus-within .theme-scroll-btn {
    opacity: 1;
    pointer-events: auto;
}

.theme-scroll-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.92);
    color: #0f172a;
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-50%) scale(1.08);
    box-shadow:
        0 8px 22px rgba(15, 23, 42, 0.14),
        inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.theme-scroll-btn:active:not(:disabled) {
    transform: translateY(-50%) scale(0.94);
    transition-duration: 0.1s;
}

.theme-scroll-btn:disabled {
    opacity: 0;
    cursor: default;
    transform: translateY(-50%);
    pointer-events: none;
}

/* While the area is hovered, surface a faint disabled arrow so the
   start/end boundary stays discoverable without being obtrusive. */
.theme-options-viewport:hover .theme-scroll-btn:disabled,
.theme-options-viewport:focus-within .theme-scroll-btn:disabled {
    opacity: 0.2;
}

.theme-scroll-btn[hidden] {
    display: none;
}

.theme-scroll-btn__glyph {
    width: 18px;
    height: 18px;
    margin: 0;
    display: block;
    pointer-events: none;
}

.theme-scroll-btn-next .theme-scroll-btn__glyph {
    transform: scaleX(-1);
}

.theme-scroll-btn-prev {
    left: 12px;
}

.theme-scroll-btn-next {
    right: 12px;
}

@media (max-width: 640px) {
    .theme-options-viewport {
        padding: 20px 12px;
    }

    .theme-options-glass {
        gap: 16px;
        padding: 16px 20px 24px;
    }

    /* No hover on touch devices — keep the buttons always reachable. */
    .theme-scroll-btn {
        width: 36px;
        height: 36px;
        opacity: 1;
        pointer-events: auto;
    }

    .theme-scroll-btn__glyph {
        width: 16px;
        height: 16px;
    }

    .theme-scroll-btn-prev {
        left: 10px;
    }

    .theme-scroll-btn-next {
        right: 10px;
    }

    .theme-card {
        width: min(250px, calc(100vw - 88px));
    }
}
