.portal-register-root {
    position: relative;
    width: 100%;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px 12px;
    box-sizing: border-box;
    background:
        radial-gradient(circle at top, rgba(248, 250, 252, 0.12) 0, rgba(154, 201, 255, 0.9) 40%, rgba(255, 255, 255, 0.98) 100%),
        linear-gradient(to bottom, #1f2937, #0e3afd);
}

.portal-register-root .portal-container {
    width: 100%;
    max-width: 420px;
    margin: 0 auto;
    display: flex;
    justify-content: center;
}

.portal-register-root .portal-card {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 420px;
}

/* 让注册页的输入框与行内按钮对齐（portal.css 默认为 95% 宽，会在 flex 布局里显得不整齐） */
.portal-register-root .portal-field input[type="text"],
.portal-register-root .portal-field input[type="password"] {
    width: 100%;
}

.portal-register-root .portal-form {
    margin-top: 18px;
}

.portal-register-root .cf-turnstile {
    width: 100%;
    display: flex;
    justify-content: center;
}

.portal-register-root .cf-turnstile > div {
    margin: 0 auto;
}

.portal-agreement {
    margin-top: 12px;
}

.portal-agreement__label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--portal-text-secondary, #64748b);
    user-select: none;
}

.portal-agreement__label input[type="checkbox"] {
    width: 14px;
    height: 14px;
    margin: 0;
}

.portal-agreement__link,
.portal-agreement__link:visited {
    color: var(--portal-primary, #6366f1);
    text-decoration: none;
}

.portal-agreement__link:hover {
    text-decoration: underline;
}

.portal-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
}

.portal-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
}

.portal-modal__dialog {
    position: relative;
    width: min(720px, calc(100% - 24px));
    max-height: calc(100vh - 32px);
    margin: 16px auto;
    background: rgba(255, 255, 255, 0.98);
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 18px 60px rgba(0, 0, 0, 0.28);
    display: flex;
    flex-direction: column;
}

.portal-modal__header {
    padding: 12px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(148, 163, 184, 0.35);
}

.portal-modal__title {
    font-size: 14px;
    font-weight: 700;
    color: rgba(15, 23, 42, 0.92);
}

.portal-modal__close {
    appearance: none;
    border: 0;
    background: transparent;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    color: rgba(15, 23, 42, 0.75);
}

.portal-modal__close:hover {
    color: rgba(15, 23, 42, 0.95);
}

.portal-modal__body {
    padding: 14px;
    overflow: auto;
}

.portal-modal__content {
    font-size: 13px;
    line-height: 1.7;
    color: rgba(15, 23, 42, 0.88);
}

.portal-field-inline {
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

.portal-field-inline__main {
    flex: 1;
}

.portal-field-inline__side {
    flex: 0 0 auto;
}

.portal-field-inline__side .portal-button {
    width: auto;
    white-space: nowrap;
    padding-left: 14px;
    padding-right: 14px;
}

.portal-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 16px;
}

/* portal.css 的 .portal-button 默认 width:100%，在 grid 中会自然等宽；此处确保按钮在容器内不被压成竖排 */
.portal-actions .portal-button {
    min-width: 0;
}

.portal-success {
    margin-top: 12px;
    padding: 10px 12px;
    border-radius: 10px;
    background: rgba(34, 197, 94, 0.12);
    color: rgba(15, 23, 42, 0.92);
}

/* 底部链接/备案：对齐 portal 登录页的文字样式（避免浏览器默认 visited 紫色） */
.portal-register-root .portal-footer-links {
    margin-top: 16px;
    text-align: center;
}

.portal-register-root .portal-footer-link {
    font-size: 13px;
    color: var(--portal-text-secondary, #64748b);
    text-decoration: none;
}

.portal-register-root .portal-footer-link:visited {
    color: var(--portal-text-secondary, #64748b);
}

.portal-register-root .portal-footer-link:hover {
    color: var(--portal-primary, #6366f1);
    text-decoration: underline;
}

.portal-register-root .portal-icp {
    margin-top: 8px;
    font-size: 12px;
    text-align: center;
    color: var(--portal-text-secondary, #64748b);
}

.portal-register-root .portal-icp a,
.portal-register-root .portal-icp a:visited {
    color: inherit;
    text-decoration: none;
}

.portal-register-root .portal-icp a:hover {
    text-decoration: underline;
}

@media (max-width: 640px) {
    .portal-register-root {
        align-items: flex-start;
        justify-content: flex-start;
        padding: 24px 12px 32px;
        overflow-y: auto;
    }

    .portal-register-root .portal-container {
        max-width: 100%;
    }

    .portal-register-root .portal-card {
        max-width: 420px;
        margin: 24px auto 16px;
        border-radius: 16px;
    }

    .portal-field-inline {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .portal-field-inline__side {
        width: 100%;
    }

    .portal-field-inline__side .portal-button {
        width: 100%;
    }

    .portal-actions {
        grid-template-columns: 1fr;
    }
}
