:root {
    --ink: #18231f;
    --ink-soft: #5f6964;
    --paper: #f8f3e9;
    --paper-deep: #eee4d3;
    --paper-light: #fffdf8;
    --jade: #1f6655;
    --jade-deep: #123f35;
    --jade-dark: #0c3028;
    --vermilion: #e25a38;
    --vermilion-dark: #bd3f24;
    --line: rgba(24, 35, 31, 0.14);
    --line-light: rgba(255, 253, 248, 0.2);
    --danger: #b83c2c;
    --success: #216b50;
    --serif: "Songti SC", "STSong", "Noto Serif CJK SC", "Source Han Serif SC", serif;
    --sans: "PingFang SC", "Hiragino Sans GB", "Noto Sans CJK SC", "Microsoft YaHei", sans-serif;
    color-scheme: light;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    min-width: 320px;
    background: var(--paper);
    font-size: 16px;
}

body {
    min-height: 100vh;
    margin: 0;
    color: var(--ink);
    background:
        radial-gradient(circle at 12% 8%, rgba(226, 90, 56, 0.09), transparent 24rem),
        radial-gradient(circle at 92% 88%, rgba(31, 102, 85, 0.12), transparent 30rem),
        var(--paper);
    font-family: var(--sans);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

body::before {
    position: fixed;
    inset: 0;
    z-index: -1;
    opacity: 0.28;
    background-image:
        linear-gradient(rgba(24, 35, 31, 0.025) 1px, transparent 1px),
        linear-gradient(90deg, rgba(24, 35, 31, 0.018) 1px, transparent 1px);
    background-size: 28px 28px;
    content: "";
    pointer-events: none;
}

a {
    color: inherit;
}

button,
input {
    font: inherit;
}

button,
a {
    -webkit-tap-highlight-color: transparent;
}

svg {
    display: block;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.7;
}

.skip-link {
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 100;
    padding: 10px 16px;
    border-radius: 6px;
    color: #fff;
    background: var(--ink);
    font-size: 13px;
    text-decoration: none;
    transform: translateY(-150%);
    transition: transform 160ms ease;
}

.skip-link:focus {
    transform: translateY(0);
}

.auth-shell {
    display: flex;
    width: min(1180px, calc(100% - 48px));
    min-height: 100vh;
    margin: 0 auto;
    flex-direction: column;
}

.auth-header {
    display: flex;
    min-height: 104px;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 13px;
    text-decoration: none;
}

.brand-mark {
    width: 48px;
    height: 48px;
    border-radius: 13px;
    box-shadow: 0 8px 22px rgba(18, 63, 53, 0.2);
}

.brand-copy {
    display: grid;
    gap: 2px;
}

.brand-copy strong {
    font-family: var(--serif);
    font-size: 21px;
    font-weight: 700;
    letter-spacing: 0.08em;
}

.brand-copy small {
    color: var(--ink-soft);
    font-size: 11px;
    letter-spacing: 0.18em;
}

.back-home {
    display: inline-flex;
    min-height: 42px;
    padding: 0 14px;
    align-items: center;
    gap: 7px;
    border: 1px solid transparent;
    border-radius: 8px;
    color: var(--ink-soft);
    font-size: 14px;
    text-decoration: none;
    transition: color 160ms ease, border-color 160ms ease, background 160ms ease;
}

.back-home svg {
    width: 18px;
    height: 18px;
}

.back-home:hover,
.back-home:focus-visible {
    border-color: var(--line);
    color: var(--jade-deep);
    background: rgba(255, 253, 248, 0.7);
    outline: none;
}

.auth-card {
    display: grid;
    overflow: hidden;
    min-height: 650px;
    border: 1px solid rgba(18, 63, 53, 0.12);
    border-radius: 3px 24px 3px 24px;
    background: var(--paper-light);
    box-shadow:
        0 30px 80px rgba(38, 50, 44, 0.13),
        0 4px 12px rgba(38, 50, 44, 0.07);
    grid-template-columns: minmax(360px, 0.92fr) minmax(460px, 1.08fr);
    animation: card-enter 620ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.story-panel {
    position: relative;
    display: flex;
    overflow: hidden;
    padding: 66px 58px 48px;
    flex-direction: column;
    justify-content: space-between;
    color: var(--paper-light);
    background:
        linear-gradient(145deg, rgba(255, 255, 255, 0.045), transparent 38%),
        var(--jade-deep);
    isolation: isolate;
}

.story-panel::before {
    position: absolute;
    right: -160px;
    bottom: -205px;
    width: 440px;
    height: 440px;
    z-index: -1;
    border: 1px solid rgba(255, 253, 248, 0.13);
    border-radius: 50%;
    box-shadow:
        0 0 0 48px rgba(255, 253, 248, 0.025),
        0 0 0 96px rgba(255, 253, 248, 0.018);
    content: "";
}

.story-panel::after {
    position: absolute;
    inset: 0;
    z-index: -1;
    opacity: 0.16;
    background-image: radial-gradient(rgba(255, 253, 248, 0.7) 0.55px, transparent 0.7px);
    background-size: 5px 5px;
    content: "";
    mix-blend-mode: soft-light;
}

.story-sun {
    position: absolute;
    top: 62px;
    right: 56px;
    width: 52px;
    height: 52px;
    z-index: -1;
    border-radius: 50%;
    background: var(--vermilion);
    box-shadow: 0 0 40px rgba(226, 90, 56, 0.2);
}

.story-grid {
    position: absolute;
    top: 0;
    right: 0;
    width: 148px;
    height: 148px;
    z-index: -1;
    opacity: 0.2;
    background-image:
        linear-gradient(var(--line-light) 1px, transparent 1px),
        linear-gradient(90deg, var(--line-light) 1px, transparent 1px);
    background-size: 24px 24px;
}

.story-copy {
    position: relative;
    z-index: 1;
}

.story-eyebrow {
    margin: 0 0 28px;
    color: #d8cdbd;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 10px;
    letter-spacing: 0.3em;
}

.story-copy h1 {
    max-width: 380px;
    margin: 0;
    font-family: var(--serif);
    font-size: clamp(38px, 4vw, 54px);
    font-weight: 600;
    line-height: 1.32;
    letter-spacing: 0.06em;
}

.story-copy blockquote {
    max-width: 330px;
    margin: 32px 0 0;
    padding-left: 18px;
    border-left: 2px solid var(--vermilion);
    color: rgba(255, 253, 248, 0.66);
    font-family: var(--serif);
    font-size: 14px;
    line-height: 1.9;
}

.benefit-list {
    position: relative;
    z-index: 1;
    display: grid;
    margin: 48px 0 12px;
    padding: 0;
    list-style: none;
}

.benefit-list li {
    display: grid;
    padding: 15px 0;
    align-items: center;
    border-top: 1px solid var(--line-light);
    grid-template-columns: 48px 1fr;
}

.benefit-index {
    color: var(--vermilion);
    font-family: Georgia, "Times New Roman", serif;
    font-size: 11px;
    letter-spacing: 0.1em;
}

.benefit-list li > span:last-child {
    display: grid;
    gap: 4px;
}

.benefit-list strong {
    font-family: var(--serif);
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.08em;
}

.benefit-list small {
    color: rgba(255, 253, 248, 0.56);
    font-size: 11px;
}

.book-spines {
    position: absolute;
    right: 28px;
    bottom: 29px;
    display: flex;
    height: 78px;
    z-index: 0;
    align-items: flex-end;
    gap: 5px;
    opacity: 0.72;
}

.book-spine {
    display: block;
    width: 14px;
    border: 1px solid rgba(255, 253, 248, 0.38);
    border-radius: 2px 2px 0 0;
}

.spine-one {
    height: 56px;
    background: var(--vermilion);
}

.spine-two {
    height: 72px;
    background: rgba(255, 253, 248, 0.16);
}

.spine-three {
    width: 20px;
    height: 45px;
    background: #c1aa7b;
}

.member-card {
    position: relative;
    z-index: 1;
    display: grid;
    width: min(100%, 340px);
    min-height: 156px;
    margin-top: 48px;
    padding: 25px 26px;
    align-content: space-between;
    border: 1px solid rgba(255, 253, 248, 0.28);
    border-radius: 2px 18px 2px 18px;
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.12), transparent 55%),
        rgba(9, 42, 34, 0.44);
    box-shadow: 0 18px 45px rgba(5, 24, 20, 0.22);
    transform: rotate(-1.5deg);
}

