:root {
    color-scheme: light;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: #34495e;
    background: #f5f9fe;
    --action: #1264d6;
    --title: #16345b;
    --muted: #617184;
    --outline: #dee7f1;
    --error: #b3261e;
}

* { box-sizing: border-box; }

body { margin: 0; min-width: 280px; }

[hidden] { display: none !important; }

button, input { font: inherit; }

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

button, a { touch-action: manipulation; }

button { cursor: pointer; }

button:disabled { cursor: default; }

a { color: var(--action); text-underline-offset: 3px; }

:focus-visible { outline: 3px solid #70acff; outline-offset: 3px; }

.page {
    width: min(100%, 512px);
    margin-inline: auto;
    padding: max(28px, env(safe-area-inset-top)) 16px max(24px, env(safe-area-inset-bottom));
}

.brand { text-align: center; margin: 0 0 28px; }

.brand-logo {
    display: block;
    width: 216px;
    height: 80px;
    margin: 0 auto 12px;
    /* Keep the complete mark while clipping the source icon's transparent rim. */
    object-fit: cover;
    object-position: center;
}

.brand-name { margin: 0; color: var(--title); font-size: 32px; font-weight: 700; line-height: 1.3; }

.tagline { margin: 10px 0 0; color: var(--muted); font-size: 14px; }

.card {
    padding: 24px 20px;
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 6px 24px rgb(22 52 91 / 4%);
}

.card h1, .card h2 { margin: 0 0 8px; color: var(--title); font-size: 22px; line-height: 1.4; }

.form-note { margin: 0 0 24px; color: var(--muted); font-size: 14px; }

.field { min-width: 0; margin: 0 0 18px; }

.field label { display: block; margin-bottom: 7px; color: var(--title); font-size: 14px; font-weight: 500; }

.field input, .captcha-row input {
    display: block;
    width: 100%;
    min-width: 0;
    min-height: 54px;
    padding: 12px 14px;
    color: var(--title);
    background: #fff;
    border: 1px solid #899bb0;
    border-radius: 12px;
    outline-offset: 2px;
}

input::placeholder { color: #738398; opacity: 1; }

.field input:focus, .captcha-row input:focus { border-color: var(--action); }

input[aria-invalid="true"] { border-color: var(--error); }

input:disabled { color: var(--muted); background: #f1f6fd; }

.field-row { display: flex; gap: 8px; align-items: end; margin-bottom: 18px; }

.field-row .field { margin-bottom: 0; }

.sms-field { flex: 1; min-width: 0; }

.code-button {
    flex-shrink: 0;
    min-width: 108px;
    min-height: 54px;
    padding: 10px 8px;
    color: var(--action);
    background: #eef5ff;
    border: 0;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 500;
}

.code-button:disabled { color: #65758b; background: #f1f6fd; }

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

.invitation { margin-top: 20px; }

.status, .error, .config-error { margin: 12px 0; font-size: 14px; overflow-wrap: anywhere; }

.status { color: var(--action); }

.status:empty, .error:empty { display: none; }

.error, .status.error { color: var(--error); }

.config-error { padding: 12px 14px; color: #745018; background: #fff3da; border-radius: 12px; }

.consent {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    margin: 22px 0 18px;
    color: var(--muted);
    font-size: 14px;
}

.consent input[type="checkbox"] {
    flex: 0 0 auto;
    width: 20px;
    height: 20px;
    /* Center against the first 44px agreement-button line, including when it wraps. */
    margin: 12px 0 0;
    accent-color: var(--action);
}

.consent label { min-height: 44px; }

.text-button {
    display: inline;
    min-height: 44px;
    padding: 0 2px;
    color: var(--action);
    background: transparent;
    border: 0;
    font-size: inherit;
    vertical-align: baseline;
}

.primary-button, .secondary-button {
    display: flex;
    width: 100%;
    min-height: 52px;
    padding: 12px 16px;
    align-items: center;
    justify-content: center;
    border: 1px solid transparent;
    border-radius: 12px;
    text-align: center;
    text-decoration: none;
    font-weight: 600;
    line-height: 1.5;
}

.primary-button { color: #fff; background: var(--action); }

.primary-button:disabled { color: #f5f9fe; background: #859bb8; }

.secondary-button { color: var(--action); background: #fff; border-color: var(--outline); }

.secondary-button:disabled { color: var(--muted); background: #f5f9fe; }

.company { margin: 24px 0 0; color: var(--muted); font-size: 12px; text-align: center; }

.success-mark {
    display: flex;
    width: 64px;
    height: 64px;
    margin: 4px auto 20px;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: var(--action);
    background: #eef5ff;
    font-size: 32px;
    font-weight: 600;
}

.card .success-title { text-align: center; }

.success-copy { margin: 12px 0 24px; color: var(--muted); font-size: 14px; text-align: center; }

.download-list { display: grid; gap: 12px; margin-top: 20px; }

.download-option { padding: 16px; border: 1px solid var(--outline); border-radius: 14px; }

.platform-name { margin: 0; color: var(--title); font-size: 16px; font-weight: 600; }

.platform-note { margin: 4px 0 14px; color: var(--muted); font-size: 13px; }

.footer-link { display: block; margin: 16px auto 0; text-align: center; }

dialog {
    width: min(440px, calc(100% - 32px));
    max-height: calc(100vh - 48px);
    max-height: calc(100dvh - 48px);
    padding: 0;
    color: #34495e;
    background: #fff;
    border: 0;
    border-radius: 20px;
    box-shadow: 0 16px 64px rgb(22 52 91 / 20%);
    overflow: auto;
    overscroll-behavior: contain;
}

dialog::backdrop { background: rgb(15 23 34 / 48%); }

.dialog-heading { display: flex; gap: 12px; align-items: center; justify-content: space-between; padding: 16px 16px 12px 20px; border-bottom: 1px solid var(--outline); }

.dialog-heading h2 { margin: 0; color: var(--title); font-size: 20px; }

.dialog-close { flex-shrink: 0; width: 44px; height: 44px; padding: 0; color: var(--muted); background: transparent; border: 0; border-radius: 50%; font-size: 26px; }

.dialog-body { padding: 20px; }

.dialog-body > :first-child { margin-top: 0; }

.dialog-actions { display: flex; gap: 12px; padding: 0 20px 20px; }

.dialog-actions > button { flex: 1; min-width: 0; }

.captcha-image { display: block; width: 180px; height: 60px; margin: 12px auto; object-fit: contain; }

.captcha-row { display: flex; gap: 8px; align-items: center; margin: 16px 0 0; }

.captcha-row .text-button { flex-shrink: 0; padding-inline: 8px; }

.legal-body { overflow-wrap: anywhere; font-size: 14px; line-height: 1.85; white-space: pre-wrap; }

.legal-body h2, .legal-body h3 { margin: 24px 0 12px; color: var(--title); font-size: 16px; }

.legal-body p { margin: 0 0 16px; }

.legal-meta { margin-bottom: 24px; color: var(--muted); font-size: 12px; white-space: pre-line; }

@media (min-width: 600px) {
    .page { padding-top: 56px; }
    .card { padding: 28px; }
}

@media (max-width: 340px) {
    .page { padding-inline: 12px; }
    .card { padding: 20px 16px; }
    .code-button { min-width: 96px; padding-inline: 6px; }
    .field input, .captcha-row input { padding-inline: 10px; }
}

@media (hover: hover) {
    .primary-button:not(:disabled):hover { background: #0e54b8; }
    .secondary-button:not(:disabled):hover, .code-button:not(:disabled):hover { background: #e5efff; }
    .text-button:hover, .footer-link:hover { text-decoration: underline; text-underline-offset: 3px; }
    .dialog-close:hover { background: #f1f6fd; }
}
