:root {
    --fd-accent: var(--accent);
    --fd-bg: var(--bg);
    --fd-fg: var(--fg);
    --fd-muted: var(--muted);
    --fd-card: var(--glass2);
    --fd-line: var(--line);
    --fd-error: #ff453a;
    --fd-success: #32d74b;
    --aaa-ease-out: cubic-bezier(0.22, 1, 0.36, 1);
    --aaa-spring: cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
[data-theme="light"] {
    --fd-bg: #fbfbfd;
    --fd-fg: #000000;
    --fd-muted: #6e6e73;
    --fd-card: #ffffff;
    --fd-line: rgba(0,0,0,0.08);
    --fd-error: #ff3b30;
    --fd-success: #34c759;
}
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}
body, html {
    background-color: var(--fd-bg);
    color: var(--fd-fg);
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    height: 100%;
    overflow: hidden;
    user-select: none;
    -webkit-font-smoothing: antialiased;
}
.white-flash-shield {
    position: fixed;
    inset: 0;
    background: var(--fd-bg);
    z-index: 9999;
    pointer-events: none;
    animation: fadeOut 0.6s var(--aaa-ease-out) forwards;
}
@keyframes fadeOut {
    to { opacity: 0; visibility: hidden; }
}
.fd-wrapper {
    display: flex;
    flex-direction: column;
    height: 100dvh;
    background: radial-gradient(circle at 50% 0%, rgba(0, 122, 255, 0.08), transparent 60%);
    position: relative;
    z-index: 1;
}
.topbar {
    height: 64px;
    display: flex;
    align-items: center;
    padding: 0 16px;
    background: var(--glass);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border-bottom: 0.5px solid var(--fd-line);
    z-index: 100;
}
[data-theme="light"] .topbar {
    background: var(--glass);
    border-bottom: 0.5px solid var(--fd-line);
}
.topbar-title {
    position: absolute;
    left: 0;
    right: 0;
    text-align: center;
    font-weight: 700;
    font-size: 1.05rem;
    pointer-events: none;
    letter-spacing: -0.01em;
}
.back-btn {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: var(--fd-accent);
    background: transparent;
    border: none;
    cursor: pointer;
    z-index: 101;
    transition: background-color 0.2s, transform 0.2s var(--aaa-spring);
    margin-right: -8px;
}
.back-btn:hover {
    background: rgba(150, 150, 150, 0.1);
}
.back-btn:active {
    transform: scale(0.9);
}
.fd-content {
    flex: 1;
    padding: 0 24px 40px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    display: flex;
    flex-direction: column;
    align-items: center;
}
.fd-content > * {
    width: 100%;
    max-width: 460px;
}
.fd-hero {
    padding: 24px 0 20px;
    text-align: center;
}
.fd-icon-glow {
    width: 88px;
    height: 88px;
    margin: 0 auto 20px;
    background: linear-gradient(135deg, #00c6ff, #007aff);
    border-radius: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 12px 24px -6px rgba(0, 122, 255, 0.4);
    position: relative;
    transition: transform 0.6s var(--aaa-spring), box-shadow 0.6s var(--aaa-spring);
}
.fd-icon-glow:hover,
.fd-icon-glow:active {
    transform: scale(1.08) translateY(-4px);
    box-shadow: 0 24px 40px -8px rgba(0, 122, 255, 0.6);
}
.fd-icon-glow svg {
    transition: transform 0.6s var(--aaa-spring);
}
.fd-icon-glow:hover svg {
    transform: scale(1.1);
}
.fd-icon-glow::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    padding: 2px;
    background: linear-gradient(135deg, rgba(255,255,255,0.4), transparent 60%);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
}
.fd-hero h1 {
    font-size: 26px;
    font-weight: 800;
    margin: 0 0 10px;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, var(--fd-fg), var(--fd-muted));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
