[data-rph-nav-entry][aria-busy="true"] {
    opacity: 0.76;
    cursor: wait;
}

/* 同步面板和同步密码框：面板、标题栏、关闭按钮和按钮用页面原生类名（compact-modal-panel、editor-modal-header 等），
 * 这里只补布局、打开动画和内容区颜色；颜色变量见下方 RPHubUI 一节，同时适用于 1.9.x 和 2.0 的浅色、深色模式。 */
.rp-sync-modal {
    position: fixed;
    inset: 0;
    z-index: 90;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    color: var(--rk-text);
}

.rp-sync-modal.is-open {
    display: flex;
    animation: rph-ui-fade-in var(--dur-3, 0.24s) var(--ease-out, cubic-bezier(0.22, 1, 0.36, 1));
}

.rp-sync-modal.is-open .rp-sync-modal__panel {
    animation: rph-ui-rise-in var(--dur-4, 0.32s) var(--ease-out, cubic-bezier(0.22, 1, 0.36, 1));
}

@keyframes rph-ui-fade-in { from { opacity: 0; } }
@keyframes rph-ui-rise-in { from { transform: translate3d(0, 18px, 0) scale(0.965); } }

.rp-sync-modal__backdrop {
    position: absolute;
    inset: 0;
    background: var(--overlay, rgba(0, 0, 0, 0.5));
    backdrop-filter: blur(6px) saturate(120%);
}

.rp-sync-modal__panel.compact-modal-panel {
    max-width: 26rem;
    max-height: calc(100dvh - 2rem);
    overflow-y: auto;
    padding: 0 1rem 1rem;
}

.rp-sync-modal__header.editor-modal-header {
    position: sticky;
    top: 0;
    z-index: 2;
    gap: 0.75rem;
    margin: 0 -1rem 0.875rem;
}

.rp-sync-modal__eyebrow,
.rp-sync-modal__title-sub {
    display: block;
    margin-bottom: 3px;
    color: var(--rk-accent);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.rp-sync-modal__title,
.rp-sync-modal__title-main {
    display: block;
    margin: 0;
    color: var(--rk-text);
    font-size: 18px;
    line-height: 1.15;
    font-weight: 800;
}

.rp-sync-main-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.rp-sync-action-button {
    min-width: 0;
    height: 42px;
    border: 1px solid var(--rk-field-border);
    border-radius: var(--r-md, 0.75rem);
    background: var(--rk-field);
    color: var(--rk-text);
    font-size: 15px;
    font-weight: 800;
    cursor: pointer;
    transition: border-color 0.16s ease, background 0.16s ease, color 0.16s ease, transform 0.16s ease;
}

.rp-sync-action-button:hover,
.rp-sync-action-button.is-primary {
    border-color: var(--rk-accent);
    background: var(--rk-tint);
    color: var(--rk-accent);
}

.rp-sync-action-button:active { transform: scale(0.96); }

.rp-sync-action-button:disabled,
.rp-sync-modal__button:disabled,
.rp-sync-version-button:disabled {
    opacity: 0.6;
    cursor: wait;
    transform: none;
}

.rp-sync-modal__status {
    min-height: 22px;
    margin: 14px 0 10px;
    color: var(--rk-muted);
    font-size: 13px;
    line-height: 1.55;
}

.rp-sync-progress {
    width: 100%;
    height: 8px;
    overflow: hidden;
    border-radius: 999px;
    background: var(--rk-border);
}

.rp-sync-progress__bar {
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: var(--rk-accent);
    transition: width 0.28s ease;
}

.rp-sync-progress__value {
    margin-top: 6px;
    text-align: right;
    color: var(--rk-accent);
    font-size: 12px;
    font-weight: 800;
}

.rp-sync-update-details {
    margin-top: 14px;
    border-top: 1px solid var(--rk-border);
    padding-top: 10px;
}

.rp-sync-update-details summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: var(--rk-text);
    cursor: pointer;
    font-size: 13px;
    font-weight: 800;
    list-style: none;
}

.rp-sync-update-details summary::-webkit-details-marker { display: none; }
.rp-sync-update-details summary::after { content: "展开"; color: var(--rk-muted); font-size: 12px; font-weight: 700; }
.rp-sync-update-details[open] summary::after { content: "收起"; }
.rp-sync-update-body { padding-top: 10px; }
.rp-sync-update-body [data-role="self-update-info"] { white-space: pre-line; }

.rp-sync-choice__desc,
.rp-sync-modal__intro,
.rp-sync-password-status {
    margin: 0 0 10px;
    color: var(--rk-muted);
    font-size: 13px;
    line-height: 1.55;
}

.rp-sync-version-fields {
    display: grid;
    gap: 8px;
    margin: 8px 0 10px;
}

.rp-sync-version-fields label,
.rp-sync-password-field {
    display: grid;
    gap: 7px;
    color: var(--rk-text);
    font-size: 13px;
    font-weight: 700;
}

.rp-sync-version-picker { position: relative; }

