:root {
    color-scheme: dark;
    --page: #0d0e0c;
    --surface: #171815;
    --surface-raised: #20211d;
    --field: #11120f;
    --field-hover: #151713;
    --line: #4f4b3d;
    --line-soft: #32332d;
    --gold: #c9a75d;
    --gold-bright: #f0d58f;
    --gold-deep: #7d5a23;
    --text: #f1eee5;
    --muted: #aca99f;
    --danger: #d65b50;
    --success: #43ad7e;
    --focus: #67b7ac;
    --shadow: rgba(0, 0, 0, 0.48);
    font-family: "Microsoft YaHei UI", "Microsoft YaHei", sans-serif;
    font-synthesis: none;
}

* {
    box-sizing: border-box;
    letter-spacing: 0;
}

html {
    min-width: 320px;
    background: var(--page);
}

body {
    min-height: 100vh;
    margin: 0;
    color: var(--text);
    background-color: var(--page);
    background-image:
        repeating-linear-gradient(
            0deg,
            rgba(255, 255, 255, 0.018) 0,
            rgba(255, 255, 255, 0.018) 1px,
            transparent 1px,
            transparent 4px
        ),
        linear-gradient(135deg, #0b0c0a 0%, #171511 52%, #0d1110 100%);
}

button,
input {
    font: inherit;
}

button {
    letter-spacing: 0;
}

.site-header {
    width: 100%;
    min-height: 72px;
    border-top: 1px solid #f2d890;
    border-bottom: 1px solid var(--gold-deep);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.06), transparent 34%),
        #171612;
    box-shadow:
        inset 0 -1px 0 rgba(0, 0, 0, 0.8),
        0 6px 20px rgba(0, 0, 0, 0.4);
}

