:root {
    color-scheme: light;
    --ink: #1d2930;
    --muted: #738087;
    --line: #d9d4c9;
    --paper: #fffdf8;
    --paper-deep: #f5efe4;
    --vermillion: #b5523f;
    --vermillion-dark: #913a2d;
    --gold: #b2854b;
    --green: #355d57;
}

* {
    box-sizing: border-box;
}

html,
body {
    min-height: 100%;
}

html {
    background-color: #08161a;
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--ink);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    background: transparent;
}

/* 梦幻西游风国风山水背景（固定层，避免 iOS 对 background-attachment:fixed 的兼容问题） */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -2;
    background-color: #08161a;
    background-image: url("../img/bg-reg-desktop.jpg");
    background-position: center center;
    background-size: cover;
    background-repeat: no-repeat;
}

/* 上下压暗 + 中央柔光，让卡片更聚焦 */
body::after {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background:
        radial-gradient(ellipse 60% 46% at 50% 46%, rgba(255,247,226,.12), transparent 72%),
        linear-gradient(180deg,
            rgba(3,12,16,.55) 0%,
            rgba(3,12,16,.12) 26%,
            rgba(4,16,18,.06) 54%,
            rgba(3,12,14,.34) 82%,
            rgba(2,9,11,.60) 100%);
}

/* 手机竖屏换竖版构图 */
@media (max-width: 640px) {
    body::before {
        background-image: url("../img/bg-reg-mobile.jpg");
        background-position: center 22%;
    }
}

@media (orientation: portrait) and (max-width: 900px) {
    body::before {
        background-image: url("../img/bg-reg-mobile.jpg");
        background-position: center 22%;
    }
}

button,
input {
    font: inherit;
}

button {
    cursor: pointer;
}

.register-shell {
    display: grid;
    place-items: center;
    width: min(430px, calc(100% - 28px));
    min-height: 100vh;
    margin: 0 auto;
    padding: 28px 0;
}

.register-panel {
    width: 100%;
    padding: 34px 38px 28px;
    border: 1px solid rgba(255, 245, 219, .55);
    border-radius: 8px;
    background: linear-gradient(180deg, rgba(255, 253, 248, .95) 0%, rgba(247, 242, 231, .93) 100%);
    -webkit-backdrop-filter: blur(10px) saturate(1.06);
    backdrop-filter: blur(10px) saturate(1.06);
    box-shadow:
        0 26px 60px rgba(3, 14, 16, .42),
        0 0 0 1px rgba(255, 232, 190, .16),
        inset 0 1px 0 rgba(255, 255, 255, .6);
}

.panel-heading {
    margin-bottom: 24px;
    text-align: center;
}

.panel-heading h2 {
    margin: 0 0 8px;
    color: var(--ink);
    font-size: 27px;
    font-weight: 600;
    letter-spacing: .04em;
}

.panel-heading p {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
}

.field {
    position: relative;
    display: flex;
    align-items: center;
    height: 48px;
    margin-top: 12px;
    border-bottom: 1px solid var(--line);
    transition: border-color .2s ease;
}

.field:focus-within {
    border-color: var(--vermillion);
}

.field-icon {
    width: 28px;
    color: var(--gold);
    font-size: 17px;
}

.field input {
    width: 100%;
    height: 100%;
    padding: 0 4px;
    border: 0;
    outline: 0;
    color: var(--ink);
    background: transparent;
    font-size: 14px;
}

.field input::placeholder {
    color: #9b9b93;
}

/* 注册码锁定态：推广链接带入时只读，带一枚「不可修改」小标 */
.field.is-locked {
    border-bottom-color: rgba(168, 50, 38, .18);
    background: linear-gradient(180deg, rgba(255, 253, 248, .92), rgba(247, 242, 231, .72));
    border-radius: 6px;
    padding: 0 10px 0 8px;
}

.field.is-locked:focus-within {
    border-color: rgba(168, 50, 38, .38);
}

.field input.is-locked {
    flex: 1 1 auto;
    min-width: 0;
    cursor: default;
    font-weight: 600;
    letter-spacing: .6px;
    color: var(--ink);
    -webkit-text-fill-color: var(--ink);
}

.field-lock {
    flex: 0 0 auto;
    margin-left: 8px;
    padding: 2px 8px;
    border-radius: 999px;
    border: 1px solid rgba(201, 169, 97, .45);
    background: rgba(201, 169, 97, .14);
    color: #8a6d33;
    font-size: 11px;
    line-height: 17px;
    white-space: nowrap;
}

.captcha-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 116px;
    align-items: end;
    gap: 12px;
}

.captcha-input {
    margin-top: 12px;
}

.captcha-button {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 48px;
    margin-top: 12px;
    padding: 0;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 4px;
    background: var(--paper-deep);
}

.captcha-button:hover {
    border-color: var(--gold);
}

.captcha-button img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.form-hint {
    margin: 14px 0 0;
    color: #8b8a80;
    font-size: 11px;
    line-height: 18px;
}

.form-status {
    min-height: 20px;
    margin: 10px 0 0;
    color: var(--muted);
    font-size: 12px;
    line-height: 20px;
}

.form-status.error {
    color: var(--vermillion-dark);
}

.form-status.success {
    color: var(--green);
}

.form-status.loading {
    color: var(--gold);
}

.submit-button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 48px;
    margin-top: 9px;
    border: 0;
    border-radius: 4px;
    color: #fffaf0;
    background: var(--vermillion);
    box-shadow: 0 8px 18px rgba(181, 82, 63, .18);
    font-size: 14px;
    letter-spacing: .12em;
    transition: background .2s ease, transform .2s ease;
}

.submit-button:hover {
    background: var(--vermillion-dark);
    transform: translateY(-1px);
}

.submit-button:disabled {
    cursor: wait;
    opacity: .65;
    transform: none;
}

.panel-footer {
    margin: 22px 0 0;
    color: #a09d94;
    font-size: 11px;
    text-align: center;
}

.success-panel {
    padding-top: 48px;
    padding-bottom: 48px;
    text-align: center;
}

.success-icon {
    display: grid;
    place-items: center;
    width: 54px;
    height: 54px;
    margin: 0 auto 20px;
    border-radius: 50%;
    color: #fff;
    background: var(--green);
    font-size: 26px;
}

.success-panel h1 {
    margin: 0 0 12px;
    color: var(--ink);
    font-size: 26px;
    font-weight: 600;
}

.success-panel p {
    margin: 0;
    color: var(--muted);
    font-size: 14px;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

@media (max-width: 480px) {
    .register-shell {
        width: min(430px, calc(100% - 20px));
        padding: 16px 0;
    }

    .register-panel {
        padding: 28px 22px 24px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        transition-duration: .01ms !important;
    }
}
