/* 全站登录 / 注册弹窗（2026-11-12）
 * 版式照 xiazaitu.com/main/api-recharge.html 的 auth-panel：渐变头 + 滑动 tab 指示器
 * + 图标输入框 + 圆角主按钮。类名统一 dpa- 前缀，避免与各页既有样式冲突。
 * 生效范围：由 main.py 的 _inject_tidy_base() 注入到所有对外页面（含首页）。
 * 移动端：面板高度不超过 100dvh，表体内部滚动，输入框 16px 防 iOS 聚焦放大。
 */

/* 显隐由 JS 控制：open() 先把 display 设 flex，强制 reflow 后再用双 rAF 加 .show，
 * close() 先移除 .show 播完退场再 display:none。
 * 之前用 visibility 做纯 CSS 切换，Chrome 能跑，但 Safari 在 hidden → visible 的
 * 同一帧里会跳过 opacity 过渡，表现就是「直接弹出」，所以改回 display + 分帧。 */
.dpa-cover {
    position: fixed;
    inset: 0;
    z-index: 9000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    overflow-y: auto;
    background: rgba(15, 23, 42, .55);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    opacity: 0;
    transition: opacity .2s ease;
}

.dpa-cover.show {
    opacity: 1;
}

.dpa-panel {
    position: relative;
    width: min(432px, 100%);
    margin: auto;
    border-radius: 26px;
    background: #fff;
    overflow: hidden;
    box-shadow: 0 46px 90px -36px rgba(15, 23, 42, .72), 0 0 0 1px rgba(255, 255, 255, .55);
    transform: translateY(24px) scale(.96);
    transition: transform .32s cubic-bezier(.2, .8, .3, 1);
    will-change: transform;
    backface-visibility: hidden;
    max-height: calc(100dvh - 40px);
    display: flex;
    flex-direction: column;
}

.dpa-cover.show .dpa-panel {
    transform: translateY(0) scale(1);
}

/* ---------- 入场细节：logo 弹入 → 标题/副标题上浮 → 表单渐显 ----------
 * 只在 .show 时挂动画；关闭移除 .show，动画自然失效、由 .dpa-panel 的
 * transform transition 反向退出。tab 区不加动画（它自己要用 opacity 过渡做
 * 「忘记密码」态的收起），避免 animation 的 fill 覆盖 transition。 */
.dpa-cover.show .dpa-logo {
    animation: dpaPop .38s cubic-bezier(.34, 1.56, .64, 1) .05s both;
}

.dpa-cover.show .dpa-title {
    animation: dpaRise .32s cubic-bezier(.2, .8, .3, 1) .07s both;
}

.dpa-cover.show .dpa-sub {
    animation: dpaRise .32s cubic-bezier(.2, .8, .3, 1) .09s both;
}

.dpa-cover.show .dpa-form.active {
    animation: dpaRise .3s cubic-bezier(.2, .8, .3, 1) .1s both;
}

