@layer components {
    /*
     * Draws nothing itself: a mount point for the controller. Without `display: contents` the
     * hidden bar would still take the grid gap of whatever wraps it — the same reason SwUpdate
     * does it.
     */
    .install {
        display: contents;
    }

    /*
     * **The guard that SwUpdate learned the hard way, and it is not optional here either.**
     *
     * The template hides the bar with the `hidden` attribute, which works through the browser's
     * own `[hidden] { display: none }`. Author CSS beats the user-agent sheet, so a `display: flex`
     * below would silently cancel it and the offer would sit on every page from the first load,
     * with nothing to install and no way to dismiss it. That bug was reported three times on the
     * update bar before anybody looked at the pixels instead of at `hidden`.
     */
    .install__bar[hidden] {
        display: none;
    }

    /*
     * Sticky and in the flow, at the top, for the reasons written out in SwUpdate.css: a fixed bar
     * at offset zero lands under the system status bar on a page with `viewport-fit=cover` and
     * cannot be pressed, and the bottom of the player is where a thumb is already reaching for
     * pause.
     */
    .install__bar {
        position: sticky;
        inset-block-start: 0;
        z-index: 20;
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: var(--space-s);
        padding: var(--space-s) var(--space-m);
        border-block-end: 1px solid var(--color-border);
        background-color: var(--color-surface);
        color: var(--color-text);
        box-shadow: 0 8px 24px rgb(0 0 0 / 25%);
    }

    .install__text {
        flex: 1 1 12rem;
        margin: 0;
        font-size: var(--text-s);
    }

    .install__actions {
        display: flex;
        gap: var(--space-xs);
    }

    /* The settings entry: a column, sitting inside the settings form's own grid. */
    .install__setting {
        display: grid;
        gap: var(--space-2xs);
        width: 100%;
        max-width: 32rem;
        justify-items: start;
    }

    .install__state:empty {
        display: none;
    }

    .install__state,
    .install__hint,
    .install__check {
        margin: 0;
        color: var(--color-text-muted);
        font-size: var(--text-s);
        text-align: start;
    }

    .install__copy {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: var(--space-xs);
    }

    /*
     * Selectable on purpose, and `user-select: all` so one tap takes the whole address: this is
     * the fallback for a head unit whose browser has no clipboard API, where the only way out is a
     * long-press and "copy".
     */
    .install__url {
        padding: var(--space-2xs) var(--space-xs);
        border: 1px solid var(--color-border);
        border-radius: var(--radius-m);
        background-color: var(--color-surface);
        color: var(--color-text);
        font-size: var(--text-s);
        user-select: all;
        -webkit-user-select: all;
    }

    /*
     * Small, because this is an offer and not an alert — but not smaller than a thumb: 2.75rem is
     * the floor for anything tapped in a parked car.
     */
    .install__action {
        min-block-size: 2.75rem;
        padding-inline: var(--space-m);
        border: 1px solid var(--color-border);
        border-radius: var(--radius-full);
        background-color: transparent;
        color: inherit;
        font-size: var(--text-s);
        cursor: pointer;
    }

    .install__action[hidden] {
        display: none;
    }

    .install__action--primary {
        border-color: transparent;
        background-color: var(--color-accent);
        color: var(--color-accent-contrast);
        font-weight: 600;
    }

    /* The browser's own dialog is open. Visible rather than gone, so the wait does not read as
       "nothing happened". */
    .install__action[disabled] {
        opacity: 0.5;
    }
}
