/* 注册 / 激活 / 重发激活 —— 白纸灰带 · 编辑风
   值与 login.css / policy.css / tag.css / search.css 保持一致；
   品牌绿、焦点环等语义与 dialog.css / upload_entry.css 同源。 */

:root {
    --auth-bg: #eeeeee;
    --auth-card-bg: #ffffff;
    --auth-soft: #f7f8f7;
    --auth-ink: #1f1f1f;
    --auth-text: #333333;
    --auth-muted: #666666;
    --auth-faint: #8a8f8c;
    --auth-border: #e0e0e0;
    --auth-accent: #98e0ac;
    --auth-on-accent: #173a22;
    --auth-accent-hover: #44c67d;
    --auth-focus-ring: 0 0 0 3px rgba(152, 224, 172, 0.45);
    --auth-danger: #8a2630;
    --auth-danger-bg: rgba(255, 226, 229, 0.92);
    --auth-danger-line: rgba(138, 38, 48, 0.14);
    --auth-warning: #8a5a00;
    --auth-warning-bg: #fff4e0;
    --auth-success: #195f2d;
    --auth-success-bg: rgba(152, 224, 172, 0.2);
    --auth-card-shadow: 0 1px 2px rgba(20, 40, 30, 0.04),
        0 24px 48px -36px rgba(20, 40, 30, 0.22);
    --auth-dur: 0.2s;
    --auth-ease: cubic-bezier(0.32, 0.72, 0, 1);
}

* {
    box-sizing: border-box;
}

html,
body {
    height: 100%;
    margin: 0;
    padding: 0;
    background-color: #1a1a1a;
    color: var(--auth-text);
    font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
    -webkit-font-smoothing: antialiased;
    color-scheme: light;
    overflow: hidden;
}

.wrapper {
    position: relative;
    max-width: 650px;
    height: 100vh;
    height: 100dvh;
    margin: 0 auto;
    background-color: var(--auth-bg);
    box-shadow: 0 0 12px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow: hidden;
    padding-top: env(safe-area-inset-top);
    padding-right: env(safe-area-inset-right);
    padding-bottom: env(safe-area-inset-bottom);
    padding-left: env(safe-area-inset-left);
}

.navbar {
    width: 100%;
    height: 50px;
    background-color: rgba(255, 255, 255, 0.95);
    border-bottom: 1px solid rgba(0, 0, 0, 0.04);
    display: flex;
    justify-content: center;
    align-items: center;
}

.navbar h1 {
    margin: 0;
    font-size: 1.5em;
    font-weight: 600;
    line-height: 1;
    color: var(--auth-ink);
    text-shadow: 0 0 6px rgba(0, 0, 0, 0.08);
}

.home-link {
    color: inherit;
    text-decoration: none;
}

@media (hover: hover) {
    .home-link:hover {
        color: #222;
    }
}

