:root,
[data-theme="light"] {
    --bg: #f0f4f9;
    --card: #fff;
    --text: #1f1f1f;
    --muted: #444746;
    --border: #747775;
    --borderHover: #1f1f1f;
    --focus: #0b57d0;
    --primary: #0b57d0;
    --primaryHover: #0842a0;
    --primaryText: #fff;
    --link: #0b57d0;
    --chipBg: transparent;
    --chipBorder: #747775;
    --methodHover: #e8f0fe;
    --methodBorder: #e0e3e1;
    --footerText: #1f1f1f;
    --disabled: #9aa0a6;
    --disabledBg: transparent;
    --stepMuted: #444746;
    --doneBg: #e6f4ea;
    --doneFg: #137333;
    --selectBg: transparent;
    --passkeyRing: #e8f0fe;
    --loader: #0b57d0;
    --loaderOverlay: rgba(0, 0, 0, 0.18);
    --langMenuBg: #fff;
    --langOptionHover: #f1f3f4;
    --langOptionSelected: #e8f0fe;
    --checkBorder: #747775;
    --methodIcon: #1a73e8;
    --fieldError: #b3261e;
}

[data-theme="dark"] {
    --bg: #1e1e1e;
    --card: #0e0e0e;
    --text: #e3e3e3;
    --muted: #c4c7c5;
    --border: #8e918f;
    --borderHover: #e3e3e3;
    --focus: #a8c7fa;
    --primary: #a8c7fa;
    --primaryHover: #d3e3fd;
    --primaryText: #062e6f;
    --link: #a8c7fa;
    --chipBg: transparent;
    --chipBorder: #8e918f;
    --methodHover: #394457;
    --methodBorder: #444746;
    --footerText: #e3e3e3;
    --disabled: #8e918f;
    --disabledBg: transparent;
    --stepMuted: #c4c7c5;
    --doneBg: #0d2818;
    --doneFg: #81c995;
    --selectBg: #0e0e0e;
    --passkeyRing: #1b3a5f;
    --loader: #a8c7fa;
    --loaderOverlay: rgba(0, 0, 0, 0.42);
    --langMenuBg: #2d2e30;
    --langOptionHover: #3c4043;
    --langOptionSelected: #3c4454;
    --checkBorder: #8e918f;
    --methodIcon: #8ab4f8;
    --fieldError: #f2b8b5;
}

* {
    box-sizing: border-box;
}

html {
    color-scheme: light;
}

html[data-theme="dark"] {
    color-scheme: dark;
}

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

body {
    font-family: Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
}

.page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px 16px 16px;
    gap: 20px;
}

.card {
    position: relative;
    width: min(1040px, 100%);
    min-height: 420px;
    background: var(--card);
    border: 1px solid #74777533;
    border-radius: 28px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    overflow: hidden;
}

.colLeft {
    grid-column: 1;
    grid-row: 1;
}

.colRight {
    grid-column: 2;
    grid-row: 1;
}

.loader {
    grid-column: 1 / -1;
    grid-row: 1;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
    z-index: 5;
}

.loader.active {
    opacity: 1;
}

.cardOverlay {
    grid-column: 1 / -1;
    grid-row: 1;
    position: absolute;
    inset: 0;
    z-index: 4;
    display: none;
    background: var(--loaderOverlay);
    cursor: wait;
    pointer-events: auto;
}

.card.loading .cardOverlay {
    display: block;
}

.page.loading .footer {
    pointer-events: none;
}

.loaderBar {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    background: var(--loader);
}

.loader.active .loaderBar:nth-child(1) {
    animation: loaderIn 2.1s cubic-bezier(0.65, 0.815, 0.735, 0.395) infinite;
}

.loader.active .loaderBar:nth-child(2) {
    animation: loaderOut 2.1s cubic-bezier(0.165, 0.84, 0.44, 1) 1.15s infinite;
}

@keyframes loaderIn {
    0% {
        left: -35%;
        right: 100%;
    }
    60%,
    100% {
        left: 100%;
        right: -90%;
    }
}

@keyframes loaderOut {
    0% {
        left: -200%;
        right: 100%;
    }
    60%,
    100% {
        left: 107%;
        right: -8%;
    }
}