.header-inner {
    width: min(1060px, calc(100% - 32px));
    min-height: 70px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.brand-logo {
    display: block;
    width: min(316px, 62vw);
    height: auto;
    object-fit: contain;
}

.service-state {
    min-height: 34px;
    display: inline-flex;
    align-items: center;
    gap: 9px;
    padding: 7px 12px;
    border: 1px solid var(--line);
    border-radius: 4px;
    color: #d8d5ca;
    background: #10110f;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
    font-size: 13px;
    white-space: nowrap;
}

.state-light {
    width: 8px;
    height: 8px;
    flex: 0 0 8px;
    border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 8px rgba(67, 173, 126, 0.7);
}

.page-main {
    width: min(1060px, calc(100% - 32px));
    margin: 34px auto 26px;
}

.registration-panel {
    overflow: hidden;
    border: 1px solid var(--gold-deep);
    border-radius: 6px;
    background: var(--surface);
    box-shadow:
        0 22px 56px var(--shadow),
        inset 0 0 0 1px rgba(241, 210, 132, 0.06);
}

.panel-heading {
    min-height: 126px;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 32px;
    padding: 26px 34px 24px;
    border-bottom: 1px solid var(--line);
    background:
        linear-gradient(90deg, rgba(201, 167, 93, 0.11), transparent 45%),
        linear-gradient(180deg, #24231e, #191a17);
}

.eyebrow {
    margin: 0 0 7px;
    color: var(--gold);
    font-family: Georgia, "Times New Roman", serif;
    font-size: 12px;
    font-weight: 700;
}

h1 {
    margin: 0;
    color: var(--text);
    font-family: "Microsoft YaHei UI", "Microsoft YaHei", sans-serif;
    font-size: 28px;
    line-height: 1.28;
    font-weight: 700;
}

.heading-copy {
    margin: 9px 0 0;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.6;
}

.support {
    display: grid;
    justify-items: end;
    gap: 4px;
    padding-bottom: 2px;
    color: var(--muted);
    font-size: 12px;
}

.support strong {
    color: var(--gold-bright);
    font-family: Consolas, monospace;
    font-size: 16px;
    font-weight: 600;
}

#accountForm {
    padding: 10px 34px 32px;
}

.form-section {
    min-width: 0;
    margin: 0;
    padding: 29px 0 25px;
    border: 0;
    border-bottom: 1px solid var(--line-soft);
}

.form-section legend {
    display: block;
    width: 100%;
    margin: 0 0 20px;
    padding: 0;
    color: var(--gold-bright);
    font-size: 16px;
    font-weight: 700;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px 24px;
}

.field {
    min-width: 0;
}

.account-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.field label {
    display: inline-block;
    margin: 0 0 8px;
    color: #dedbd2;
    font-size: 14px;
    font-weight: 600;
}

.field label::after {
    content: " *";
    color: var(--danger);
}

.field label[for="birthday"]::after {
    content: "";
}

.optional {
    margin-left: 5px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 400;
}

.field input {
    width: 100%;
    height: 44px;
    padding: 0 13px;
    border: 1px solid var(--line);
    border-radius: 4px;
    outline: none;
    color: var(--text);
    caret-color: var(--gold-bright);
    background: var(--field);
    box-shadow:
        inset 0 1px 3px rgba(0, 0, 0, 0.55),
        0 1px 0 rgba(255, 255, 255, 0.025);
    transition:
        border-color 140ms ease,
        background-color 140ms ease,
        box-shadow 140ms ease;
}

.field input:hover {
    background: var(--field-hover);
}

.field input:focus {
    border-color: var(--focus);
    box-shadow:
        0 0 0 3px rgba(103, 183, 172, 0.14),
        inset 0 1px 3px rgba(0, 0, 0, 0.55);
}

.field input[aria-invalid="true"] {
    border-color: var(--danger);
    box-shadow:
        0 0 0 3px rgba(214, 91, 80, 0.12),
        inset 0 1px 3px rgba(0, 0, 0, 0.55);
}

.password-control {
    position: relative;
}

.password-control input {
    padding-right: 62px;
}

.password-toggle {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 50px;
    height: 34px;
    padding: 0;
    border: 1px solid #4a4b43;
    border-radius: 3px;
    color: #d7d3c8;
    background: #292a25;
    cursor: pointer;
}

.password-toggle:hover {
    border-color: var(--gold);
    color: var(--gold-bright);
}

.password-toggle:focus-visible {
    outline: 2px solid var(--focus);
    outline-offset: 2px;
}

.field-hint,
.password-meta {
    min-height: 18px;
    margin: 6px 0 0;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.5;
}

.password-meta {
    display: flex;
    justify-content: space-between;
    gap: 12px;
}

.strength-label {
    color: var(--muted);
    white-space: nowrap;
}

.strength-track {
    height: 3px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 3px;
    margin-top: 6px;
}

.strength-track span {
    background: #34352f;
    transition: background-color 140ms ease;
}

.strength-track[data-score="1"] span:nth-child(1) {
    background: var(--danger);
}

.strength-track[data-score="2"] span:nth-child(-n+2) {
    background: var(--gold);
}

.strength-track[data-score="3"] span {
    background: var(--success);
}

.field-error {
    min-height: 18px;
    margin: 5px 0 0;
    color: #f07a70;
    font-size: 12px;
    line-height: 1.5;
}

.consent-row {
    display: grid;
    grid-template-columns: 18px minmax(0, 1fr);
    align-items: start;
    gap: 10px;
    margin-top: 24px;
    color: #d3d0c7;
    font-size: 13px;
    line-height: 1.65;
}

.consent-row input {
    width: 16px;
    height: 16px;
    margin: 3px 0 0;
    accent-color: var(--gold);
}

.consent-row label {
    cursor: pointer;
}

.consent-error {
    margin-left: 28px;
}

.form-status {
    margin-top: 20px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 4px;
    color: var(--text);
    background: #121310;
    font-size: 14px;
    line-height: 1.6;
}

.form-status[data-type="error"] {
    border-color: rgba(214, 91, 80, 0.75);
    color: #ffd2cd;
    background: #281615;
}

.form-status[data-type="success"] {
    border-color: rgba(67, 173, 126, 0.72);
    color: #d3f3e4;
    background: #11241c;
}

.form-status[data-type="loading"] {
    border-color: rgba(201, 167, 93, 0.72);
    color: var(--gold-bright);
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 24px;
}

.button {
    min-width: 132px;
    min-height: 44px;
    padding: 10px 22px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 700;
    transition:
        border-color 140ms ease,
        background-color 140ms ease,
        box-shadow 140ms ease,
        transform 140ms ease;
}

.button:focus-visible {
    outline: 2px solid var(--focus);
    outline-offset: 3px;
}

.button:disabled {
    cursor: wait;
    opacity: 0.66;
}

.button-secondary {
    border: 1px solid #57584f;
    color: #ddd9cf;
    background: #282923;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.button-secondary:hover {
    border-color: #747568;
    background: #30312a;
}

.button-primary {
    position: relative;
    border: 1px solid #efd181;
    color: #17130b;
    background:
        linear-gradient(180deg, #ecd38d 0%, #c6a054 52%, #9b712f 100%);
    box-shadow:
        inset 0 1px 0 #fff0bd,
        inset 0 -2px 0 rgba(74, 42, 8, 0.35),
        0 5px 14px rgba(0, 0, 0, 0.3);
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.35);
}

.button-primary:hover:not(:disabled) {
    border-color: #fff0bd;
    transform: translateY(-1px);
    box-shadow:
        inset 0 1px 0 #fff4cc,
        inset 0 -2px 0 rgba(74, 42, 8, 0.35),
        0 7px 18px rgba(0, 0, 0, 0.38);
}

.button-loading {
    display: none;
    width: 15px;
    height: 15px;
    margin-left: 8px;
    border: 2px solid rgba(23, 19, 11, 0.3);
    border-top-color: #17130b;
    border-radius: 50%;
    vertical-align: -3px;
    animation: spin 700ms linear infinite;
}

.button-primary[data-loading="true"] .button-loading {
    display: inline-block;
}

.site-footer {
    width: min(1060px, calc(100% - 32px));
    min-height: 54px;
    margin: 0 auto;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
    color: #777970;
    font-size: 12px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@media (max-width: 720px) {
    .header-inner {
        width: min(100% - 24px, 1060px);
        min-height: 64px;
        gap: 10px;
    }

    .brand-logo {
        width: min(246px, 64vw);
    }

    .service-state {
        padding: 7px 9px;
        font-size: 0;
    }

    .service-state .state-light {
        margin: 0;
    }

    .page-main {
        width: calc(100% - 20px);
        margin-top: 18px;
    }

    .panel-heading {
        min-height: 0;
        align-items: flex-start;
        padding: 22px 20px 20px;
    }

    h1 {
        font-size: 23px;
    }

    .support {
        display: none;
    }

    #accountForm {
        padding: 6px 20px 24px;
    }

    .form-section {
        padding: 24px 0 20px;
    }

    .form-grid {
        grid-template-columns: minmax(0, 1fr);
        gap: 14px;
    }

    .account-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .form-actions {
        display: grid;
        grid-template-columns: 1fr 1.45fr;
    }

    .button {
        min-width: 0;
        width: 100%;
    }

    .site-footer {
        width: calc(100% - 24px);
        min-height: 64px;
        display: grid;
        grid-template-columns: 1fr;
        gap: 4px;
        padding-bottom: 20px;
    }
}

@media (max-width: 390px) {
    .header-inner {
        width: calc(100% - 16px);
    }

    .brand-logo {
        width: min(230px, 70vw);
    }

    .page-main {
        width: calc(100% - 12px);
        margin-top: 10px;
    }

    .panel-heading,
    #accountForm {
        padding-left: 16px;
        padding-right: 16px;
    }

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

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition: none !important;
        animation-duration: 1ms !important;
        animation-iteration-count: 1 !important;
    }
}