.center-container {
    flex: 1;
    min-height: 0;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    width: 100%;
    padding: clamp(16px, 4vw, 24px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
}

.register-box {
    width: min(100%, 420px);
    margin-block: auto;
    padding: clamp(24px, 5vw, 34px);
    border-radius: 16px;
    border: 1px solid var(--auth-border);
    background-color: var(--auth-card-bg);
    box-shadow: var(--auth-card-shadow);
    color: var(--auth-text);
    touch-action: pan-y;
}

.register-box h2 {
    margin: 0 0 6px;
    color: var(--auth-ink);
    font-size: 24px;
    font-weight: 600;
    line-height: 1.3;
    text-align: left;
}

.auth-subtitle {
    margin: 0 0 22px;
    color: var(--auth-muted);
    font-size: 13px;
    line-height: 1.6;
    text-align: left;
    overflow-wrap: anywhere;
}

/* 静态 label：注册页不再使用浮动标签。只命中字段标签，不碰头像 label / 预设 label。 */
.register-box .form-group > label,
.register-box .captcha-group > label,
.register-box form > label {
    display: block;
    margin: 0 0 6px;
    color: var(--auth-text);
    font-size: 13px;
    font-weight: 600;
    line-height: 1.4;
}

.register-box form > label:first-of-type {
    margin-top: 0;
}

.form-group {
    margin-top: 16px;
}

.register-box input[type="text"],
.register-box input[type="email"],
.register-box input[type="password"] {
    width: 100%;
    min-height: 48px;
    margin-top: 0;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid var(--auth-border);
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    background-color: var(--auth-card-bg);
    color: var(--auth-text);
    font-family: inherit;
    font-size: 16px;
    line-height: 1.4;
    transition: border-color var(--auth-dur) var(--auth-ease),
        box-shadow var(--auth-dur) var(--auth-ease),
        background-color var(--auth-dur) var(--auth-ease);
}

.register-box input[type="text"]::placeholder,
.register-box input[type="email"]::placeholder,
.register-box input[type="password"]::placeholder {
    color: var(--auth-faint);
}

.register-box input[type="text"]:focus,
.register-box input[type="email"]:focus,
.register-box input[type="password"]:focus {
    border-color: var(--auth-accent);
    background-color: var(--auth-card-bg);
    box-shadow: var(--auth-focus-ring);
}

.register-box input[aria-invalid="true"] {
    border-color: rgba(138, 38, 48, 0.6);
}

.register-box input[aria-invalid="true"]:focus {
    box-shadow: 0 0 0 3px rgba(227, 62, 62, 0.18);
}

.register-box input:-webkit-autofill {
    -webkit-box-shadow: 0 0 0 1000px var(--auth-card-bg) inset;
    -webkit-text-fill-color: var(--auth-text);
}

.help-text,
.helptext {
    display: block;
    margin: 6px 0 0;
    color: var(--auth-muted);
    font-size: 12.5px;
    line-height: 1.55;
    overflow-wrap: anywhere;
}

.error {
    margin-top: 8px;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid var(--auth-danger-line);
    background-color: var(--auth-danger-bg);
    color: var(--auth-danger);
    font-size: 13px;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

.error ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.register-box .errorlist {
    list-style: none;
    margin: 8px 0 0;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid var(--auth-danger-line);
    background-color: var(--auth-danger-bg);
    color: var(--auth-danger);
    font-size: 13px;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

.register-box .errorlist li {
    margin: 0;
}

/* 服务端模板是 .error 里再包一个 ul.errorlist；内层必须复位，避免粉框套粉框。 */
.error .errorlist {
    list-style: none;
    margin: 0;
    padding: 0;
    border: 0;
    background: none;
    color: inherit;
    font-size: inherit;
    line-height: inherit;
}

/* ---- top error summary（无 JS 与服务端重渲染共用） ---- */
.form-error-summary {
    margin: 0 0 18px;
    padding: 12px 14px;
    border-radius: 10px;
    border: 1px solid var(--auth-danger-line);
    border-left: 3px solid var(--auth-danger);
    background-color: var(--auth-danger-bg);
    color: var(--auth-danger);
    font-size: 13px;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

/* 必须显式写：只写 .form-error-summary{display:block} 会以同特异性覆盖 [hidden]。 */
.form-error-summary[hidden] {
    display: none;
}

.form-error-summary:focus {
    outline: none;
}

.form-error-summary:focus-visible {
    outline: 2px solid rgba(138, 38, 48, 0.55);
    outline-offset: 2px;
}

.form-error-summary__title {
    margin: 0 0 6px;
    font-weight: 600;
}

.form-error-summary__list {
    margin: 0;
    padding-left: 18px;
}

.form-error-summary__list li {
    margin: 2px 0;
}

.form-error-summary__list a {
    color: inherit;
    text-underline-offset: 3px;
}

@media (hover: hover) {
    .form-error-summary__list a:hover {
        color: #5f131a;
    }
}

/* ---- avatar ---- */
.avatar-upload-center {
    width: 100%;
    margin: 0 0 2px;
}

/* avatar_picker.css 在 max-height:480 + min-width:361（横屏/键盘态）会把
   .avatar-picker 改成横排、把 .avatar-picker__main 压到 45% 宽。注册页的
   新形态必须保持「头像行 + 预设单行」纵向堆叠，因此在这里整组复位。 */
.register-box .avatar-picker {
    flex-direction: column;
    align-items: stretch;
    gap: 0;
}

/* 头像区整块居中：头像 + 上传按钮作为一组居中；审核提示另起整行居中。 */
.register-box .avatar-picker__main {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 4px 12px;
    flex: 0 0 auto;
    width: 100%;
    max-width: none;
}

.register-box .avatar-picker__main .avatar-clickable {
    flex: 0 0 auto;
}

.register-box .avatar-picker__main .avatar-upload-cta {
    flex: 0 0 auto;
    margin-top: 0;
}

.register-box .avatar-picker__main .avatar-picker__hint {
    flex: 0 0 100%;
    width: 100%;
    margin: 4px 0 0;
    color: var(--auth-muted);
    font-size: 12px;
    line-height: 1.5;
    text-align: center;
    overflow-wrap: anywhere;
}

.register-box .avatar-picker__main > .error {
    flex: 0 0 100%;
    width: 100%;
}

.avatar-clickable {
    position: relative;
    display: inline-block;
    cursor: pointer;
}

.avatar-preview {
    width: 72px;
    aspect-ratio: 1 / 1;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid rgba(152, 224, 172, 0.3);
    background-color: #f0f0f0;
    display: block;
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

@media (hover: hover) {
    .avatar-preview:hover {
        box-shadow: 0 0 0 5px rgba(152, 224, 172, 0.28);
        border-color: rgba(152, 224, 172, 0.55);
    }
}

.avatar-input.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    border: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    opacity: 0;
}

.avatar-camera-badge {
    position: absolute;
    right: 0;
    bottom: 0;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background-color: var(--auth-accent);
    color: var(--auth-on-accent);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--auth-card-bg);
    pointer-events: none;
}

.avatar-camera-badge svg {
    width: 13px;
    height: 13px;
    display: block;
}

/* ---- avatar upload CTA：特异性压过 .register-box button 的全宽主按钮规则 ---- */
.register-box .avatar-picker__main .avatar-upload-cta {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    width: auto;
    max-width: 100%;
    min-height: 40px;
    margin-top: 0;
    padding: 7px 12px;
    border: 1px solid rgba(68, 198, 125, 0.45);
    border-radius: 999px;
    background-color: #f2fbf5;
    color: #24583e;
    font-size: 12.5px;
    font-weight: 600;
    line-height: 1.3;
    cursor: pointer;
    box-shadow: none;
    white-space: normal;
    transition: background-color 0.18s ease, border-color 0.18s ease,
        transform 0.12s ease;
}

/* 视觉 40px，命中区补到 44px（左右不扩，避免碰到头像）。 */
.register-box .avatar-picker__main .avatar-upload-cta::before {
    content: "";
    position: absolute;
    inset: -2px 0;
}

.register-box .avatar-picker__main .avatar-upload-cta svg {
    width: 15px;
    height: 15px;
    flex: 0 0 auto;
}

@media (hover: hover) {
    .register-box .avatar-picker__main .avatar-upload-cta:hover {
        background-color: #e8f8ee;
        border-color: rgba(68, 198, 125, 0.7);
        transform: none;
        box-shadow: none;
    }
}

.register-box .avatar-picker__main .avatar-upload-cta:active {
    transform: scale(0.98);
    box-shadow: none;
}

.register-box .avatar-picker__main .avatar-upload-cta:focus-visible {
    outline: none;
    box-shadow: var(--auth-focus-ring);
}

/* ---- 预设头像：注册页单行；共享 avatar_picker.css 的 4 列/48px 不动 ---- */
.register-box .avatar-picker__fieldset {
    flex: 0 0 auto;
    width: 100%;
    max-width: none;
    margin: 8px 0 0;
    padding: 0;
    border: 0;
}

.register-box .avatar-picker__legend {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    border: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

.register-box .avatar-picker__grid {
    display: flex;
    flex-wrap: nowrap;
    justify-content: center;
    gap: 6px;
    width: 100%;
}

.register-box .avatar-picker__option {
    position: relative;
    flex: 0 0 34px;
    width: 34px;
    max-width: 34px;
    height: 34px;
}

.register-box .avatar-picker__option::before {
    content: "";
    position: absolute;
    inset: -5px 0;
}

.register-box .avatar-picker__thumb {
    height: 100%;
}

/* ---- captcha：label 占整行，输入 / 图片同一行 ---- */
#field-captcha {
    margin-top: 16px;
}

.captcha-group {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    align-items: center;
}

.captcha-group > label {
    grid-column: 1 / -1;
    grid-row: 1;
    margin: 0;
}

.captcha-group input[type="text"] {
    grid-column: 1;
    grid-row: 2;
    width: 100%;
    padding: 12px 14px;
}

.captcha-group img.captcha {
    grid-column: 2;
    grid-row: 2;
    width: 108px;
    height: 44px;
    object-fit: contain;
    border: 1px solid var(--auth-border);
    border-radius: 8px;
    background-color: #fafafa;
    cursor: pointer;
}

.captcha-group img.captcha:focus-visible {
    outline: none;
    box-shadow: var(--auth-focus-ring);
}

@media (hover: hover) {
    .captcha-group img.captcha:hover {
        border-color: var(--auth-accent);
    }
}

.captcha-hint {
    display: block;
    margin: 6px 0 0;
    color: var(--auth-muted);
    font-size: 12px;
    line-height: 1.5;
}

/* ---- button ---- */
/* P60：`<button>` 不继承 font-family ⇒ 不声明就落 UA 的 Arial。
   本行与 dialog.css 的同名规则一致；这三页不加载 dialog.css，故各自补一行。
   只声明 family：字号/字重各有各的档，别在这里一并重置。 */
button {
    font-family: inherit;
}

.register-box button {
    width: 100%;
    min-height: 48px;
    margin-top: 24px;
    padding: 0 18px;
    border: none;
    border-radius: 999px;
    background-color: var(--auth-accent);
    color: var(--auth-on-accent);
    font-size: 15px;
    font-weight: 600;
    line-height: 1.3;
    cursor: pointer;
    transition: background-color var(--auth-dur) var(--auth-ease),
        transform var(--auth-dur) var(--auth-ease);
}

@media (hover: hover) {
    .register-box button:hover {
        background-color: var(--auth-accent-hover);
    }
}

.register-box button:active {
    transform: scale(0.99);
}

.register-box button:focus-visible {
    outline: none;
    box-shadow: var(--auth-focus-ring);
}

.register-box button.is-busy,
.register-box button:disabled {
    cursor: default;
    opacity: 0.6;
    transform: none;
}

/* ---- auth links ---- */
.auth-links-bar {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-top: 18px;
    color: var(--auth-muted);
    font-size: 13px;
}

.auth-link-action {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    color: #2f6b4f;
    text-decoration: none;
    transition: color 0.18s ease;
}

.auth-links-divider {
    color: #c9d2cc;
}

@media (hover: hover) {
    .auth-link-action:hover {
        color: #1f4f38;
    }
}

.auth-link-action:focus-visible {
    outline: none;
    box-shadow: var(--auth-focus-ring);
    border-radius: 6px;
}

/* ---- activation / status pages ---- */
.auth-status-icon {
    width: 48px;
    height: 48px;
    margin: 0 0 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--auth-success-bg);
    color: var(--auth-success);
}

.auth-status-icon--warning {
    background-color: var(--auth-warning-bg);
    color: var(--auth-warning);
}

.auth-status-icon svg {
    width: 24px;
    height: 24px;
    display: block;
}

.activation-box {
    width: min(100%, 420px);
}

.activation-header {
    text-align: left;
}

.activation-lead {
    margin: 0 0 10px;
    color: var(--auth-text);
    font-size: 14px;
    line-height: 1.65;
    overflow-wrap: anywhere;
}

.activation-why {
    margin: 0 0 20px;
    color: var(--auth-muted);
    font-size: 12.5px;
    line-height: 1.65;
}

.activation-why strong {
    color: var(--auth-text);
}

.activation-warning {
    margin: 0 0 16px;
    padding: 12px 14px;
    border-radius: 12px;
    background-color: var(--auth-warning-bg);
    color: var(--auth-warning);
    font-size: 13px;
    line-height: 1.6;
}

.activation-warning p {
    margin: 0;
}

.activation-email-card {
    margin: 0 0 16px;
    padding: 14px 16px;
    border: 1px solid var(--auth-border);
    border-radius: 12px;
    background-color: var(--auth-soft);
}

.activation-email-label {
    color: var(--auth-muted);
    font-size: 12px;
    line-height: 1.4;
}

.activation-email-value {
    margin-top: 3px;
    color: var(--auth-ink);
    font-size: 15px;
    font-weight: 600;
    line-height: 1.45;
    overflow-wrap: anywhere;
}

.activation-copy {
    margin: 0 0 4px;
}

.activation-copy p,
.activation-muted {
    margin: 0 0 6px;
    color: var(--auth-muted);
    font-size: 12.5px;
    line-height: 1.6;
    overflow-wrap: anywhere;
}

.activation-copy a,
.activation-muted a {
    color: #2f6b4f;
}

.activation-resend {
    margin-top: 16px;
}

.activation-resend-form button {
    margin-top: 0;
}

/* ---- responsive ---- */
@media only screen and (max-width: 640px) {
    .navbar {
        height: 44px;
    }

    .navbar h1 {
        font-size: 1.3em;
    }

    .center-container {
        padding: 12px;
    }

    .register-box {
        padding: 26px 22px 24px;
        border-radius: 14px;
    }

    .register-box input[type="text"],
    .register-box input[type="email"],
    .register-box input[type="password"] {
        font-size: 16px;
    }

    .auth-links-bar {
        gap: 8px;
        font-size: 12.5px;
    }
}

@media only screen and (max-width: 420px) {
    .center-container {
        padding: 10px;
    }

    .register-box {
        padding: 24px 18px 22px;
    }
}

@media only screen and (max-width: 360px) {
    .center-container {
        padding: 10px 8px 16px;
    }

    .register-box {
        padding: 18px 14px;
        border-radius: 12px;
    }

    .register-box h2 {
        font-size: 21px;
    }

    .register-box .avatar-picker__main {
        gap: 4px 10px;
    }

    .avatar-preview {
        width: 64px;
    }

    .avatar-camera-badge {
        width: 24px;
        height: 24px;
    }

    .register-box .avatar-picker__grid {
        gap: 4px;
    }

    .register-box .avatar-picker__option {
        flex: 0 0 32px;
        width: 32px;
        max-width: 32px;
        height: 32px;
    }
}

@media only screen and (max-height: 480px) {
    .center-container {
        padding-top: 10px;
        padding-bottom: 16px;
    }

    .register-box {
        padding: 20px 18px 18px;
    }

    .register-box h2 {
        font-size: 21px;
    }

    .form-group {
        margin-top: 12px;
    }

    #field-captcha {
        margin-top: 12px;
    }

    .register-box button {
        margin-top: 18px;
    }

    .auth-status-icon {
        width: 40px;
        height: 40px;
        margin-bottom: 12px;
    }
}

@media (prefers-reduced-motion: reduce) {
    * {
        transition: none !important;
        animation: none !important;
    }

    .register-box button:active,
    .register-box .avatar-picker__main .avatar-upload-cta:active {
        transform: none;
    }
}

@media (forced-colors: active) {
    .register-box input:focus,
    .register-box button:focus-visible,
    .register-box .avatar-picker__main .avatar-upload-cta:focus-visible,
    .captcha-group img.captcha:focus-visible,
    .auth-link-action:focus-visible {
        outline: 2px solid CanvasText;
        box-shadow: none;
    }
}