.rp-sync-version-button,
.rp-sync-password-field input {
    position: relative;
    width: 100%;
    min-height: 38px;
    border: 1px solid var(--rk-field-border);
    border-radius: var(--r-md, 0.75rem);
    background: var(--rk-field);
    color: var(--rk-text);
    font-size: 13px;
    line-height: 1.45;
    padding: 8px 12px;
    text-align: left;
    outline: none;
}

.rp-sync-version-button {
    padding-right: 36px;
    font-weight: 700;
    cursor: pointer;
}

.rp-sync-version-button::after {
    content: "";
    position: absolute;
    right: 15px;
    top: 50%;
    width: 8px;
    height: 8px;
    border-right: 2px solid var(--rk-muted);
    border-bottom: 2px solid var(--rk-muted);
    transform: translateY(-65%) rotate(45deg);
    pointer-events: none;
}

.rp-sync-password-field input { font-size: 15px; padding: 10px 12px; }

.rp-sync-password-field input:focus {
    border-color: var(--rk-accent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--rk-accent) 18%, transparent);
}

.rp-sync-version-menu {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 6px);
    z-index: 20;
    display: none;
    max-height: 190px;
    overflow-y: auto;
    border: 1px solid var(--rk-field-border);
    border-radius: var(--r-md, 0.75rem);
    background: var(--c-elevated, var(--rk-field));
    box-shadow: var(--shadow-3, 0 18px 46px -28px rgba(15, 23, 42, 0.48));
    padding: 6px;
}

.rp-sync-version-menu.is-open {
    display: grid;
    gap: 2px;
}

.rp-sync-version-option {
    width: 100%;
    border: 0;
    border-radius: 0.5rem;
    background: transparent;
    color: var(--rk-text);
    cursor: pointer;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.35;
    padding: 9px 10px;
    text-align: left;
}

.rp-sync-version-option:hover {
    background: var(--rk-tint);
    color: var(--rk-accent);
}

.rp-sync-inline-actions,
.rp-sync-modal__actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}

.rp-sync-modal__actions { margin-top: 16px; }
.rp-sync-password-field { margin-top: 14px; }
.rp-sync-password-status { min-height: 20px; margin: 10px 0 0; }

.rp-sync-modal__button {
    justify-content: center;
    padding: 0.5rem 0.9rem;
    font-size: 13px;
}

@media (max-width: 640px) {
    .rp-sync-inline-actions { display: grid; grid-template-columns: 1fr; }
}

/* RPHubUI 弹窗（DB/ui-kit.js）：面板、标题栏、关闭和按钮用页面原生类名，由各版本 RPH 自己的样式决定外观；
 * 这里只补位置、动画（RPH 2.0 自带同样的 modal 过渡，1.9.x 没有）和内容区用到的颜色。
 * 颜色先取 RPH 2.0 的 --c-*（深色模式下它们会被页面改成深色值），1.9.x 没有时深色模式退到 --night-*。 */