.fd-hero p {
    font-size: 13.5px;
    color: var(--fd-muted);
    line-height: 1.5;
    margin: 0 auto;
    font-weight: 500;
    white-space: nowrap;
}
.fd-card {
    background: var(--fd-card);
    border-radius: 28px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow: 0 20px 40px -12px rgba(0,0,0,0.15), inset 0 1px 1px rgba(255,255,255,0.1);
    padding: 24px;
    position: relative;
    width: 100%;
}
[data-theme="light"] .fd-card {
    border: 1px solid rgba(0, 0, 0, 0.06);
    box-shadow: 0 20px 40px -12px rgba(0,0,0,0.06), inset 0 1px 1px #ffffff;
}
.pw-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.pw-input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.pw-label {
    font-size: 13px;
    font-weight: 700;
    color: var(--fd-fg);
    margin-right: 6px;
    letter-spacing: 0.01em;
}
.pw-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    border-radius: 18px;
    background: rgba(120, 120, 120, 0.05);
    border: 1px solid rgba(120, 120, 120, 0.1);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1);
    box-shadow: inset 0 2px 6px rgba(0,0,0,0.02);
}
[data-theme="light"] .pw-input-wrapper {
    background: rgba(0,0,0,0.03);
    border: 1px solid rgba(0,0,0,0.06);
    box-shadow: inset 0 2px 6px rgba(0,0,0,0.02);
}
.pw-input-wrapper:focus-within {
    border-color: var(--fd-accent);
    background: rgba(120, 120, 120, 0.08);
    box-shadow: 0 8px 20px -8px rgba(0, 122, 255, 0.25), inset 0 1px 3px rgba(0,0,0,0.02), 0 0 0 1px var(--fd-accent);
    transform: translateY(-2px);
}
[data-theme="light"] .pw-input-wrapper:focus-within {
    background: #ffffff;
    box-shadow: 0 8px 20px -8px rgba(0, 122, 255, 0.2), inset 0 1px 3px rgba(0,0,0,0.01), 0 0 0 1px var(--fd-accent);
}
.pw-input {
    width: 100%;
    background: transparent;
    border: none;
    padding: 16px 20px 16px 52px;
    font-size: 15px;
    color: var(--fd-fg);
    font-family: inherit;
    font-weight: 600;
    outline: none;
    border-radius: 18px;
}
.pw-input::placeholder {
    color: var(--fd-muted);
    font-weight: 500;
    opacity: 0.7;
}
.totp-input {
    padding-left: 20px;
    letter-spacing: 8px;
    text-align: center;
    font-weight: 800;
    font-size: 18px;
    font-variant-numeric: tabular-nums;
}
.pw-toggle-btn {
    position: absolute;
    left: 14px;
    background: none;
    border: none;
    color: var(--fd-muted);
    cursor: pointer;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
    outline: none !important;
    -webkit-tap-highlight-color: rgba(0,0,0,0) !important;
    -webkit-tap-highlight-color: transparent !important;
    user-select: none;
    -webkit-touch-callout: none;
}
.pw-toggle-btn:focus,
.pw-toggle-btn:active,
.pw-toggle-btn:hover,
.pw-toggle-btn:visited {
    outline: none !important;
    background: transparent !important;
    -webkit-tap-highlight-color: rgba(0,0,0,0) !important;
    -webkit-tap-highlight-color: transparent !important;
}
.pw-toggle-btn:hover {
    color: var(--fd-fg);
    background: rgba(255,255,255,0.08);
}
[data-theme="light"] .pw-toggle-btn:hover {
    background: rgba(0,0,0,0.05);
}
.pw-toggle-btn svg {
    width: 20px;
    height: 20px;
    stroke-width: 2.2;
}
.pw-message {
    font-size: 13px;
    padding: 14px;
    border-radius: 16px;
    text-align: center;
    font-weight: 600;
    animation: slideDown 0.4s var(--aaa-spring) forwards;
    margin-top: 4px;
    transform-origin: top center;
}
.pw-message.pw-hide {
    animation: slideUp 0.4s var(--aaa-ease-out) forwards;
}
@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px) scale(0.96); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes slideUp {
    from { opacity: 1; transform: translateY(0) scale(1); }
    to { opacity: 0; transform: translateY(-10px) scale(0.96); }
}
.pw-error {
    background: rgba(255, 69, 58, 0.1);
    color: var(--fd-error);
    border: 1px solid rgba(255, 69, 58, 0.2);
}
.pw-success {
    background: rgba(50, 215, 75, 0.1);
    color: var(--fd-success);
    border: 1px solid rgba(50, 215, 75, 0.2);
}
.fd-btn-primary {
    width: 100%;
    height: 56px;
    margin-top: 24px;
    flex-shrink: 0;
    margin-bottom: 24px;
    background: linear-gradient(135deg, #00c6ff, #007aff);
    border: none;
    border-radius: 20px;
    color: #fff;
    font-weight: 700;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    box-shadow: 0 10px 24px -6px rgba(0, 122, 255, 0.4);
    transition: all 0.3s var(--aaa-spring);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}
.fd-btn-primary::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.15), transparent);
    transform: translateX(-100%);
    animation: fd-shimmer 4s infinite cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes fd-shimmer {
    0% { transform: translateX(-100%) skewX(-15deg); }
    15% { transform: translateX(100%) skewX(-15deg); }
    100% { transform: translateX(100%) skewX(-15deg); }
}
.fd-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 16px 32px -6px rgba(0, 122, 255, 0.5);
}
.fd-btn-primary:active:not(:disabled) {
    transform: scale(0.96);
    box-shadow: 0 4px 12px -4px rgba(0, 122, 255, 0.4);
}
.fd-btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}
.fd-animate {
    opacity: 0;
    transform: translateY(24px) scale(0.98);
    transition: opacity 0.6s var(--aaa-ease-out), transform 0.6s var(--aaa-ease-out);
}
.fd-visible {
    opacity: 1;
    transform: translateY(0) scale(1);
}
[dir="rtl"] .back-btn svg {
    transform: rotate(180deg);
}