.member-card-label,
.member-card-number {
    color: rgba(255, 253, 248, 0.55);
    font-family: Georgia, "Times New Roman", serif;
    font-size: 9px;
    letter-spacing: 0.22em;
}

.member-card strong {
    font-family: var(--serif);
    font-size: 25px;
    letter-spacing: 0.12em;
}

.member-card-seal {
    position: absolute;
    right: 22px;
    bottom: 22px;
    display: grid;
    width: 38px;
    height: 38px;
    place-items: center;
    border: 1px solid rgba(255, 253, 248, 0.7);
    color: rgba(255, 253, 248, 0.88);
    background: var(--vermilion);
    font-family: var(--serif);
    font-size: 18px;
}

.form-panel {
    display: flex;
    padding: 44px clamp(48px, 6vw, 88px) 42px;
    flex-direction: column;
    background:
        linear-gradient(90deg, rgba(18, 63, 53, 0.025) 1px, transparent 1px),
        var(--paper-light);
    background-size: 52px 100%;
}

.register-panel {
    padding-top: 35px;
    padding-bottom: 30px;
}

.auth-tabs {
    display: flex;
    width: max-content;
    padding: 3px;
    gap: 2px;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: rgba(238, 228, 211, 0.48);
}

.auth-tab {
    min-width: 72px;
    padding: 8px 16px;
    border-radius: 6px;
    color: var(--ink-soft);
    font-size: 13px;
    font-weight: 500;
    text-align: center;
    text-decoration: none;
    transition: color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.auth-tab:hover,
.auth-tab:focus-visible {
    color: var(--jade-deep);
    outline: none;
}

.auth-tab.is-active {
    color: var(--jade-deep);
    background: var(--paper-light);
    box-shadow: 0 2px 8px rgba(18, 63, 53, 0.09);
}

.form-heading {
    margin: 34px 0 30px;
}

.register-panel .form-heading {
    margin-top: 25px;
    margin-bottom: 21px;
}

.form-kicker {
    margin: 0 0 8px;
    color: var(--vermilion-dark);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.2em;
}

.form-heading h2 {
    margin: 0;
    font-family: var(--serif);
    font-size: clamp(27px, 3vw, 35px);
    font-weight: 700;
    line-height: 1.3;
    letter-spacing: 0.04em;
}

.form-heading > p:last-child {
    margin: 11px 0 0;
    color: var(--ink-soft);
    font-size: 13px;
    line-height: 1.7;
}

.auth-form {
    display: grid;
    gap: 18px;
}

.register-panel .auth-form {
    gap: 12px;
}

.form-status {
    position: relative;
    padding: 12px 14px 12px 40px;
    border: 1px solid;
    border-radius: 8px;
    font-size: 13px;
    line-height: 1.55;
}

.form-status::before {
    position: absolute;
    top: 10px;
    left: 14px;
    font-family: Georgia, serif;
    font-size: 16px;
    font-weight: 700;
}

.form-status.is-error {
    border-color: rgba(184, 60, 44, 0.26);
    color: var(--danger);
    background: rgba(184, 60, 44, 0.065);
}

.form-status.is-error::before {
    content: "!";
}

.form-status.is-success {
    border-color: rgba(33, 107, 80, 0.25);
    color: var(--success);
    background: rgba(33, 107, 80, 0.065);
}

.form-status.is-success::before {
    content: "✓";
}

.field {
    display: grid;
    gap: 7px;
}

.field > label {
    color: #28332f;
    font-size: 13px;
    font-weight: 600;
}

.input-frame {
    position: relative;
}

.field-icon {
    position: absolute;
    top: 50%;
    left: 15px;
    width: 19px;
    height: 19px;
    color: #78827d;
    pointer-events: none;
    transform: translateY(-50%);
    transition: color 160ms ease;
}

.input-frame input {
    width: 100%;
    height: 50px;
    padding: 0 48px 0 47px;
    border: 1px solid rgba(24, 35, 31, 0.18);
    border-radius: 8px;
    color: var(--ink);
    background: rgba(255, 255, 255, 0.72);
    font-size: 14px;
    outline: none;
    transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.input-frame input::placeholder {
    color: #a5aaa7;
}

.input-frame:focus-within .field-icon {
    color: var(--jade);
}

.input-frame input:focus {
    border-color: var(--jade);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(31, 102, 85, 0.1);
}

.field.has-error .input-frame input {
    border-color: var(--danger);
    box-shadow: 0 0 0 3px rgba(184, 60, 44, 0.075);
}

.field.has-error .field-icon {
    color: var(--danger);
}

.password-toggle {
    position: absolute;
    top: 50%;
    right: 7px;
    display: grid;
    width: 38px;
    height: 38px;
    padding: 0;
    place-items: center;
    border: 0;
    border-radius: 7px;
    color: #78827d;
    background: transparent;
    cursor: pointer;
    transform: translateY(-50%);
    transition: color 160ms ease, background 160ms ease;
}

.password-toggle:hover,
.password-toggle:focus-visible {
    color: var(--jade-deep);
    background: rgba(31, 102, 85, 0.08);
    outline: none;
}

.password-toggle svg {
    width: 20px;
    height: 20px;
}

.password-toggle .eye-closed,
.password-toggle[aria-pressed="true"] .eye-open {
    display: none;
}

.password-toggle[aria-pressed="true"] .eye-closed {
    display: block;
}

.field-hint,
.field-error,
.caps-lock {
    min-height: 16px;
    margin: 0;
    font-size: 11px;
    line-height: 1.45;
}

.field-hint {
    color: #8a918d;
}

.field-error {
    display: none;
    color: var(--danger);
}

.field.has-error .field-error {
    display: block;
}

.caps-lock {
    color: #9b641e;
}

.caps-lock[hidden],
.form-status[hidden] {
    display: none;
}

.password-strength {
    display: flex;
    min-height: 16px;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    color: #8a918d;
    font-size: 10px;
}

.strength-bars {
    display: grid;
    width: 104px;
    gap: 4px;
    grid-template-columns: repeat(4, 1fr);
}

.strength-bars i {
    height: 3px;
    border-radius: 99px;
    background: #dedbd3;
    transition: background 180ms ease;
}

.password-strength[data-score="1"] i:nth-child(-n+1) {
    background: #c84d37;
}

.password-strength[data-score="2"] i:nth-child(-n+2) {
    background: #d88a2f;
}

.password-strength[data-score="3"] i:nth-child(-n+3) {
    background: #72a05c;
}

.password-strength[data-score="4"] i {
    background: var(--jade);
}

.submit-button {
    position: relative;
    display: flex;
    width: 100%;
    min-height: 52px;
    margin-top: 4px;
    padding: 0 21px;
    align-items: center;
    justify-content: center;
    gap: 12px;
    overflow: hidden;
    border: 0;
    border-radius: 8px;
    color: var(--paper-light);
    background: var(--jade-deep);
    box-shadow: 0 12px 26px rgba(18, 63, 53, 0.2);
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.08em;
    cursor: pointer;
    transition: transform 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.submit-button::before {
    position: absolute;
    inset: 0;
    background: linear-gradient(105deg, transparent 30%, rgba(255, 255, 255, 0.13), transparent 70%);
    content: "";
    transform: translateX(-105%);
    transition: transform 520ms ease;
}

.submit-button:hover:not(:disabled) {
    background: var(--jade-dark);
    box-shadow: 0 15px 32px rgba(18, 63, 53, 0.26);
    transform: translateY(-1px);
}

.submit-button:hover:not(:disabled)::before {
    transform: translateX(105%);
}

.submit-button:focus-visible {
    outline: 3px solid rgba(226, 90, 56, 0.38);
    outline-offset: 3px;
}

.submit-button:disabled {
    cursor: wait;
    opacity: 0.78;
}

.button-arrow {
    position: relative;
    font-family: Georgia, serif;
    font-size: 20px;
    line-height: 1;
    transition: transform 160ms ease;
}

.submit-button:hover .button-arrow {
    transform: translateX(3px);
}

.button-spinner {
    display: none;
    width: 17px;
    height: 17px;
    border: 2px solid rgba(255, 255, 255, 0.32);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 720ms linear infinite;
}

.submit-button.is-loading .button-arrow {
    display: none;
}

.submit-button.is-loading .button-spinner {
    display: block;
}

.form-footnote {
    display: flex;
    margin-top: 25px;
    justify-content: center;
    gap: 7px;
    color: var(--ink-soft);
    font-size: 13px;
}

.register-panel .form-footnote {
    margin-top: 18px;
}

.form-footnote a {
    color: var(--vermilion-dark);
    font-weight: 600;
    text-underline-offset: 4px;
}

.form-footnote a:hover,
.form-footnote a:focus-visible {
    color: var(--vermilion);
    outline: none;
}

.privacy-note {
    display: flex;
    margin: auto 0 0;
    padding-top: 24px;
    align-items: center;
    justify-content: center;
    gap: 7px;
    color: #929894;
    font-size: 10px;
}

.privacy-note svg {
    width: 15px;
    height: 15px;
}

.auth-footer {
    display: flex;
    min-height: 82px;
    align-items: center;
    justify-content: center;
    gap: 11px;
    color: #8a918d;
    font-family: var(--serif);
    font-size: 11px;
    letter-spacing: 0.06em;
}

.footer-dot {
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: var(--vermilion);
}

@keyframes card-enter {
    from {
        opacity: 0;
        transform: translateY(18px) scale(0.992);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

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

@media (max-width: 920px) {
    .auth-shell {
        width: min(760px, calc(100% - 36px));
    }

    .auth-card {
        grid-template-columns: minmax(280px, 0.8fr) minmax(420px, 1.2fr);
    }

    .story-panel {
        padding: 54px 36px 40px;
    }

    .story-copy h1 {
        font-size: 38px;
    }

    .benefit-list small {
        display: none;
    }

    .form-panel {
        padding-right: 42px;
        padding-left: 42px;
    }
}

@media (max-width: 760px) {
    .auth-shell {
        width: min(560px, calc(100% - 28px));
    }

    .auth-header {
        min-height: 82px;
    }

    .brand-mark {
        width: 41px;
        height: 41px;
        border-radius: 11px;
    }

    .brand-copy strong {
        font-size: 18px;
    }

    .brand-copy small {
        display: none;
    }

    .back-home {
        padding-right: 5px;
        padding-left: 5px;
    }

    .auth-card {
        min-height: 0;
        border-radius: 2px 18px 2px 18px;
        grid-template-columns: 1fr;
    }

    .story-panel {
        min-height: 238px;
        padding: 34px 32px;
    }

    .story-sun {
        top: 32px;
        right: 34px;
        width: 42px;
        height: 42px;
    }

    .story-eyebrow {
        margin-bottom: 15px;
    }

    .story-copy h1 {
        max-width: 340px;
        font-size: 31px;
    }

    .story-copy blockquote {
        margin-top: 17px;
        font-size: 12px;
    }

    .benefit-list,
    .member-card {
        display: none;
    }

    .book-spines {
        right: 26px;
        bottom: 20px;
    }

    .form-panel,
    .register-panel {
        padding: 32px clamp(24px, 7vw, 42px) 30px;
    }

    .form-heading,
    .register-panel .form-heading {
        margin: 26px 0 24px;
    }

    .auth-footer {
        min-height: 70px;
    }
}

@media (max-width: 460px) {
    .auth-shell {
        width: min(100%, calc(100% - 20px));
    }

    .auth-header {
        min-height: 74px;
    }

    .brand-copy strong {
        font-size: 17px;
    }

    .back-home {
        font-size: 12px;
    }

    .story-panel {
        min-height: 205px;
        padding: 28px 24px;
    }

    .story-copy h1 {
        font-size: 27px;
    }

    .story-copy blockquote {
        max-width: 255px;
        margin-top: 14px;
        padding-left: 12px;
        line-height: 1.65;
    }

    .story-sun {
        top: 26px;
        right: 25px;
        width: 36px;
        height: 36px;
    }

    .book-spines {
        display: none;
    }

    .form-panel,
    .register-panel {
        padding: 27px 20px 25px;
    }

    .auth-tabs {
        width: 100%;
    }

    .auth-tab {
        flex: 1;
    }

    .form-heading h2 {
        font-size: 27px;
    }

    .password-strength {
        align-items: flex-start;
        flex-direction: column;
        gap: 6px;
    }

    .auth-footer {
        flex-wrap: wrap;
        line-height: 1.6;
    }
}

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

/* Form layout must respect the conditional phone-binding field. */
#phone-password-field[hidden] { display: none; }
