@layer app {
    .r1v-share {
        --r1v-share-border: color-mix(in srgb, currentColor 18%, transparent);
        display: inline-flex;
        align-items: center;
        flex-wrap: wrap;
        gap: 0.375rem;
        max-width: 100%;
        color: var(--wp--preset--color--rov-ink, #262523);
        font-size: 0.8125rem;
    }

    .r1v-share__label {
        color: inherit;
        font-size: 0.6875rem;
        font-weight: 750;
        letter-spacing: 0.1em;
        text-transform: uppercase;
    }

    .r1v-share__actions {
        display: inline-flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 0.25rem;
    }

    .r1v-share__action,
    .r1v-share-action,
    .r1v-share__unfold,
    .r1v-share-qr-dialog__close,
    .r1v-share-qr-dialog__download {
        min-height: 2.25rem;
        border: 1px solid var(--r1v-share-border, color-mix(in srgb, currentColor 18%, transparent));
        border-radius: 0.5rem;
        background: transparent;
        color: inherit;
        cursor: pointer;
        font: inherit;
        line-height: 1;
    }

    .r1v-share__action,
    .r1v-share-action {
        position: relative;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 0.375rem;
        padding: 0.5rem 0.625rem;
        white-space: nowrap;
    }

    .r1v-share__action--icon { width: 2.25rem; padding-inline: 0; }

    .r1v-share__icon {
        display: inline-grid;
        width: 1em;
        height: 1em;
        place-items: center;
    }

    .r1v-share__icon > i { grid-area: 1 / 1; transition: opacity 140ms ease, transform 140ms ease; }
    .r1v-share__success-icon { opacity: 0; transform: translateY(0.2em) scale(0.82); }

    /* Preserve the established share bar independently of the new URL provider. */
    .r1v-share[data-share-widget="legacy"] {
        gap: 0.375rem;
        padding: 0.5rem;
        border: 1px solid #1f2937;
        border-radius: 0.25rem;
        background: #f3f4f6;
        color: #111;
    }
    .r1v-share[data-share-widget="legacy"] .r1v-share__actions { gap: 0.5rem; }
    .r1v-share[data-share-widget="legacy"] .r1v-share__action {
        width: 1.875rem;
        min-width: 1.875rem;
        min-height: 1.875rem;
        height: 1.875rem;
        padding: 0;
        border: 1px solid #1f2937;
        border-radius: 0.25rem;
        font-size: 1.125rem;
        background: var(--r1v-share-tile, transparent);
        color: var(--r1v-share-tile-ink, #111);
    }
    .r1v-share[data-share-widget="legacy"] [data-share-platform="facebook"] { --r1v-share-tile: #355c90; --r1v-share-tile-ink: #fff; }
    .r1v-share[data-share-widget="legacy"] [data-share-platform="twitter"] { --r1v-share-tile: #000; --r1v-share-tile-ink: #fff; }
    .r1v-share[data-share-widget="legacy"] [data-share-platform="email"] { --r1v-share-tile: #d24837; --r1v-share-tile-ink: #fff; }
    .r1v-share[data-share-widget="legacy"] [data-share-platform="copy"] { --r1v-share-tile: #e86729; --r1v-share-tile-ink: #fff; }
    .r1v-share[data-share-widget="legacy"] [data-share-platform="native"],
    .r1v-share[data-share-widget="legacy"] [data-share-platform="qr"] { border-color: transparent; }
    .r1v-share[data-share-widget="legacy"] .r1v-share__action:hover { filter: brightness(0.9); }
    .r1v-share[data-share-widget="legacy"] .r1v-share__action:focus-visible { outline: 2px solid #111; outline-offset: 3px; }

    /* Filtered results keep activity beside sharing, with the count below on phones. */
    .filter-results-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 0.5rem;
    }

    .filter-results-header__count { white-space: nowrap; }

    .filter-results-header__activity {
        margin-left: auto;
        padding: 0;
        border: 0;
        background: transparent;
        color: inherit;
        cursor: pointer;
        font: inherit;
        line-height: 1.2;
        text-decoration: underline;
    }

    .filter-results-header__activity:focus-visible {
        outline: 2px solid currentColor;
        outline-offset: 2px;
    }

    .filter-results-header > .r1v-share-shell { flex: 0 0 auto; }

    .r1v-share__action:hover,
    .r1v-share__action:focus-visible,
    .r1v-share-action:hover,
    .r1v-share-action:focus-visible,
    .r1v-share__unfold:hover,
    .r1v-share__unfold:focus-visible,
    .r1v-share-qr-dialog__close:hover,
    .r1v-share-qr-dialog__close:focus-visible,
    .r1v-share-qr-dialog__download:hover,
    .r1v-share-qr-dialog__download:focus-visible {
        border-color: currentColor;
        background: color-mix(in srgb, currentColor 8%, transparent);
        color: inherit;
        outline: none;
    }

    .r1v-share__action:disabled,
    .r1v-share-action:disabled { cursor: default; opacity: 0.58; }

    .r1v-share__action[aria-busy="true"],
    .r1v-share-action[aria-busy="true"] { cursor: wait; }

    .r1v-share__action.is-success,
    .r1v-share-action.is-success,
    .r1v-share[data-share-widget="legacy"] .r1v-share__action.is-success {
        border-color: #24754d;
        background: #24754d;
        color: #fff;
    }

    .r1v-share__action.is-success .r1v-share__icon > :first-child,
    .r1v-share-action.is-success .r1v-share__icon > :first-child {
        opacity: 0;
        transform: translateY(-0.15em) scale(0.82);
    }

    .r1v-share__action.is-success .r1v-share__success-icon,
    .r1v-share-action.is-success .r1v-share__success-icon {
        opacity: 1;
        transform: translateY(0) scale(1);
        animation: r1v-share-check-in 220ms ease-out;
    }

    @keyframes r1v-share-check-in {
        from { transform: translateY(0.25em) scale(0.75); }
        70% { transform: translateY(-0.04em) scale(1.06); }
        to { transform: translateY(0) scale(1); }
    }

    .r1v-share__unfold {
        display: inline-flex;
        align-items: center;
        gap: 0;
        overflow: hidden;
        padding: 0.5rem 0.625rem;
        transition: gap 160ms ease, padding 160ms ease;
    }

    .r1v-share__unfold[hidden] { display: none; }

    .r1v-share__unfold-label {
        width: 0;
        overflow: hidden;
        opacity: 0;
        white-space: nowrap;
        transition: width 160ms ease, opacity 160ms ease;
    }

    .r1v-share[data-share-widget="unfold"] {
        flex-wrap: nowrap;
        width: 2.25rem;
        max-width: 100%;
        overflow: hidden;
        transition: width 180ms ease;
    }

    .r1v-share[data-share-widget="unfold"] .r1v-share__label,
    .r1v-share[data-share-widget="unfold"] .r1v-share__actions { display: none; }

    .r1v-share[data-share-widget="unfold"].is-unfolded {
        width: min(100%, 26rem);
        flex-wrap: wrap;
        overflow: visible;
    }

    .r1v-share[data-share-widget="unfold"].is-unfolded .r1v-share__actions { display: inline-flex; }

    .r1v-share__status {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
        clip-path: inset(50%);
        white-space: nowrap;
    }

    .r1v-share__status.is-visible {
        position: static;
        flex-basis: 100%;
        width: auto;
        height: auto;
        overflow: visible;
        clip: auto;
        clip-path: none;
        margin-top: 0.125rem;
        color: #9b2c20;
        font-size: 0.75rem;
        line-height: 1.35;
        white-space: normal;
    }

    .r1v-share-qr-dialog {
        width: min(31rem, calc(100vw - 2rem));
        max-width: calc(100vw - 2rem);
        max-height: calc(100dvh - 2rem);
        margin: auto;
        padding: 0;
        border: 0;
        border-radius: 0.875rem;
        color: #173d31;
        background: #f7f3e9;
        box-shadow: 0 1.5rem 4rem rgb(0 0 0 / 32%);
    }

    .r1v-share-qr-dialog::backdrop { background: rgb(23 21 18 / 62%); }

    .r1v-share-qr-dialog__shell {
        display: flex;
        max-height: calc(100dvh - 2rem);
        flex-direction: column;
    }

    .r1v-share-qr-dialog__header { display: flex; align-items: start; justify-content: space-between; padding: 1.375rem 1.5rem 0.875rem; border-bottom: 1px solid #d1d8ce; }
    .r1v-share-qr-dialog__close {
        display: grid;
        width: 2.75rem;
        min-height: 2.75rem;
        padding: 0;
        place-items: center;
        border-radius: 50%;
    }

    .r1v-share-qr-dialog h2 { margin: 0; font-size: clamp(1.25rem, 4vw, 1.625rem); }

    .r1v-share-qr-dialog__tabs { display: flex; gap: 1.25rem; padding: 0 1.5rem; border-bottom: 1px solid #d1d8ce; }
    .r1v-share-qr-dialog__tabs button { min-height: 3rem; padding: 0; border: 0; border-bottom: 3px solid transparent; background: transparent; color: #617067; cursor: pointer; font: inherit; font-weight: 700; }
    .r1v-share-qr-dialog__tabs button[aria-selected="true"] { border-color: #08784d; color: #173d31; }
    .r1v-share-qr-dialog__tabs span, .r1v-share-qr-dialog__controls span { font-size: 0.6875rem; font-weight: 500; }

    .r1v-share-qr-dialog__body { min-height: 0; overflow: auto; padding: 1.375rem 1.5rem; }

    .r1v-share-qr-dialog__image {
        display: grid;
        width: min(100%, 15.5rem);
        margin: 0 auto;
        padding: 0.75rem;
        place-items: center;
        border: 1px solid #e5dfd6;
        border-radius: 0.75rem;
        background: #fff;
    }

    .r1v-share-qr-dialog__image svg { display: block; width: 100%; height: auto; }
    .r1v-share-qr-dialog__url { overflow-wrap: anywhere; margin: 1rem auto 0; color: #6b655e; font-size: 0.75rem; line-height: 1.45; text-align: center; }
    .r1v-share-qr-dialog__note { margin: 0.75rem 0 0; color: #617067; font-size: 0.8125rem; text-align: center; }

    .r1v-share-qr-dialog__print-grid { display: grid; gap: 0.875rem; }
    .r1v-share-qr-dialog__controls { border: 1px solid #d1d8ce; border-radius: 0.5rem; background: #fffaf0; }
    .r1v-share-qr-dialog__controls summary { padding: 0.75rem 0.875rem; color: #173d31; cursor: pointer; font-size: 0.8125rem; font-weight: 750; }
    .r1v-share-qr-dialog__controls > div { padding: 0 0.875rem 0.875rem; }
    .r1v-share-qr-dialog__controls label { display: block; margin-bottom: 0.375rem; font-size: 0.8125rem; font-weight: 750; }
    .r1v-share-qr-dialog__controls textarea { box-sizing: border-box; display: block; width: 100%; min-height: 5.5rem; resize: vertical; padding: 0.625rem; border: 1px solid #aebbb0; border-radius: 0.375rem; background: #fff; color: #173d31; font: inherit; }
    .r1v-share-qr-dialog__controls p, .r1v-share-qr-dialog__proof-note { margin: 0.5rem 0 0; color: #617067; font-size: 0.75rem; line-height: 1.4; }
    .r1v-share-qr-dialog__photo-picker { min-width: 0; margin: 0; padding: 0; border: 0; }
    .r1v-share-qr-dialog__photo-picker legend { padding: 0; font-size: 0.8125rem; font-weight: 750; }
    .r1v-share-qr-dialog__photo-picker > p { margin: 0.25rem 0 0.625rem; color: #617067; font-size: 0.75rem; }
    .r1v-share-qr-dialog__photo-options { display: flex; flex-wrap: wrap; gap: 0.5rem; max-height: 10rem; overflow-y: auto; padding: 0.1875rem; }
    .r1v-share-qr-dialog__photo-option { position: relative; flex: 0 0 4.5rem; width: 4.5rem; height: 4.5rem; padding: 0.1875rem; border: 2px solid transparent; border-radius: 0.5625rem; background: #fff; cursor: pointer; }
    .r1v-share-qr-dialog__photo-option img { display: block; width: 100%; height: 100%; border-radius: 0.25rem; object-fit: cover; }
    .r1v-share-qr-dialog__photo-option[aria-pressed=true] { border-color: #24754d; background: #e5f0e7; }
    .r1v-share-qr-dialog__photo-option > i { position: absolute; right: 0.25rem; bottom: 0.25rem; padding: 0.25rem; border-radius: 50%; background: #24754d; color: #fff; font-size: 0.625rem; }
    .r1v-share-qr-dialog__photo-option:focus-visible { outline: 3px solid #24754d; outline-offset: 2px; }
    .r1v-share-qr-dialog__preview { display: grid; width: 100%; max-height: calc(100dvh - 20rem); margin-inline: auto; overflow: hidden; place-items: center; border: 1px solid #d1d8ce; border-radius: 0.5rem; background: #dfe4dc; }
    .r1v-share-qr-dialog__preview svg { display: block; width: auto; max-width: 100%; height: auto; max-height: calc(100dvh - 20rem); }
    .r1v-share-qr-dialog__error { margin: 0.875rem 0 0; color: #9b2c20; font-size: 0.8125rem; line-height: 1.4; }

    .r1v-share-qr-dialog__footer { display: flex; gap: 0.75rem; justify-content: flex-end; padding: 0.875rem 1.5rem calc(0.875rem + env(safe-area-inset-bottom)); border-top: 1px solid #d1d8ce; }
    .r1v-share-qr-dialog__download {
        display: inline-grid;
        align-items: center;
        justify-content: center;
        grid-template-columns: 1em auto;
        column-gap: 0.5rem;
        min-height: 2.75rem;
        padding: 0.625rem 0.875rem;
        border-color: #08784d;
        background: #fff;
        color: #08784d;
        font-weight: 750;
    }

    .r1v-share-qr-dialog__download-icon,
    .r1v-share-qr-dialog__download-check { grid-area: 1 / 1; }
    .r1v-share-qr-dialog__download-check { visibility: hidden; }
    .r1v-share-qr-dialog__download span { grid-area: 1 / 2; }
    .r1v-share-qr-dialog__footer .r1v-share-qr-dialog__print { width: 2.75rem; flex: 0 0 2.75rem; grid-template-columns: 1fr; padding: 0.625rem; }
    .r1v-share-qr-dialog__download.is-success {
        border-color: #24754d;
        background: #24754d;
        color: #fff;
    }
    .r1v-share-qr-dialog__download.is-success .r1v-share-qr-dialog__download-icon { visibility: hidden; }
    .r1v-share-qr-dialog__download.is-success .r1v-share-qr-dialog__download-check { visibility: visible; }

    .r1v-share-qr-dialog__download:hover,
    .r1v-share-qr-dialog__download:focus-visible { background: #e7f1e8; color: #08784d; }
    .r1v-share-qr-dialog__download--primary { background: #08784d; color: #fff; }
    .r1v-share-qr-dialog__download--primary:hover,
    .r1v-share-qr-dialog__download--primary:focus-visible { background: #065f3d; color: #fff; }

    @media (pointer: coarse), (max-width: 600px) {
        .r1v-share__action,
        .r1v-share-action,
        .r1v-share__unfold,
        .r1v-share-qr-dialog__close {
            min-width: 2.75rem;
            min-height: 2.75rem;
        }

        .r1v-share__action--icon { width: 2.75rem; }
        .r1v-share[data-share-widget="legacy"] .r1v-share__actions { gap: 0.25rem; }
        .r1v-share[data-share-widget="legacy"] .r1v-share__action {
            width: 2.75rem;
            min-width: 2.75rem;
            min-height: 2.75rem;
            height: 2.75rem;
        }
    }

    @media (max-width: 600px) {
        .r1v-share-qr-dialog { width: 100%; max-width: 100%; max-height: 90dvh; margin: 10dvh 0 0; border-radius: 0.875rem 0.875rem 0 0; }
        .r1v-share-qr-dialog__shell { max-height: 90dvh; }
        .r1v-share-qr-dialog__header, .r1v-share-qr-dialog__body { padding-inline: 1.25rem; }
        .r1v-share-qr-dialog__tabs { padding-inline: 1.25rem; }
        .r1v-share-qr-dialog__preview,
        .r1v-share-qr-dialog__preview svg { max-height: calc(100dvh - 25rem); }
        .r1v-share-qr-dialog__footer { padding-inline: 1.25rem; }
        .r1v-share-qr-dialog__download { width: 100%; }
        .filter-results-header {
            display: grid;
            grid-template-areas:
                "activity share"
                "count count";
            grid-template-columns: minmax(0, 1fr) auto;
            gap: 0.25rem;
        }

        .filter-results-header__count {
            grid-area: count;
            justify-self: start;
        }

        .filter-results-header__activity {
            grid-area: activity;
            justify-self: start;
            margin-left: 0;
        }

        .filter-results-header > .r1v-share-shell {
            grid-area: share;
            min-width: 0;
        }

        .filter-results-header .r1v-share[data-share-widget="legacy"] {
            gap: 0;
            padding: 0.125rem;
        }

        .filter-results-header .r1v-share[data-share-widget="legacy"] .r1v-share__actions {
            flex-wrap: nowrap;
            gap: 0.125rem;
        }

        .filter-results-header .r1v-share[data-share-widget="legacy"] .r1v-share__action {
            box-sizing: border-box;
            width: 2rem;
            min-width: 2rem;
            min-height: 2rem;
            height: 2rem;
            font-size: 1rem;
        }
    }

    /* A phone already has a useful share sheet. Keep one generous touch target,
       not a six-tile toolbar above the story. The existing native action also
       owns the clipboard fallback in browsers without navigator.share.
       Copy-only widgets and explicitly selected Unfold designs stay intact. */
    @media (max-width: 600px) {
        .r1v-share[data-share-widget="legacy"]:has([data-share-platform="native"]) {
            gap: 0;
            padding: 0;
            border: 0;
            background: transparent;
        }
        .r1v-share[data-share-widget="legacy"]:has([data-share-platform="native"]) .r1v-share__label,
        .r1v-share[data-share-widget="legacy"]:has([data-share-platform="native"]) [data-share-platform]:not([data-share-platform="native"]) {
            display: none;
        }
        .r1v-share[data-share-widget="legacy"]:has([data-share-platform="native"]) .r1v-share__actions {
            gap: 0;
        }
        .r1v-share[data-share-widget="legacy"] [data-share-platform="native"].r1v-share__action {
            width: 2.75rem;
            min-width: 2.75rem;
            height: 2.75rem;
            min-height: 2.75rem;
            border: 1px solid var(--r1v-share-border);
            border-radius: 0.5rem;
            font-size: 1.125rem;
        }
    }

    @media (max-height: 500px) {
        .r1v-share-qr-dialog__header { padding-block: 0.625rem; }
        .r1v-share-qr-dialog__close { width: 2.25rem; min-height: 2.25rem; }
        .r1v-share-qr-dialog__tabs button { min-height: 2.5rem; }
        .r1v-share-qr-dialog__body { padding-block: 0.625rem; }
        .r1v-share-qr-dialog__controls summary { padding-block: 0.5rem; }
        .r1v-share-qr-dialog__preview,
        .r1v-share-qr-dialog__preview svg { max-height: calc(100dvh - 15.5rem); }
        .r1v-share-qr-dialog__footer { padding-block: 0.5rem; }
        .r1v-share-qr-dialog__download { min-height: 2.5rem; }
    }

    @media (prefers-reduced-motion: reduce) {
        .r1v-share__unfold,
        .r1v-share__unfold-label,
        .r1v-share[data-share-widget="unfold"],
        .r1v-share__icon > i { transition: none; }

        .r1v-share__action.is-success .r1v-share__success-icon,
        .r1v-share-action.is-success .r1v-share__success-icon { animation: none; }
    }
}
