@layer legacy {
/* =====================================================================
 * Paste fallback - the surface the user pastes INTO when the browser
 * will not let the page read the clipboard (any non-secure origin, which
 * is every LAN address). Pairs with client/js/paste-fallback.js, the
 * only thing that builds this markup.
 *
 * Same overlay treatment as the copy sheet next door, and the same call
 * on colour: the --oc-* palette rather than the session theme's
 * --color-* names, because this sheet is appended to <body> and sits
 * outside the chrome roots client/css/terminal-carnivore.css rebinds.
 * Every hit area is still a thumb-sized 44px and the whole thing still
 * fits at 390px.
 * ===================================================================== */

.paste-fallback {
    position: fixed;
    inset: 0;
    /* z-index is written inline by paste-fallback.js from OVERLAY_Z. It
     * sits above both fab menus (10001) and below FabMenu.NOTICE_Z
     * (10005), so a result reported while this is open lands on top. */
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--oc-backdrop);
    padding: 16px;
}

.paste-fallback__panel {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
    max-width: 560px;
    padding: 16px;
    border-radius: var(--oc-radius-sm);
    background: var(--oc-ground-raised);
    border: var(--oc-border) solid var(--oc-line-panel);
    /* Flat, like the copy sheet. The backdrop already says "modal". */
    box-shadow: none;
}

.paste-fallback__title {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    color: var(--oc-text-primary);
}

.paste-fallback__hint {
    margin: 0;
    font-size: 13px;
    line-height: 1.45;
    color: var(--oc-text-secondary);
}

/* The field iOS has to be willing to focus and paste into: a real,
 * writable textarea with real dimensions and selectable text. iOS
 * ignores select() on a readonly input and refuses a zero-size or
 * `user-select: none` target, so none of those shortcuts are taken
 * here. The 16px minimum is what stops Safari zooming the page in on
 * focus, which on a phone reads as the layout breaking. */
.paste-fallback__input {
    width: 100%;
    min-height: 96px;
    resize: vertical;
    padding: 10px;
    font-family: var(--font-mono);
    font-size: 16px;
    line-height: 1.4;
    color: var(--oc-text-primary);
    background: var(--oc-ground-field);
    border: var(--oc-border) solid var(--oc-line-faint);
    border-radius: var(--oc-radius-sm);
    -webkit-user-select: text;
    user-select: text;
}

.paste-fallback__actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.paste-fallback__btn {
    min-height: 44px;
    min-width: 88px;
    padding: 0 16px;
    font-family: inherit;
    font-size: 14px;
    border-radius: var(--oc-radius-sm);
    border: var(--oc-border) solid var(--oc-line-panel);
    background: transparent;
    color: var(--oc-text-secondary);
    cursor: pointer;
}

/* "insert" is the one button here that acts, so it is the only one
 * wearing the orange. */
.paste-fallback__btn--primary {
    border-color: var(--oc-orange);
    color: var(--oc-orange);
}

/* CANCEL'S HOVER DOES NOT REACH FOR THE ACCENT. Both buttons turning
 * orange together is the "accent as decoration" habit this palette drops;
 * the secondary brightens its ground, its rule and its text instead. */
.paste-fallback__btn:hover:not(:disabled),
.paste-fallback__btn:focus-visible {
    border-color: var(--oc-line-rule);
    background: var(--oc-ground-hover);
    color: var(--oc-text-primary);
}

/* After the shared rule above, same specificity, so source order decides. */
.paste-fallback__btn--primary:hover:not(:disabled),
.paste-fallback__btn--primary:focus-visible {
    border-color: var(--oc-orange-bright);
    background: var(--oc-orange-tint);
    color: var(--oc-orange-bright);
}

/* At phone width the buttons take the full row rather than huddling in
 * the corner, and the panel becomes a bottom sheet like the copy one. */
@media (max-width: 480px) {
    .paste-fallback {
        align-items: flex-end;
        padding: 0;
    }

    .paste-fallback__panel {
        max-width: none;
        border-radius: var(--oc-radius-sm) var(--oc-radius-sm) 0 0;
        padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    }

    .paste-fallback__btn {
        flex: 1;
    }
}
}