.rph-ui-overlay {
    position: fixed;
    inset: 0;
    z-index: 90;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: var(--overlay, rgba(0, 0, 0, 0.5));
    backdrop-filter: blur(6px) saturate(120%);
}
:is(.rph-ui-overlay, .rp-sync-modal) {
    --rk-text: var(--c-text, #111827);
    --rk-muted: var(--c-text-3, #6b7280);
    --rk-border: var(--c-border-soft, #e5e7eb);
    /* 输入框用比弹窗底色深一档的 raised 色：浅色模式下 --c-field 和弹窗同为白色，手机上分不清。 */
    --rk-field: var(--c-raised, #f3f4f6);
    --rk-field-border: var(--c-border-strong, #d1d5db);
    --rk-tint: var(--c-accent-soft, #eff6ff);
    --rk-accent: var(--c-accent-text, #2563eb);
    --rk-danger: var(--c-danger, #dc2626);
}
:root[data-app-theme="dark"] :is(.rph-ui-overlay, .rp-sync-modal) {
    --rk-text: var(--c-text, var(--night-text));
    --rk-muted: var(--c-text-3, var(--night-muted));
    --rk-border: var(--c-border-soft, var(--night-border));
    --rk-field: var(--c-raised, var(--night-field));
    --rk-field-border: var(--c-border-strong, var(--night-border));
    --rk-tint: var(--c-accent-soft, var(--night-tint));
    --rk-accent: var(--c-accent-text, var(--night-accent));
    --rk-danger: var(--c-danger, #f87171);
}
.rph-ui-overlay.modal-enter-active { transition: opacity var(--dur-3, 0.24s) var(--ease-out, cubic-bezier(0.22, 1, 0.36, 1)); }
.rph-ui-overlay.modal-leave-active { transition: opacity var(--dur-1, 0.12s) var(--ease-in, ease-in); }
.rph-ui-overlay:is(.modal-enter-from, .modal-leave-to) { opacity: 0; }
.rph-ui-overlay.modal-enter-active > .rph-ui-panel { transition: transform var(--dur-4, 0.32s) var(--ease-out, cubic-bezier(0.22, 1, 0.36, 1)); }
.rph-ui-overlay.modal-leave-active > .rph-ui-panel { transition: transform var(--dur-1, 0.12s) var(--ease-in, ease-in); }
.rph-ui-overlay.modal-enter-from > .rph-ui-panel { transform: translate3d(0, 18px, 0) scale(0.965); }
.rph-ui-overlay.modal-leave-to > .rph-ui-panel { transform: translate3d(0, 8px, 0) scale(0.985); }
.rph-ui-panel { max-height: calc(100dvh - 2rem); color: var(--rk-text); outline: none; }
.rph-ui-title { min-width: 0; margin: 0; font-size: 1.05rem; font-weight: 700; overflow-wrap: anywhere; }
.rph-ui-body { min-height: 0; overflow: auto; padding: 1rem; font-size: 0.875rem; line-height: 1.5; }
.rph-ui-message { margin: 0 0 1rem; color: var(--rk-muted); white-space: pre-line; }
.rph-ui-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 0.5rem; }
.rph-ui-button { justify-content: center; white-space: nowrap; }
.rph-ui-button:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }
.rph-ui-button.rph-ui-danger:not(.modal-primary-button) { color: var(--rk-danger); }
.modal-primary-button.rph-ui-danger { background: var(--rk-danger) !important; }
.rph-ui-section { margin: 0 0 1.25rem; }
.rph-ui-list + .rph-ui-section { margin-top: 1.25rem; }
.rph-ui-section > h3 { margin: 0 0 0.5rem; font-size: 0.95rem; font-weight: 700; }
.rph-ui-note { margin: 0 0 0.875rem; padding: 0.55rem 0.75rem; border-left: 3px solid var(--rk-accent); border-radius: 0.375rem; background: var(--rk-tint); }
.rph-ui-muted { color: var(--rk-muted); font-size: 0.8rem; overflow-wrap: anywhere; }
.rph-ui-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem 0.875rem; padding: 0.8rem 0.25rem; border-bottom: 1px solid var(--rk-border); }
.rph-ui-row-main { min-width: 0; flex: 1 1 14rem; }
.rph-ui-row-main > :first-child { font-weight: 650; overflow-wrap: anywhere; }
.rph-ui-row-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 0.5rem; }
.rph-ui-list { border-top: 1px solid var(--rk-border); }
.rph-ui-empty { margin: 0; padding: 1.5rem 0.5rem; text-align: center; color: var(--rk-muted); }
.rph-ui-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr)); gap: 0.5rem; }
.rph-ui-grid > .rph-ui-button { justify-content: flex-start; text-align: left; white-space: normal; }
.rph-ui-inline { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; margin-bottom: 0.75rem; }
.rph-ui-field { display: grid; gap: 0.35rem; margin-bottom: 0.75rem; font-weight: 600; }
.rph-ui-input {
    width: 100%;
    min-width: 0;
    padding: 0.5rem 0.7rem;
    border: 1px solid var(--rk-field-border);
    border-radius: 0.6rem;
    background: var(--rk-field);
    color: var(--rk-text);
    font: inherit;
    font-weight: 400;
}
.rph-ui-input:focus { outline: none; border-color: var(--rk-accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--rk-accent) 18%, transparent); }
textarea.rph-ui-input { min-height: 6rem; resize: vertical; }
.rph-ui-check { position: relative; display: inline-flex; align-items: center; gap: 0.35rem; white-space: nowrap; cursor: pointer; }
.rph-ui-badge { padding: 0.15rem 0.5rem; border-radius: 999px; background: var(--rk-tint); color: var(--rk-accent); font-size: 0.75rem; white-space: nowrap; }
.rph-ui-badge[data-tone="error"] { background: color-mix(in srgb, var(--rk-danger) 14%, transparent); color: var(--rk-danger); }
.rph-ui-badge[data-tone="muted"] { background: color-mix(in srgb, var(--rk-muted) 16%, transparent); color: var(--rk-muted); }
.rph-ui-toast-stack { position: fixed; top: 1.25rem; left: 50%; z-index: 100; display: grid; gap: 0.5rem; transform: translateX(-50%); pointer-events: none; }
.rph-ui-toast-stack .toast-item { padding: 0.6rem 1.1rem; border: 1px solid var(--c-border, #e5e7eb); border-radius: 999px; background: var(--c-surface, #fff); color: var(--c-text, #111827); box-shadow: 0 8px 22px rgba(15, 23, 42, 0.16); }
:is(.rph-ui-panel, .rp-sync-modal__panel) .modal-close-button svg { width: 1.25rem; height: 1.25rem; }
.rph-ui-body p.rph-ui-muted { margin: 0 0 0.75rem; }
/* RPH 原生提示条是单行的，长消息会被截成省略号；改为自动换行，圆角改成单行时看着仍像药丸、多行时不变形的大小。 */
.toast-item { border-radius: 1.3rem; }
.toast-text { overflow: visible; white-space: normal; overflow-wrap: anywhere; }
