body:has([data-totp-tool-v2]) {
    background: radial-gradient(ellipse at 86% 14%, #e8edff 0, transparent 42%),
        radial-gradient(ellipse at 12% 70%, #e2f4fb 0, transparent 47%), #f4f7fc !important;
}

.twofa-page {
    --twofa-ink: #172b48;
    --twofa-muted: #506580;
    --twofa-blue: #1559c6;
    --twofa-border: #dce5f2;
    width: min(100%, 860px);
    margin: 0 auto;
    padding: 34px 18px 14px;
    color: var(--twofa-ink);
    font-family: system-ui, -apple-system, "Microsoft YaHei", sans-serif;
}

.twofa-page,
.twofa-page * { box-sizing: border-box; }
.twofa-page [hidden] { display: none !important; }
.twofa-page :focus-visible { outline: 3px solid #4080ed; outline-offset: 3px; }

.twofa-back {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--twofa-blue);
    font-size: .9rem;
    font-weight: 650;
}

.twofa-heading { margin: 15px 0 20px; }
.twofa-heading h1 {
    margin: 0 0 9px;
    font-size: clamp(1.75rem, 4vw, 2.6rem);
    font-weight: 800;
    line-height: 1.2;
}
.twofa-heading p,
.twofa-help,
.twofa-clock { margin: 0; color: var(--twofa-muted); line-height: 1.6; }
.twofa-heading p { font-size: .9rem; }
.twofa-heading i { margin-right: 3px; color: var(--twofa-blue); }

.twofa-card {
    padding: 26px 30px;
    background: #fff;
    border: 1px solid var(--twofa-border);
    border-radius: 23px;
    box-shadow: 0 18px 50px rgba(34, 72, 131, .09);
}

.twofa-tabs {
    display: inline-flex;
    gap: 4px;
    max-width: 100%;
    margin: 0 0 18px;
    padding: 4px;
    background: #edf2fa;
    border-radius: 12px;
}
.twofa-tabs button {
    min-height: 38px;
    padding: 6px 17px;
    color: var(--twofa-muted);
    background: transparent;
    border: 0;
    border-radius: 9px;
    font: inherit;
    font-size: .88rem;
    font-weight: 650;
    cursor: pointer;
}
.twofa-tabs [aria-selected="true"] {
    color: var(--twofa-blue);
    background: #fff;
    box-shadow: 0 1px 4px rgba(34, 72, 131, .12);
}

.twofa-label { display: block; margin: 0 0 7px; font-size: .875rem; font-weight: 700; }
.twofa-input-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: start; gap: 10px; }
.twofa-input {
    width: 100%;
    min-width: 0;
    min-height: 44px;
    padding: 9px 12px;
    color: var(--twofa-ink);
    background: #f9fbfe;
    border: 1px solid #cfdced;
    border-radius: 11px;
    font: inherit;
    font-size: 1rem;
}
.twofa-input::placeholder { color: #60748d; opacity: 1; }
textarea.twofa-input { resize: vertical; }
.twofa-input[aria-invalid="true"] { border-color: #b22941; }
.twofa-help { margin-top: 6px; font-size: .82rem; overflow-wrap: anywhere; }

.twofa-button {
    display: inline-flex;
    min-height: 44px;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 14px;
    color: var(--twofa-blue);
    background: #fff;
    border: 1px solid #cfdced;
    border-radius: 11px;
    font: inherit;
    font-size: .89rem;
    font-weight: 700;
    cursor: pointer;
}
.twofa-button:hover:not(:disabled) { background: #edf4ff; }
.twofa-button:disabled { color: #60718a; cursor: default; opacity: .77; }
.twofa-primary {
    width: 100%;
    margin-top: 13px;
    color: #fff;
    background: linear-gradient(110deg, #115dc7, #285adf);
    border-color: transparent;
    box-shadow: 0 5px 14px rgba(25, 92, 204, .19);
}
.twofa-primary:hover:not(:disabled) { background: #104fb9; }
.twofa-feedback { min-height: 1.25em; margin: 5px 0; color: var(--twofa-blue); font-size: .82rem; overflow-wrap: anywhere; }
.twofa-feedback.is-error, .twofa-qr-error { color: #a92037; }

.twofa-result {
    padding: 17px 19px;
    background: linear-gradient(155deg, #f1f6ff, #f9fbfe 78%);
    border: 1px solid var(--twofa-border);
    border-radius: 16px;
}
.twofa-result-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 5px 14px; font-size: .9rem; }
.twofa-time { color: var(--twofa-muted); font-size: .82rem; font-variant-numeric: tabular-nums; }
.twofa-time.is-ending { color: #a34a00; }
.twofa-code {
    display: flex;
    justify-content: center;
    gap: .26em;
    margin: 12px 0 14px;
    color: var(--twofa-ink);
    font: 750 clamp(1.7rem, 8.2vw, 3.6rem)/1.12 ui-monospace, Consolas, monospace;
    font-variant-numeric: tabular-nums;
    letter-spacing: .065em;
    white-space: nowrap;
}
.twofa-progress {
    display: block;
    width: 100%;
    height: 6px;
    overflow: hidden;
    color: #337bed;
    background: #dfe8f6;
    border: 0;
    border-radius: 20px;
    accent-color: currentColor;
    appearance: none;
}
.twofa-progress.is-ending { color: #d77a17; }
.twofa-progress::-webkit-progress-bar { background: #dfe8f6; }
.twofa-progress::-webkit-progress-value { background: currentColor; border-radius: 20px; }
.twofa-progress::-moz-progress-bar { background: currentColor; border-radius: 20px; }
.twofa-next { margin: 9px 0 12px; color: var(--twofa-muted); font-size: .84rem; text-align: center; }
.twofa-next span { margin-left: 6px; color: var(--twofa-blue); font: 700 .94rem ui-monospace, Consolas, monospace; }
.twofa-result-actions { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 9px; }
.twofa-copy { background: #e8f0ff; border-color: #cadbff; }
.twofa-copy:hover:not(:disabled) { background: #dbe9ff; }

.twofa-batch-list { display: grid; gap: 7px; margin: 10px 0 0; padding: 0; list-style: none; }
.twofa-batch-list:empty { margin: 0; }
.twofa-batch-list li {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto auto;
    gap: 8px 14px;
    align-items: center;
    padding: 7px 11px;
    background: #fff;
    border: 1px solid var(--twofa-border);
    border-radius: 10px;
}
.twofa-batch-label { font-size: .875rem; overflow-wrap: anywhere; }
.twofa-batch-code { font: 750 1.15rem ui-monospace, Consolas, monospace; white-space: nowrap; }
.twofa-compact { min-height: 38px; padding: 5px 11px; font-size: .8rem; }

.twofa-qr { margin-top: 14px; background: #fafcff; border: 1px solid var(--twofa-border); border-radius: 13px; }
.twofa-qr summary {
    display: flex;
    min-height: 47px;
    align-items: center;
    gap: 8px;
    padding: 9px 12px;
    color: var(--twofa-blue);
    font-weight: 700;
    font-size: .9rem;
    list-style: none;
    cursor: pointer;
}
.twofa-qr summary::-webkit-details-marker { display: none; }
.twofa-qr summary i:last-child { margin-left: auto; }
.twofa-qr[open] summary i:last-child { transform: rotate(180deg); }
.twofa-qr-body { display: grid; grid-template-columns: 204px minmax(0, 1fr); align-items: center; gap: 16px; padding: 0 14px 14px; }
.twofa-qr-image { width: 100%; max-width: 204px; padding: 21px; background: #fff; border: 1px solid var(--twofa-border); border-radius: 12px; }
.twofa-qr-image:empty { display: none; }
.twofa-qr-image canvas { display: block; width: 100%; height: auto; image-rendering: pixelated; }
.twofa-qr-fields input { display: block; margin: 5px 0 9px; font-weight: 400; }
.twofa-qr-error { margin: 0; font-size: .82rem; }
.twofa-clock { margin-top: 14px; font-size: .8rem; text-align: center; }

@media (max-width: 540px) {
    .twofa-page { padding: 20px 12px 10px; }
    .twofa-heading { margin-bottom: 14px; }
    .twofa-card { padding: 16px 13px; border-radius: 17px; }
    .twofa-result { padding: 13px 10px; }
    .twofa-button { padding-inline: 9px; }
    .twofa-batch-list li { grid-template-columns: minmax(0, 1fr) auto auto; gap: 5px 8px; }
    .twofa-batch-label { grid-column: 1 / -1; }
    .twofa-batch-code { font-size: 1rem; }
    .twofa-batch-list .twofa-time { font-size: .73rem; }
    .twofa-qr-body { grid-template-columns: minmax(0, 1fr); }
    .twofa-qr-image { justify-self: center; }
}
