:root {
    color-scheme: light;
    --page: #f3df9b;
    --header: #fff8e7;
    --text: #4a3922;
    --muted: #806c4d;
    --cyan: #a87520;
    --cyan-strong: #b8862f;
    --success: #66794c;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }

body {
    margin: 0;
    overflow-x: hidden;
    background: var(--page);
    color: var(--text);
    font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    -webkit-text-size-adjust: 100%;
}

button, input { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }

.site-header {
    position: relative;
    z-index: 3;
    height: 86px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 34px;
    background: rgba(255, 248, 231, 0.96);
    border-bottom: 1px solid rgba(151, 116, 55, 0.2);
}

.brand {
    color: #574327;
    text-decoration: none;
    font-size: clamp(20px, 2vw, 25px);
    font-weight: 800;
    letter-spacing: -0.04em;
}
.brand-accent { color: var(--cyan); }
.language-switcher { display: flex; gap: 6px; }

.language-button {
    min-width: 36px;
    height: 28px;
    padding: 0 9px;
    color: #806b49;
    background: rgba(255, 253, 245, 0.7);
    border: 1px solid rgba(151, 116, 55, 0.24);
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: color .18s ease, border-color .18s ease, background-color .18s ease;
}

.language-button:hover,
.language-button:focus-visible,
.language-button.is-active {
    color: #654718;
    border-color: rgba(168, 117, 32, 0.62);
    background: rgba(229, 196, 121, 0.25);
    outline: none;
}

.hero {
    position: relative;
    min-height: calc(100vh - 86px);
    overflow: hidden;
    isolation: isolate;
    background-color: #f3df9b;
    background-image: url('../images/trading-hero-v3.png');
    background-size: cover;
    background-position: center center;
}

.hero-shade {
    position: absolute;
    inset: 0;
    z-index: -1;
    background: rgba(255, 253, 245, 0.05);
}

.login-panel {
    width: min(360px, calc(100vw - 40px));
    margin-left: clamp(40px, 6.6vw, 80px);
    padding-top: clamp(55px, 8vh, 70px);
    padding-bottom: 92px;
}

.system-badge {
    display: inline-flex;
    align-items: center;
    min-height: 25px;
    padding: 4px 12px;
    border: 1px solid rgba(168, 117, 32, 0.5);
    border-radius: 999px;
    background: rgba(255, 253, 245, 0.62);
    color: #8d6118;
    font-family: Consolas, "Courier New", monospace;
    font-size: 11px;
    letter-spacing: .02em;
}

h1 {
    margin: 18px 0 8px;
    font-size: clamp(26px, 2.3vw, 31px);
    line-height: 1.18;
    letter-spacing: -0.035em;
}

.subtitle {
    margin: 0 0 25px;
    color: var(--muted);
    font-size: 14px;
    font-weight: 600;
}

.trade-form { display: grid; gap: 15px; }
.field-group { display: grid; gap: 7px; }
.field-group label { color: #675439; font-size: 13px; font-weight: 650; }

.field-group input {
    width: 100%;
    height: 37px;
    padding: 0 13px;
    color: #45341e;
    background: rgba(255, 253, 245, 0.82);
    border: 1px solid rgba(133, 101, 48, 0.34);
    border-radius: 9px;
    outline: none;
    transition: border-color .18s ease, box-shadow .18s ease, background-color .18s ease;
}
.field-group input:hover { border-color: rgba(133, 101, 48, 0.58); }
.field-group input:focus {
    border-color: var(--cyan);
    background: rgba(255, 253, 245, 0.98);
    box-shadow: 0 0 0 3px rgba(168, 117, 32, 0.12);
}

.agreement {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    color: #6f5c3e;
    font-size: 12px;
    line-height: 18px;
    cursor: pointer;
}
.agreement input { width: 15px; height: 15px; margin: 1px 0 0; accent-color: var(--cyan); }

.primary-button {
    width: 141px;
    min-height: 45px;
    padding: 0 22px;
    border: 0;
    border-radius: 10px;
    color: #fffdf5;
    background: var(--cyan-strong);
    font-size: 16px;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 10px 28px rgba(137, 96, 31, 0.22);
    transition: transform .18s ease, background-color .18s ease, box-shadow .18s ease;
}
.primary-button:hover { transform: translateY(-1px); background: #9c6b1f; box-shadow: 0 12px 34px rgba(137, 96, 31, 0.3); }
.primary-button:focus-visible { outline: 2px solid white; outline-offset: 3px; }
.primary-button:disabled { cursor: wait; opacity: .75; transform: none; }

.form-status { min-height: 18px; margin: -5px 0 0; color: var(--success); font-size: 12px; }
.form-status.is-error { color: #a5422d; }
.support-links { display: flex; gap: 24px; margin-top: 1px; }
.text-link { padding: 0; border: 0; background: transparent; color: var(--cyan); font-size: 12px; text-decoration: underline; cursor: pointer; }
.text-link:hover, .text-link:focus-visible { color: #68430d; outline: none; }
.text-link.inline { display: inline; }
.register-copy { margin: 14px 0 0 119px; color: #806c4d; font-size: 12px; white-space: nowrap; }

.site-footer {
    position: absolute;
    left: clamp(40px, 12vw, 147px);
    bottom: 55px;
    color: rgba(100, 78, 43, 0.72);
    font-size: 10px;
}

.toast {
    position: fixed;
    z-index: 20;
    left: 50%;
    bottom: 28px;
    padding: 11px 16px;
    border: 1px solid rgba(168, 117, 32, 0.36);
    border-radius: 8px;
    background: #5e4829;
    color: #fffaf0;
    font-size: 13px;
    opacity: 0;
    transform: translate(-50%, 12px);
    pointer-events: none;
    transition: opacity .2s ease, transform .2s ease;
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

.terms-dialog {
    width: min(460px, calc(100vw - 32px));
    padding: 22px;
    color: var(--text);
    background: #fffaf0;
    border: 1px solid rgba(168, 117, 32, 0.36);
    border-radius: 12px;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.55);
}
.terms-dialog::backdrop { background: rgba(74, 57, 34, 0.42); }
.dialog-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.dialog-heading h2 { margin: 0; font-size: 20px; }
.terms-dialog p { color: #786345; font-size: 14px; line-height: 1.8; }
.close-button { width: 32px; height: 32px; border: 0; background: transparent; color: #856b45; font-size: 24px; cursor: pointer; }
.dialog-action { width: 100%; margin-top: 5px; }

.terms-dialog--legal {
    width: min(640px, calc(100vw - 32px));
    max-height: min(760px, calc(100vh - 40px));
    padding: 0;
    overflow: hidden;
}

.legal-dialog-heading {
    padding: 18px 22px;
    background: #ead18a;
    border-bottom: 1px solid rgba(137, 96, 31, .24);
}

.legal-dialog-heading h2 {
    color: #513a1c;
    font-size: 17px;
}

.legal-dialog-scroll {
    max-height: min(590px, calc(100vh - 190px));
    padding: 24px 24px 12px;
    overflow-y: auto;
    scrollbar-color: #bc8a34 #fff6df;
    scrollbar-width: thin;
}

.legal-dialog-scroll h3 {
    margin: 0 0 14px;
    color: #9b6818;
    font-size: 16px;
}

.legal-introduction p,
.legal-terms-list li {
    color: #5f4a2c;
    font-size: 13px;
    line-height: 1.85;
}

.legal-introduction p { margin: 0 0 10px; }
.legal-terms-list { margin: 20px 0 0; padding: 0; list-style: none; counter-reset: legal-item; }

.legal-terms-list li {
    position: relative;
    margin-bottom: 18px;
    padding-left: 42px;
    counter-increment: legal-item;
}

.legal-terms-list li::before {
    content: '✓  ' counter(legal-item) '、';
    position: absolute;
    left: 0;
    top: 0;
    color: #6f8b4c;
    font-size: 14px;
    font-weight: 800;
}

.legal-dialog-footer {
    padding: 12px 22px 18px;
    background: #fffaf0;
    border-top: 1px solid rgba(137, 96, 31, .18);
}

.legal-dialog-footer .dialog-action {
    width: auto;
    min-width: 150px;
    margin: 0;
}

[dir="rtl"] .legal-terms-list li { padding-right: 42px; padding-left: 0; }
[dir="rtl"] .legal-terms-list li::before { right: 0; left: auto; }

@media (max-width: 760px) {
    .site-header { height: 72px; padding: 0 20px; }
    .brand { max-width: 190px; font-size: 19px; }
    .language-button { min-width: 32px; padding: 0 7px; }
    .hero { min-height: calc(100vh - 72px); background-position: 64% center; }
    .hero-shade { background: rgba(255, 250, 236, 0.18); }
    .login-panel { position: relative; margin: 0 auto; padding: 42px 20px 112px; }
    .login-panel::before {
        content: '';
        position: absolute;
        z-index: -1;
        inset: 24px 0 76px;
        background: rgba(255, 250, 236, 0.82);
        border: 1px solid rgba(151, 116, 55, 0.2);
        border-radius: 16px;
        backdrop-filter: blur(9px);
    }
    .register-copy { margin-left: 0; text-align: center; }
    .site-footer { left: 0; right: 0; bottom: 28px; text-align: center; }
}

@media (max-height: 670px) and (min-width: 761px) {
    .login-panel { padding-top: 50px; }
    .trade-form { gap: 12px; }
    .site-footer { bottom: 26px; }
}

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

.register-body {
    min-height: 100vh;
    background: #fffdf5;
}

.register-header {
    box-shadow: 0 1px 0 rgba(151, 116, 55, 0.08);
}

.register-page {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    min-height: calc(100vh - 86px);
    display: grid;
    place-items: center;
    padding: 72px 20px 110px;
    background:
        radial-gradient(circle at 50% 42%, rgba(255, 253, 245, .82) 0 11%, transparent 42%),
        linear-gradient(135deg, #fff8df 0%, #f4dda0 48%, #f8e9bb 100%);
}

.register-page::before,
.register-page::after {
    content: '';
    position: absolute;
    z-index: -1;
    pointer-events: none;
}

.register-page::before {
    inset: 0 auto 0 0;
    width: 42%;
    background: linear-gradient(160deg, rgba(255, 253, 245, .76), rgba(226, 188, 94, .18));
    clip-path: polygon(0 0, 100% 0, 62% 58%, 100% 100%, 0 100%);
}

.register-page::after {
    inset: 0 0 0 auto;
    width: 39%;
    background: linear-gradient(155deg, rgba(214, 169, 67, .24), rgba(255, 253, 245, .72));
    clip-path: polygon(34% 0, 100% 0, 100% 100%, 0 100%, 58% 52%);
}

.register-card {
    position: relative;
    width: min(600px, 100%);
    padding: 50px 60px 46px;
    background: rgba(255, 253, 245, 0.94);
    border: 1px solid rgba(168, 117, 32, 0.55);
    border-radius: 17px;
    box-shadow: 0 28px 72px rgba(115, 84, 35, 0.18);
    backdrop-filter: blur(12px);
}

.register-card h1 {
    margin-top: 28px;
    margin-bottom: 10px;
    font-size: 36px;
}

.register-subtitle {
    margin-bottom: 34px;
}

.register-form {
    display: grid;
    gap: 24px;
}

.register-form .field-group {
    gap: 9px;
}

.register-form .field-group input {
    height: 50px;
    border-radius: 9px;
    background: rgba(255, 250, 235, 0.96);
}
.verification-row { display: grid; grid-template-columns: 1fr 112px; gap: 10px; }
.code-button { border: 1px solid rgba(137, 96, 31, .45); border-radius: 8px; background: #f4dda0; color: #6f4915; font-weight: 700; cursor: pointer; transition: background-color .18s ease, transform .18s ease; }
.code-button:hover { background: #ebcd7d; transform: translateY(-1px); }
.code-button:disabled { cursor: wait; opacity: .65; }

.register-agreement {
    margin-top: 1px;
}

.register-button {
    width: 196px;
    min-height: 62px;
    margin-top: -2px;
}

.field-error {
    margin: 0;
    color: #a5422d;
    font-size: 12px;
    line-height: 1.5;
}

.agreement-error {
    margin-top: -18px;
}

.register-support {
    justify-content: center;
    margin-top: 24px;
}

.login-copy {
    margin: 20px 0 0;
    color: #806c4d;
    font-size: 12px;
    text-align: center;
}

.register-footer {
    margin-top: 39px;
    padding-top: 35px;
    color: rgba(100, 78, 43, 0.66);
    border-top: 1px solid rgba(135, 102, 47, 0.22);
    font-size: 10px;
    text-align: center;
}

@media (max-width: 760px) {
    .register-page {
        min-height: calc(100vh - 72px);
        padding: 34px 16px 56px;
    }

    .register-card {
        padding: 34px 24px 32px;
    }

    .register-card h1 {
        font-size: 30px;
    }

    .register-button {
        width: 100%;
    }
}

.guide-body {
    min-height: 100vh;
    background: #fffdf5;
    color: #493820;
}

.guide-page {
    position: relative;
    min-height: 100vh;
    padding: 40px 20px 64px;
    background: #f4e2a6;
}

.guide-back {
    position: absolute;
    top: 20px;
    left: 20px;
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    padding: 0 18px;
    color: #604923;
    background: rgba(255, 253, 245, 0.74);
    border: 1px solid rgba(136, 101, 43, 0.34);
    border-radius: 8px;
    text-decoration: none;
    font-weight: 650;
    transition: background-color .18s ease, border-color .18s ease, transform .18s ease;
}

.guide-back:hover,
.guide-back:focus-visible {
    background: #fffdf5;
    border-color: #a87520;
    outline: none;
    transform: translateY(-1px);
}

.guide-heading {
    max-width: 960px;
    margin: 0 auto 50px;
    text-align: center;
}

.guide-heading h1 {
    margin: 0 0 10px;
    color: #8f641b;
    font-size: 32px;
    letter-spacing: -0.03em;
}

.guide-heading p {
    margin: 0;
    color: #7b684a;
    font-size: 14px;
}

.guide-content {
    width: min(960px, 100%);
    margin: 0 auto;
}

.guide-section {
    margin-bottom: 24px;
    padding: 30px;
    background: rgba(255, 253, 245, 0.78);
    border: 1px solid rgba(168, 117, 32, 0.22);
    border-radius: 16px;
    box-shadow: 0 16px 44px rgba(116, 83, 31, 0.07);
}

.guide-section h2 {
    margin: 0 0 17px;
    color: #9b6d20;
    font-size: 22px;
    line-height: 1.3;
}

.guide-section h2 span {
    display: inline-block;
    margin-right: 10px;
}

.guide-step {
    display: grid;
    grid-template-columns: 40px minmax(0, 1fr);
    gap: 16px;
    padding: 6px 0 24px;
}

.guide-step + .guide-step {
    padding-top: 24px;
    border-top: 1px solid rgba(126, 96, 47, 0.14);
}

.guide-step:last-of-type {
    padding-bottom: 4px;
}

.step-marker {
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: #c79735;
    color: #fffdf5;
    font-size: 14px;
    font-weight: 800;
    box-shadow: 0 8px 18px rgba(143, 101, 28, 0.18);
}

.question-marker {
    background: #aa7b29;
}

.guide-step h3 {
    margin: 2px 0 8px;
    color: #493820;
    font-size: 17px;
    line-height: 1.35;
}

.guide-step p,
.guide-step li,
.risk-notice p {
    color: #6f5b3c;
    font-size: 14px;
    line-height: 1.75;
}

.guide-step p {
    margin: 0;
}

.guide-step ul {
    margin: 8px 0 0;
    padding-left: 20px;
}

.risk-notice {
    margin-top: 24px;
    padding: 18px 16px;
    background: rgba(255, 244, 220, 0.88);
    border: 1px solid rgba(182, 105, 61, 0.3);
    border-radius: 9px;
}

.risk-notice h4 {
    margin: 0 0 8px;
    color: #a44e2e;
    font-size: 14px;
}

.risk-notice p {
    margin: 0;
}

@media (max-width: 600px) {
    .guide-page {
        padding: 42px 17px 48px;
    }

    .guide-back {
        top: 17px;
        left: 17px;
        min-height: 36px;
        padding: 0 13px;
        font-size: 13px;
    }

    .guide-heading {
        margin-bottom: 59px;
    }

    .guide-heading h1 {
        font-size: 28px;
    }

    .guide-heading p {
        font-size: 13px;
    }

    .guide-section {
        margin-bottom: 20px;
        padding: 26px;
        border-radius: 14px;
    }

    .guide-section h2 {
        margin-bottom: 14px;
        font-size: 21px;
    }

    .guide-step {
        grid-template-columns: 34px minmax(0, 1fr);
        gap: 13px;
        padding-bottom: 24px;
    }

    .guide-step + .guide-step {
        padding-top: 24px;
    }

    .step-marker {
        width: 34px;
        height: 34px;
        font-size: 13px;
    }

    .guide-step h3 {
        margin-top: 0;
        font-size: 16px;
    }

    .guide-step p,
    .guide-step li,
    .risk-notice p {
        font-size: 14px;
        line-height: 1.8;
    }

    .risk-notice {
        padding: 16px 14px;
    }
}