[data-theme="dark"] .card {
    border-color: #444746;
}

.colLeft,
.colRight {
    padding: 36px 40px 28px;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.colRight {
    justify-content: space-between;
    min-width: 0;
}

.logo {
    margin-bottom: 16px;
    height: 40px;
}

.logo svg {
    display: block;
}

.title {
    margin: 0;
    font-size: 36px;
    font-weight: 400;
    line-height: 44px;
    letter-spacing: 0;
    white-space: normal;
    overflow-wrap: anywhere;
    max-width: 100%;
}

.card[data-step="promptEmail"] .title {
    font-size: 28px;
    line-height: 36px;
}

.subtitle {
    margin: 0;
    font-size: 16px;
    line-height: 1.5;
    color: var(--text);
    max-width: 360px;
}

.chip {
    margin-top: 16px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    max-width: 100%;
    padding: 3px 10px 3px 3px;
    border-radius: 999px;
    border: 1px solid var(--chipBorder);
    background: var(--chipBg);
    color: var(--text);
    cursor: pointer;
    font: inherit;
    font-size: 14px;
    width: fit-content;
}

.chip.hidden {
    display: none;
}

.chipAvatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #5f6368;
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.chipAvatar svg {
    display: block;
}

.chipEmail {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chipCaret {
    opacity: 0.7;
    flex-shrink: 0;
}

.leftExtra {
    margin-top: auto;
    padding-top: 24px;
}

.views {
    flex: 1;
    padding-top: 56px;
}

.card[data-step="password"] .views {
    padding-top: 116px;
}

.view {
    display: none;
}

.view.active {
    display: block;
}

.field {
    position: relative;
    margin-top: 4px;
}

.field input {
    width: 100%;
    height: 56px;
    padding: 13px 15px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: transparent;
    color: var(--text);
    font: inherit;
    font-size: 16px;
    outline: none;
}

.field input:hover {
    border-color: var(--borderHover);
}

.field input:focus {
    border-color: var(--focus);
    border-width: 2px;
    padding: 12px 14px;
}

.field label {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    padding: 0 4px;
    background: var(--card);
    color: var(--muted);
    font-size: 16px;
    pointer-events: none;
    transition: all 0.15s ease;
}

.field input:focus + label,
.field.filled label {
    top: 0;
    font-size: 12px;
    color: var(--focus);
}

.field.filled:not(:focus-within) label {
    color: var(--muted);
}

.field.invalid input,
.field.invalid input:focus {
    border-color: var(--fieldError);
    border-width: 2px;
    padding: 12px 14px;
}

.smsPhoneArt {
    width: 120px;
    height: 120px;
    margin: 0 0 16px;
}

.smsPhoneArt svg {
    display: block;
}

.bodyHint {
    margin: 0 0 20px;
    font-size: 14px;
    line-height: 1.5;
    font-style: italic;
    color: var(--muted);
}

.card[data-step="smsPhone"] .rightTitle {
    font-size: 22px;
    line-height: 28px;
    margin: 0 0 12px;
}

.card[data-step="smsPhone"] .checkRow {
    margin-top: 20px;
}

.phoneField {
    position: relative;
    display: flex;
    align-items: stretch;
    box-sizing: border-box;
    height: 56px;
    margin-top: 4px;
    border: 1px solid var(--border);
    border-radius: 4px;
}

.phoneField:focus-within {
    border-color: var(--focus);
    box-shadow: inset 0 0 0 1px var(--focus);
}

.phoneField.invalid,
.phoneField.invalid:focus-within {
    border-color: var(--fieldError);
    box-shadow: inset 0 0 0 1px var(--fieldError);
}

.phoneField input {
    flex: 1;
    min-width: 0;
    height: 100%;
    padding: 13px 15px 13px 4px;
    border: 0;
    background: transparent;
    color: var(--text);
    font: inherit;
    font-size: 16px;
    outline: none;
}

.phoneField input::placeholder {
    color: transparent;
}

.phoneField label {
    position: absolute;
    left: 52px;
    top: 50%;
    transform: translateY(-50%);
    padding: 0 4px;
    background: var(--card);
    color: var(--muted);
    font-size: 16px;
    pointer-events: none;
    transition: all 0.15s ease;
}

.phoneField:focus-within label,
.phoneField.filled label {
    left: 12px;
    top: 0;
    transform: none;
    font-size: 12px;
    color: var(--focus);
}

.phoneField.filled:not(:focus-within) label {
    color: var(--muted);
}

.phoneField.invalid label,
.phoneField.invalid:focus-within label,
.phoneField.invalid.filled label {
    color: var(--fieldError);
}

.countryWrap {
    position: relative;
    display: flex;
    align-items: center;
}

.flagBtn {
    display: flex;
    align-items: center;
    gap: 0;
    height: 100%;
    padding: 0 2px 0 12px;
    border: 0;
    background: transparent;
    color: var(--text);
    cursor: pointer;
}

.flagIcon {
    font-size: 22px;
    line-height: 1;
    min-width: 22px;
}

.countryCaret {
    flex-shrink: 0;
    color: var(--muted);
}

.countryWrap.open .countryCaret {
    transform: rotate(180deg);
}

.countryMenu {
    display: none;
    position: absolute;
    left: 0;
    top: calc(100% + 6px);
    z-index: 30;
    margin: 0;
    padding: 8px 0;
    min-width: 280px;
    max-width: 360px;
    max-height: 280px;
    overflow: auto;
    list-style: none;
    background: var(--langMenuBg);
    border-radius: 4px;
    box-shadow: 0 2px 6px 2px rgba(0, 0, 0, 0.3);
}

.countryWrap.open .countryMenu {
    display: block;
}

.countryOption {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    margin: 0;
    padding: 10px 16px;
    border: 0;
    background: transparent;
    color: var(--text);
    font: inherit;
    font-size: 14px;
    text-align: left;
    cursor: pointer;
}

.countryOption:hover,
.countryOption.selected {
    background: var(--langOptionHover);
}

.countryOption.selected {
    background: var(--langOptionSelected);
}

.fieldGrow {
    flex: 1;
    margin-top: 0;
}

.fieldCode {
    display: flex;
    align-items: center;
}

.smsPrefix {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 16px;
    color: var(--text);
    pointer-events: none;
    z-index: 1;
}

.fieldCode input {
    padding-left: 42px;
}

.fieldCode input:focus {
    padding-left: 41px;
}

.fieldCode label {
    left: 40px;
}

.fieldCode.filled label,
.fieldCode input:focus + label {
    left: 12px;
}

.fieldCode.invalid input,
.fieldCode.invalid input:focus {
    padding-left: 41px;
}

.field.invalid input:focus + label,
.field.invalid.filled label {
    color: var(--fieldError);
}

.fieldMsg {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin: 8px 0 0;
    color: var(--fieldError);
    font-size: 12px;
    line-height: 16px;
}

.fieldMsg.hidden {
    display: none;
}

.fieldMsgIcon {
    flex: 0 0 16px;
    margin-top: 0;
}

.fieldMsgLink {
    appearance: none;
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    padding: 0;
    text-decoration: underline;
    text-underline-offset: 2px;
    cursor: pointer;
}

.field input::placeholder {
    color: transparent;
}

.linkBtn,
.textBtn,
.inlineLink {
    appearance: none;
    border: 0;
    background: transparent;
    color: var(--link);
    font: inherit;
    font-size: 14px;
    font-weight: 500;
    padding: 0;
    cursor: pointer;
}

.linkBtn {
    margin-top: 14px;
    display: inline-block;
}

.inlineLink {
    display: inline;
    padding: 0;
}

.linkBtn:hover,
.textBtn:hover,
.inlineLink:hover {
    text-decoration: underline;
    text-underline-offset: 2px;
}

.hint {
    margin: 40px 0 0;
    font-size: 14px;
    line-height: 1.4286;
    color: var(--muted);
}

.checkRow {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
    font-size: 14px;
    line-height: 16px;
    cursor: pointer;
    user-select: none;
}

.checkRow input {
    appearance: none;
    width: 16px;
    height: 16px;
    margin: 0;
    padding: 0;
    flex: 0 0 16px;
    border: 2px solid var(--checkBorder);
    border-radius: 2px;
    background: transparent;
    box-sizing: border-box;
}

.checkRow input:hover {
    border-color: var(--text);
}

.checkRow input:checked {
    background: var(--primary);
    border-color: var(--primary);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23062e6f' d='M9 16.17 4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: 12px 12px;
}

[data-theme="light"] .checkRow input:checked {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23fff' d='M9 16.17 4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z'/%3E%3C/svg%3E");
}

.rightTitle {
    margin: 0 0 18px;
    font-size: 16px;
    font-weight: 400;
    line-height: 1.5;
}

.bodyText {
    margin: 0 0 12px;
    font-size: 14px;
    line-height: 1.5;
    color: var(--text);
}

.promptArt {
    width: 104px;
    height: 104px;
    margin: 0 0 24px;
    color: var(--methodIcon);
}

.promptArt.hidden {
    display: none;
}

.promptArt svg {
    display: block;
}

.card[data-step="challenge"] .views,
.card[data-step="methods"] .views,
.card[data-step="promptEmail"] .views,
.card[data-step="passkey"] .views,
.card[data-step="smsPhone"] .views {
    padding-top: 0;
}

.card[data-step="challenge"] .views {
    display: flex;
    flex-direction: column;
}

.card[data-step="challenge"] .view.active {
    display: flex;
    flex-direction: column;
    justify-content: center;
    flex: 1;
}

.promptNumberBig {
    font-size: 56px;
    font-weight: 400;
    line-height: 1;
    margin: 0 0 16px;
    letter-spacing: 1px;
}

.promptNumberBig.hidden {
    display: none;
}

.rightTitle.hidden {
    display: none;
}

.passkeyArt {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    margin: 0 0 24px;
    padding: 12px 0;
}

.passkeyCircle {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: var(--passkeyRing);
    color: var(--link);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.passkeyLock {
    position: absolute;
    right: 18px;
    bottom: 18px;
}

.passkeyIcons {
    display: flex;
    gap: 18px;
    opacity: 0.7;
    font-size: 18px;
}

.methodList {
    list-style: none;
    margin: 0 -8px;
    padding: 0;
    max-height: 440px;
    overflow: auto;
}

.methodList li {
    border-bottom: 1px solid var(--methodBorder);
}

.methodList li:last-child {
    border-bottom: 0;
}

.methodBtn {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 16px;
    min-height: 48px;
    padding: 12px 16px;
    border: 0;
    border-radius: 28px;
    background: transparent;
    color: var(--text);
    font: inherit;
    font-size: 14px;
    line-height: 20px;
    text-align: left;
    cursor: pointer;
}

.methodBtn:hover:not(:disabled) {
    background: var(--methodHover);
}

.methodBtn:disabled {
    color: var(--disabled);
    cursor: default;
}

.methodBtn:disabled .methodIcon {
    color: var(--disabled);
}

.methodIcon {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
    margin-top: 0;
    color: var(--methodIcon);
}

.methodText {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    padding: 2px 0;
}

.methodTitle {
    font-weight: 400;
    line-height: 20px;
}

.methodTitle strong {
    font-weight: 700;
}

.methodDesc {
    font-size: 12px;
    color: var(--muted);
    line-height: 16px;
}

.methodBtn:disabled .methodDesc {
    color: var(--disabled);
}

.steps,
.deviceSteps {
    margin: 0 0 20px;
    padding: 0;
    list-style: none;
    font-size: 14px;
    line-height: 20px;
    color: var(--text);
}

.deviceSteps li {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
    margin: 0 0 10px;
}

.deviceSteps strong {
    font-weight: 700;
}

.devicePick {
    appearance: none;
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    padding: 0;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0;
}

.deviceCaret,
.stepGear {
    flex-shrink: 0;
    color: var(--text);
}

.deviceCaret {
    margin-left: -2px;
}

.stepGear {
    margin-left: 2px;
}

.steps li {
    margin-bottom: 6px;
}

.steps strong {
    color: var(--text);
    font-weight: 500;
}

.doneBox {
    text-align: center;
    padding: 12px 0;
}

.doneCheck {
    width: 56px;
    height: 56px;
    margin: 0 auto 16px;
    border-radius: 50%;
    background: var(--doneBg);
    color: var(--doneFg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
}

.doneDump {
    margin: 16px 0 0;
    text-align: left;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 12px;
    background: var(--methodHover);
    border-radius: 8px;
    padding: 12px;
    overflow: auto;
    white-space: pre-wrap;
    word-break: break-all;
    color: var(--muted);
    max-height: 220px;
}

.actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 24px;
    margin-top: 28px;
    min-height: 40px;
}

.actions.split {
    justify-content: space-between;
}

.actions.hidden {
    display: none;
}

.primaryBtn {
    min-width: 80px;
    height: 40px;
    padding: 0 24px;
    border: 0;
    border-radius: 20px;
    background: var(--primary);
    color: var(--primaryText);
    font: inherit;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
}

.primaryBtn:hover {
    background: var(--primaryHover);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.primaryBtn.hidden {
    display: none;
}

.primaryBtn.asLink {
    background: transparent;
    color: var(--link);
    box-shadow: none;
    font-weight: 500;
    min-width: 0;
    padding: 0 12px;
}

.primaryBtn.asLink:hover {
    background: transparent;
    box-shadow: none;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.textBtn.hidden {
    visibility: hidden;
    pointer-events: none;
}

.footer {
    width: min(1040px, 100%);
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 16px;
    padding: 0 12px;
    font-size: 12px;
    color: var(--footerText);
}

.langWrap {
    position: relative;
    justify-self: start;
}

.langBtn {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    margin: 0;
    padding: 6px 8px 6px 10px;
    border: 1px solid transparent;
    border-radius: 4px;
    background: transparent;
    color: var(--footerText);
    font: inherit;
    font-size: 12px;
    line-height: 18px;
    cursor: pointer;
}

.langBtn:hover {
    background: var(--langOptionHover);
}

.langBtn:focus,
.langBtn:focus-visible,
.langWrap.open .langBtn {
    outline: none;
    border-color: var(--focus);
}

.langCaret {
    flex: 0 0 auto;
    opacity: 0.8;
}

.langWrap.open .langCaret {
    transform: rotate(180deg);
}

.langMenu {
    display: none;
    position: absolute;
    left: 0;
    bottom: calc(100% + 6px);
    z-index: 20;
    margin: 0;
    padding: 8px 0;
    min-width: 168px;
    list-style: none;
    background: var(--langMenuBg);
    border-radius: 4px;
    box-shadow: 0 2px 6px 2px rgba(0, 0, 0, 0.3);
}

.langWrap.open .langMenu {
    display: block;
}

.langMenu li {
    margin: 0;
}

.langOption {
    display: block;
    width: 100%;
    margin: 0;
    padding: 10px 16px;
    border: 0;
    background: transparent;
    color: var(--footerText);
    font: inherit;
    font-size: 14px;
    line-height: 20px;
    text-align: left;
    cursor: pointer;
}

.langOption:hover,
.langOption:focus {
    outline: none;
    background: var(--langOptionHover);
}

.langOption.selected,
.langOption.selected:hover,
.langOption.selected:focus {
    background: var(--langOptionSelected);
}

.footerLinks {
    display: flex;
    gap: 24px;
}

.footerLinks a {
    color: var(--footerText);
    text-decoration: none;
}

.footerLinks a:hover {
    text-decoration: underline;
}

@media (max-width: 900px) {
    .card {
        grid-template-columns: 1fr;
        min-height: 0;
    }

    .colLeft,
    .colRight {
        grid-column: 1;
    }

    .colLeft {
        grid-row: 1;
        padding-bottom: 0;
    }

    .colRight {
        grid-row: 2;
    }

    .views,
    .card[data-step="password"] .views {
        padding-top: 20px;
    }

    .title {
        font-size: 28px;
        line-height: 36px;
        white-space: normal;
    }

    .leftExtra {
        display: none;
    }
}

@media (max-width: 600px) {
    .page {
        justify-content: flex-start;
        padding: 0;
        gap: 0;
    }

    .card {
        border: 0;
        border-radius: 0;
        min-height: calc(100vh - 72px);
    }

    .colLeft,
    .colRight {
        padding: 28px 24px 16px;
    }

    .footer {
        padding: 16px 24px 24px;
        grid-template-columns: 1fr;
        gap: 12px;
    }
}