@keyframes dpaPop {
    from {
        opacity: 0;
        transform: scale(.7) rotate(-8deg);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

@keyframes dpaRise {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

.dpa-close {
    position: absolute;
    top: 18px;
    right: 18px;
    z-index: 6;
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border: 1px solid rgba(255, 255, 255, .34);
    border-radius: 11px;
    background: rgba(255, 255, 255, .18);
    color: #fff;
    cursor: pointer;
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    transition: background .2s ease, transform .3s ease;
    padding: 0;
}

.dpa-close:hover {
    background: rgba(255, 255, 255, .34);
    transform: rotate(90deg);
}

.dpa-close svg {
    width: 15px;
    height: 15px;
    stroke: currentColor;
    stroke-width: 2.4;
    stroke-linecap: round;
    fill: none;
}

/* ---------- 渐变头 ---------- */
.dpa-hero {
    position: relative;
    padding: 26px 26px 26px;
    color: #fff;
    background: linear-gradient(135deg, #4f7cff 0%, #6f8cff 40%, #8b5cf6 100%);
    overflow: hidden;
    flex: 0 0 auto;
}

.dpa-hero::before,
.dpa-hero::after {
    content: "";
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
}

.dpa-hero::before {
    width: 216px;
    height: 216px;
    top: -118px;
    right: -72px;
    background: rgba(255, 255, 255, .18);
}

.dpa-hero::after {
    width: 150px;
    height: 150px;
    left: -76px;
    bottom: -96px;
    background: rgba(255, 255, 255, .12);
}

.dpa-hero-inner {
    position: relative;
    z-index: 2;
}

.dpa-logo {
    display: grid;
    place-items: center;
    width: 50px;
    height: 50px;
    margin-bottom: 14px;
    border-radius: 16px;
    color: #fff;
    background: rgba(255, 255, 255, .22);
    border: 1px solid rgba(255, 255, 255, .4);
    box-shadow: 0 14px 26px -14px rgba(0, 0, 0, .65), inset 0 1px 0 rgba(255, 255, 255, .5);
}

.dpa-logo svg {
    width: 24px;
    height: 24px;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    fill: none;
}

.dpa-title {
    margin: 0 0 5px;
    font-size: 21px;
    font-weight: 800;
    letter-spacing: -.4px;
    color: #fff;
    line-height: 1.3;
}

.dpa-sub {
    margin: 0;
    font-size: 13.5px;
    line-height: 1.65;
    color: rgba(255, 255, 255, .84);
}

/* ---------- 表体 ---------- */
.dpa-body {
    padding: 20px 26px 22px;
    overflow-y: auto;
    overscroll-behavior: contain;
    flex: 1 1 auto;
    min-height: 0;
}

.dpa-tabs-wrap {
    overflow: hidden;
    max-height: 70px;
    opacity: 1;
    margin-bottom: 16px;
    transition: max-height .34s cubic-bezier(.22, 1, .36, 1), opacity .22s ease, margin .34s;
}

.dpa-panel.is-reset .dpa-tabs-wrap {
    max-height: 0;
    opacity: 0;
    margin-bottom: 0;
    pointer-events: none;
}

.dpa-tabs {
    position: relative;
    display: flex;
    padding: 5px;
    border-radius: 15px;
    background: #eef2fa;
}

.dpa-ind {
    position: absolute;
    top: 5px;
    left: 5px;
    width: calc(50% - 5px);
    height: calc(100% - 10px);
    border-radius: 11px;
    background: #fff;
    box-shadow: 0 8px 18px -12px rgba(24, 50, 120, .95);
    transition: transform .34s cubic-bezier(.22, 1, .36, 1);
}

.dpa-tabs[data-active="register"] .dpa-ind {
    transform: translateX(100%);
}

.dpa-tab {
    position: relative;
    z-index: 1;
    flex: 1;
    height: 38px;
    border: none;
    border-radius: 11px;
    background: transparent;
    font-family: inherit;
    font-size: 14.5px;
    font-weight: 600;
    color: #7a869e;
    cursor: pointer;
    transition: color .24s ease;
}

.dpa-tab.active {
    color: #1f4fff;
}

.dpa-form {
    display: none;
}

.dpa-form.active {
    display: block;
    animation: dpaIn .3s cubic-bezier(.22, 1, .36, 1) both;
}

@keyframes dpaIn {
    from {
        opacity: 0;
        transform: translateY(6px);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

.dpa-back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 30px;
    padding: 0 13px 0 9px;
    margin-bottom: 8px;
    border: 1px solid #e3e9f5;
    border-radius: 999px;
    background: #f7f9fd;
    font-family: inherit;
    font-size: 12.5px;
    font-weight: 600;
    color: #5a6580;
    cursor: pointer;
}

.dpa-back:hover {
    color: #1f4fff;
    border-color: rgba(31, 79, 255, .32);
    background: rgba(31, 79, 255, .06);
}

/* ---------- 输入框 ---------- */
.dpa-field {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    height: 52px;
    padding: 0 12px 0 14px;
    margin-top: 11px;
    border: 1.5px solid #e7edf8;
    border-radius: 15px;
    background: #f6f8fd;
    transition: border-color .22s ease, box-shadow .22s ease, background .22s ease;
}

.dpa-form > .dpa-field:first-of-type {
    margin-top: 0;
}

.dpa-field::before {
    content: "";
    position: absolute;
    left: 0;
    top: 50%;
    width: 3px;
    height: 0;
    border-radius: 0 3px 3px 0;
    background: linear-gradient(180deg, #4f7cff, #8b5cf6);
    transform: translateY(-50%);
    transition: height .28s cubic-bezier(.22, 1, .36, 1);
}

.dpa-field:focus-within {
    background: #fff;
    border-color: rgba(79, 124, 255, .55);
    box-shadow: 0 0 0 4px rgba(79, 124, 255, .12), 0 12px 24px -20px rgba(79, 124, 255, 1);
}

.dpa-field:focus-within::before {
    height: 22px;
}

.dpa-fi {
    display: grid;
    place-items: center;
    color: #9aa5bd;
    flex: 0 0 auto;
    transition: color .22s ease;
}

.dpa-field:focus-within .dpa-fi {
    color: #1f4fff;
}

.dpa-fi svg {
    width: 17px;
    height: 17px;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    fill: none;
}

/* 用 ID 前缀提高特异性：tidy-base.css 里有 input[type="text"] 之类带 !important 的
 * 全局输入框规则，且它在本文件之后注入，仅靠 .dpa-field input 会被压回去。 */
#dpaCover .dpa-field input {
    flex: 1;
    min-width: 0;
    height: 48px !important;
    padding: 0 !important;
    border: none !important;
    outline: none !important;
    background: transparent !important;
    font-family: inherit;
    font-size: 14.5px;
    color: #14213d !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    -webkit-appearance: none;
    appearance: none;
}

#dpaCover .dpa-field input::placeholder {
    color: #a3aec4;
}

#dpaCover .dpa-field input::-ms-reveal,
#dpaCover .dpa-field input::-ms-clear {
    display: none;
}

.dpa-field-btn {
    flex: 0 0 auto;
    height: 34px;
    padding: 0 12px;
    border: none;
    border-radius: 10px;
    font-family: inherit;
    font-size: 12.5px;
    font-weight: 600;
    color: #1f4fff;
    background: rgba(79, 124, 255, .12);
    cursor: pointer;
    white-space: nowrap;
    transition: background .2s ease;
}

.dpa-field-btn:hover:not(:disabled) {
    background: rgba(79, 124, 255, .22);
}

.dpa-field-btn:disabled {
    color: #9aa5bd;
    background: #eef2f7;
    cursor: not-allowed;
}

.dpa-eye {
    flex: 0 0 auto;
    width: 32px;
    height: 32px;
    display: grid;
    place-items: center;
    padding: 0;
    border: none;
    border-radius: 9px;
    background: transparent;
    color: #9aa5bd;
    cursor: pointer;
}

.dpa-eye:hover {
    color: #1f4fff;
    background: rgba(79, 124, 255, .08);
}

.dpa-eye svg {
    width: 17px;
    height: 17px;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    fill: none;
}

.dpa-eye .eye-open {
    display: none;
}

.dpa-eye.on .eye-open {
    display: block;
}

.dpa-eye.on .eye-off {
    display: none;
}

/* 可选字段（昵称 / 邀请码） */
.dpa-opt {
    margin-top: 9px;
    font-size: 12px;
    color: #8b95ad;
    text-align: right;
}

.dpa-opt button {
    padding: 0;
    border: none;
    background: none;
    font-family: inherit;
    font-size: 12px;
    color: #1f4fff;
    cursor: pointer;
    text-decoration: underline;
}

/* ---------- 主按钮 ---------- */
.dpa-submit {
    width: 100%;
    height: 50px;
    margin-top: 18px;
    border: none;
    border-radius: 15px;
    font-family: inherit;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: .5px;
    color: #fff;
    background: linear-gradient(135deg, #4f7cff, #1f4fff);
    box-shadow: 0 12px 26px -14px rgba(31, 79, 255, .9);
    cursor: pointer;
    transition: transform .18s ease, box-shadow .18s ease, filter .18s ease;
}

.dpa-submit:hover:not(:disabled) {
    filter: brightness(1.05);
    box-shadow: 0 16px 30px -14px rgba(31, 79, 255, 1);
    transform: translateY(-1px);
}

.dpa-submit:disabled {
    opacity: .62;
    cursor: not-allowed;
    box-shadow: none;
}

/* ---------- 底部链接 ---------- */
.dpa-links {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: 16px;
    font-size: 13px;
    color: #8b95ad;
}

.dpa-links button {
    padding: 0;
    border: none;
    background: none;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    color: #1f4fff;
    cursor: pointer;
}

.dpa-links button:hover {
    opacity: .75;
    text-decoration: underline;
}

/* ---------- 消息与确认 ---------- */
.dpa-msg {
    margin: 10px 0 0;
    font-size: 12.5px;
    line-height: 1.7;
    min-height: 0;
    color: #dc2626;
}

.dpa-msg:empty {
    display: none;
}

.dpa-msg.ok {
    color: #0b7a3b;
}

.dpa-confirm {
    margin-top: 12px;
    padding: 12px 14px;
    border: 1px solid rgba(251, 191, 36, .45);
    background: rgba(251, 191, 36, .08);
    border-radius: 12px;
}

.dpa-confirm.warn {
    border-color: rgba(248, 113, 113, .5);
    background: rgba(248, 113, 113, .07);
}

.dpa-confirm[hidden] {
    display: none;
}

.dpa-cf-title {
    margin: 0;
    font-size: 13px;
    font-weight: 800;
    color: #b45309;
}

.dpa-confirm.warn .dpa-cf-title {
    color: #dc2626;
}

.dpa-cf-mail {
    margin: 5px 0 0;
    font-size: 14.5px;
    font-weight: 800;
    color: #14213d;
    word-break: break-all;
    font-family: ui-monospace, Consolas, monospace;
}

.dpa-cf-note {
    margin: 5px 0 0;
    font-size: 12px;
    line-height: 1.7;
    color: #5b6478;
}

.dpa-cf-btns {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.dpa-cf-btns button {
    border-radius: 8px;
    padding: 8px 12px;
    font-family: inherit;
    font-size: 12.5px;
    font-weight: 700;
    cursor: pointer;
    border: 1px solid #d7dded;
    background: #fff;
    color: #5b6478;
}

.dpa-cf-btns .ok {
    border: none;
    background: #1f4fff;
    color: #fff;
}

.dpa-cf-btns .ok:hover {
    filter: brightness(1.08);
}

.dpa-tip {
    margin: 12px 0 0;
    padding: 10px 13px;
    font-size: 12px;
    line-height: 1.7;
    color: #92650b;
    background: rgba(245, 158, 11, .08);
    border: 1px solid rgba(245, 158, 11, .18);
    border-radius: 12px;
}

@media (max-width: 575.98px) {
    .dpa-cover {
        padding: 12px;
        align-items: flex-start;
    }

    .dpa-panel {
        max-height: calc(100dvh - 24px);
        border-radius: 22px;
    }

    .dpa-hero {
        padding: 22px 20px 20px;
    }

    .dpa-logo {
        width: 44px;
        height: 44px;
        border-radius: 14px;
        margin-bottom: 12px;
    }

    .dpa-logo svg {
        width: 21px;
        height: 21px;
    }

    .dpa-title {
        font-size: 19px;
    }

    .dpa-body {
        padding: 16px 20px 18px;
    }

    .dpa-field {
        height: 52px;
    }

    /* iOS 聚焦不放大：手机端输入框保持 16px */
    #dpaCover .dpa-field input {
        font-size: 16px;
    }

    .dpa-submit {
        height: 48px;
        margin-top: 16px;
    }
}

/* 注：弹窗的入场动画是 400ms 的一次性过渡，system「减弱动态」下也保留，
 * 否则用户会觉得「点了没反应直接出现」。仅把位移幅度收敛，避免大幅晃动。 */
@media (prefers-reduced-motion: reduce) {
    .dpa-panel {
        transform: none;
        transition: opacity .2s ease;
    }
}
