/* Owner-only version history shares the Insights live-refresh region. */
.deck-history {
    min-width: 0;
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--line);
}

.deck-history-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: .75rem;
    margin-bottom: 1rem;
}

.deck-history-heading h3,
.deck-history-heading p,
.deck-history-empty {
    margin: 0;
}

.deck-history-heading .field-help {
    margin-top: .3rem;
}

.deck-history-heading .count-badge {
    flex-shrink: 0;
    white-space: nowrap;
}

.deck-history-timeline {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: min(16rem, calc(100vw - 6rem));
    gap: .75rem;
    min-width: 0;
    max-width: 100%;
    margin: 0;
    padding: .3rem .3rem .8rem;
    list-style: none;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x proximity;
    scrollbar-width: thin;
    scrollbar-color: var(--line-strong) transparent;
}

.deck-history-item {
    position: relative;
    display: flex;
    min-width: 0;
    padding-top: 1.45rem;
    scroll-snap-align: start;
}

.deck-history-item::before {
    content: "";
    position: absolute;
    top: .25rem;
    left: .75rem;
    width: .5rem;
    height: .5rem;
    border: 1px solid var(--line-strong);
    border-radius: 50%;
    background: var(--ink-800);
}

.deck-history-item:not(:last-child)::after {
    content: "";
    position: absolute;
    top: calc(.5rem - .5px);
    left: 1.25rem;
    right: -1.5rem;
    height: 1px;
    background: var(--line);
}

.deck-history-item.is-current::before {
    border-color: var(--sky-300, #a1d7f6);
    background: var(--sky-300, #a1d7f6);
}

.deck-history-entry,
.deck-history-preview {
    display: grid;
    align-content: start;
    min-width: 0;
    gap: .25rem;
    padding: .65rem .75rem;
    border: 1px solid var(--line);
    border-radius: .7rem;
    background: rgba(12, 16, 21, .22);
    color: var(--paper-200);
    text-align: left;
    overflow-wrap: anywhere;
}

.deck-history-entry {
    width: 100%;
}

.deck-history-current {
    border-color: var(--sky-300, #a1d7f6);
    background: rgba(58, 156, 255, .16);
    box-shadow: inset 0 0 0 1px rgba(116, 195, 255, .18);
}

button.deck-history-choice {
    width: 100%;
    font: inherit;
    line-height: 1.4;
    cursor: pointer;
}

.deck-history-choice:hover {
    border-color: var(--sky-300, #a1d7f6);
    background: rgba(116, 195, 255, .08);
}

.deck-history-choice:focus-visible {
    outline: 2px solid var(--sky-300, #a1d7f6);
    outline-offset: 3px;
}

.deck-history-entry-heading {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: .3rem .65rem;
}

.deck-history-label {
    font-size: .9rem;
    font-weight: 650;
}

.deck-history-current-badge {
    padding: .12rem .45rem;
    border: 1px solid rgba(116, 195, 255, .32);
    border-radius: 999px;
    background: rgba(116, 195, 255, .1);
    color: var(--sky-300, #a1d7f6);
    font-size: .7rem;
    line-height: 1.4;
}

.deck-history-time,
.deck-history-counts {
    color: var(--paper-400);
    font-size: .75rem;
    line-height: 1.45;
    font-weight: 400;
}

.deck-history-counts {
    display: flex;
    flex-wrap: wrap;
    gap: .2rem .8rem;
    font-variant-numeric: tabular-nums;
}

.deck-history-counts strong {
    color: var(--paper-200);
    font-weight: 600;
}

.deck-history-confirmation .popover-heading h3 {
    margin: 0;
    font-size: 1.15rem;
}

.deck-history-confirmation .popover-heading .icon-button {
    flex-shrink: 0;
}

.deck-history-confirm-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: .6rem;
}

.deck-history-feedback {
    margin: 0;
    color: var(--paper-400);
    font-size: .85rem;
    overflow-wrap: anywhere;
}

.deck-history-feedback:empty {
    display: none;
}

.deck-history-feedback.is-error {
    color: #ffb6b0;
}

@media (max-width: 25rem) {
    .deck-history-heading {
        flex-wrap: wrap;
    }

    .deck-history-confirmation > form {
        padding: 1rem;
    }

    .deck-history-confirm-actions > .button {
        flex: 1 1 auto;
        min-width: 0;
    }
}

@media (max-height: 30rem) {
    .deck-history-confirmation {
        width: min(calc(100% - 1rem), 34rem);
        max-block-size: calc(100dvh - 1rem);
        overflow: auto;
    }
}
