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

:root {
    --gray-50: #f8f8fa;
    --gray-100: #f0f0f3;
    --gray-200: #e2e2e7;
    --gray-300: #c8c8d0;
    --gray-400: #9d9daa;
    --gray-500: #6e6e7a;
    --gray-600: #53535e;
    --gray-700: #3a3a44;
    --gray-800: #27272f;
    --gray-900: #18181b;
    --brand: #A15A95;
    --brand-dark: #8a4d80;
    --brand-light: #f5eaf3;
    --brand-subtle: rgba(161,90,149,0.08);
    --error: #c44b4b;
    --error-bg: #fdf0f0;
    --radius: 14px;
    --transition: 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

html { font-size: 16px; }

body {
    font-family: 'Suisse Intl', 'Helvetica Neue', Arial, sans-serif;
    background: #fff;
    color: var(--gray-900);
    min-height: 100vh;
    display: flex;
    position: relative;
}

/* ── Left panel ── */
.pattern-panel {
    flex: 0 0 45%;
    background: var(--gray-900);
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pattern-panel::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        linear-gradient(135deg, rgba(161,90,149,0.2) 0%, transparent 50%),
        linear-gradient(225deg, rgba(161,90,149,0.1) 0%, transparent 50%);
}

.pattern-content {
    position: relative;
    z-index: 2;
    text-align: center;
    padding: 3rem;
}

.pattern-logo {
    width: 220px;
    height: auto;
    margin-bottom: 1.5rem;
}

.pattern-content p {
    color: var(--gray-400);
    font-size: 1.05rem;
    font-weight: 300;
    letter-spacing: 0.02em;
    max-width: 300px;
    margin: 0 auto;
    line-height: 1.6;
}

/* ── Right panel ── */
.form-panel {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    position: relative;
    background: #fff;
}

.form-panel::before {
    content: '';
    position: absolute;
    top: -200px;
    right: -200px;
    width: 500px;
    height: 500px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(161,90,149,0.06) 0%, transparent 70%);
    pointer-events: none;
}

.form-wrapper {
    width: 100%;
    max-width: 400px;
    position: relative;
}

/* ── Top bar ── */
.top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 2rem;
}

.top-bar .brand-badge {
    margin-bottom: 0;
}

.brand-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px 6px 8px;
    background: var(--brand-light);
    border-radius: 100px;
    margin-bottom: 2.5rem;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--brand);
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.brand-badge .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--brand);
    animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.8); }
}

.lang-switcher {
    display: flex;
    gap: 2px;
    background: var(--gray-100);
    border-radius: 8px;
    padding: 3px;
}

.lang-btn {
    border: none;
    background: transparent;
    font-family: 'Suisse Intl', 'Helvetica Neue', Arial, sans-serif;
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--gray-500);
    padding: 5px 10px;
    border-radius: 6px;
    cursor: pointer;
    transition: all var(--transition);
    letter-spacing: 0.02em;
}

.lang-btn:hover { color: var(--gray-700); }

.lang-btn.active {
    background: #fff;
    color: var(--gray-900);
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

/* ── Typography ── */
.form-title {
    font-family: 'Suisse Intl', 'Helvetica Neue', Arial, sans-serif;
    font-size: 1.75rem;
    font-weight: 600;
    color: var(--gray-900);
    line-height: 1.15;
    margin-bottom: 0.5rem;
    letter-spacing: -0.02em;
}

.form-subtitle {
    color: var(--gray-500);
    font-size: 0.95rem;
    font-weight: 300;
    margin-bottom: 2rem;
    line-height: 1.5;
}

/* ── Steps ── */
.step {
    display: none;
    animation: stepIn 0.5s var(--transition) forwards;
}

.step.active { display: block; }

@keyframes stepIn {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ── Step indicator ── */
.step-indicator {
    display: flex;
    gap: 8px;
    margin-bottom: 2rem;
}

.step-bar {
    height: 3px;
    flex: 1;
    border-radius: 3px;
    background: var(--gray-200);
    transition: background var(--transition);
}

.step-bar.active { background: var(--brand); }

/* ── Phone input ── */
.phone-field {
    position: relative;
    margin-bottom: 1.5rem;
}

.phone-field .prefix {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    padding: 0 0 0 20px;
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--gray-800);
    pointer-events: none;
    gap: 8px;
}

.flag-emoji {
    font-size: 1.4rem;
    line-height: 1;
}

.input-base {
    width: 100%;
    height: 60px;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius);
    font-family: 'Suisse Intl', 'Helvetica Neue', Arial, sans-serif;
    font-size: 1.1rem;
    color: var(--gray-900);
    background: #fff;
    outline: none;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.input-base:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 4px rgba(161,90,149,0.1);
}

.input-base::placeholder {
    color: var(--gray-300);
    font-weight: 300;
}

.phone-input {
    padding-left: 116px;
    letter-spacing: 0.06em;
}

/* ── Code input ── */
.code-inputs {
    display: flex;
    gap: 10px;
    margin-bottom: 1.5rem;
    justify-content: center;
}

.code-digit {
    width: 48px;
    height: 58px;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius);
    text-align: center;
    font-family: 'Suisse Intl', 'Helvetica Neue', Arial, sans-serif;
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--gray-900);
    background: #fff;
    outline: none;
    transition: all var(--transition);
    caret-color: var(--brand);
}

.code-digit:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 4px rgba(161,90,149,0.1);
    transform: translateY(-2px);
}

.code-digit.filled {
    border-color: var(--brand);
    background: var(--brand-light);
}

/* ── Phone display (step 2) ── */
.phone-display {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--gray-100);
    border-radius: 100px;
    font-size: 0.9rem;
    color: var(--gray-700);
    margin-bottom: 1.5rem;
    font-weight: 500;
}

.phone-display .edit-btn {
    background: none;
    border: none;
    color: var(--brand);
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 600;
    font-family: 'Suisse Intl', 'Helvetica Neue', Arial, sans-serif;
    padding: 2px 6px;
    border-radius: 4px;
    transition: background var(--transition);
}

.phone-display .edit-btn:hover {
    background: var(--brand-subtle);
}

/* ── Submit button ── */
.btn-submit {
    width: 100%;
    height: 56px;
    border: none;
    border-radius: var(--radius);
    background: var(--brand);
    color: #fff;
    font-family: 'Suisse Intl', 'Helvetica Neue', Arial, sans-serif;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: all var(--transition);
    letter-spacing: 0.02em;
}

.btn-submit:hover {
    background: var(--brand-dark);
    transform: translateY(-1px);
    box-shadow: 0 8px 24px rgba(161,90,149,0.25);
}

.btn-submit:active { transform: translateY(0); }

.btn-submit:disabled {
    background: var(--gray-300);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-submit .spinner {
    display: none;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

.btn-submit.loading .btn-text { display: none; }
.btn-submit.loading .spinner { display: inline-block; }

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

/* ── Error ── */
.error-box {
    display: none;
    padding: 12px 16px;
    background: var(--error-bg);
    border: 1px solid rgba(196,75,75,0.15);
    border-radius: 10px;
    color: var(--error);
    font-size: 0.88rem;
    margin-bottom: 1rem;
    line-height: 1.5;
    animation: shake 0.4s ease;
}

.error-box.visible { display: block; }

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-6px); }
    75% { transform: translateX(6px); }
}

/* ── Timer / Resend ── */
.timer-section {
    text-align: center;
    margin-top: 1.25rem;
    font-size: 0.88rem;
    color: var(--gray-500);
    min-height: 24px;
}

.timer-section .countdown { font-variant-numeric: tabular-nums; }

.resend-link {
    background: none;
    border: none;
    color: var(--brand);
    font-family: 'Suisse Intl', 'Helvetica Neue', Arial, sans-serif;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: background var(--transition);
}

.resend-link:hover { background: var(--brand-subtle); }

/* ── Debug panel ── */
.debug-panel {
    display: none;
    margin-top: 1.5rem;
    padding: 14px 18px;
    background: var(--gray-900);
    border-radius: 10px;
    font-size: 0.78rem;
    font-family: 'DM Mono', 'SF Mono', 'Consolas', monospace;
    color: var(--gray-400);
    line-height: 1.8;
}

.debug-panel.visible { display: block; }
.debug-panel .label { color: var(--gray-500); font-weight: 500; }
.debug-panel .value { color: var(--brand); }

/* ── OAuth buttons ── */
.auth-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.auth-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
    height: 54px;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius);
    background: #fff;
    font-family: 'Suisse Intl', 'Helvetica Neue', Arial, sans-serif;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--gray-900);
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
}

.auth-btn:hover {
    border-color: var(--gray-300);
    background: var(--gray-50);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.06);
}

.auth-btn:active { transform: translateY(0); }

.auth-btn svg { width: 20px; height: 20px; flex-shrink: 0; }

.auth-btn--google:hover { border-color: #4285f4; }
.auth-btn--apple:hover { border-color: var(--gray-900); }
.auth-btn--humans:hover { border-color: var(--brand); }
.auth-btn--nambaone:hover { border-color: #636B79; }

/* ── Divider ── */
.divider {
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 8px 0;
    color: var(--gray-400);
    font-size: 0.82rem;
}

.divider::before, .divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--gray-200);
}

/* ── Footer ── */
.footer-links {
    margin-top: 2.5rem;
    text-align: center;
    font-size: 0.82rem;
    color: var(--gray-400);
    line-height: 1.7;
}

.footer-links a {
    color: var(--gray-600);
    text-decoration: none;
    border-bottom: 1px solid var(--gray-200);
    transition: all var(--transition);
}

.footer-links a:hover {
    color: var(--brand);
    border-color: var(--brand);
}

/* ── Responsive ── */
@media (max-width: 900px) {
    .pattern-panel { display: none; }

    body {
        display: block;
        overflow-x: hidden;
        overflow-y: auto;
        min-height: 100vh;
        min-height: 100dvh;
    }

    .form-panel {
        width: 100%;
        min-height: 100vh;
        min-height: 100dvh;
        padding: 2rem 1.5rem;
        align-items: flex-start;
        overflow: hidden;
    }

    .form-panel::before { display: none; }

    .form-wrapper {
        max-width: 420px;
        margin: 0 auto;
    }

    .top-bar { margin-bottom: 1.5rem; }
    .step-indicator { margin-bottom: 1.5rem; }
    .form-title { font-size: 1.75rem; }
    .form-subtitle { margin-bottom: 1.5rem; font-size: 0.9rem; }
    .btn-submit { height: 52px; }
    .footer-links { margin-top: 2rem; }
    .phone-field { margin-bottom: 1.25rem; }
    .input-base { height: 54px; font-size: 1rem; }
    .phone-input { padding-left: 100px; }
    .prefix { font-size: 1rem; padding-left: 16px; }
    .auth-btn { height: 50px; font-size: 0.9rem; }
}

@media (max-width: 380px) {
    .form-panel { padding: 1.5rem 1.25rem; }
    .form-title { font-size: 1.5rem; }
    .code-digit { width: 42px; height: 50px; font-size: 1.2rem; }
    .code-inputs { gap: 6px; }
    .phone-input { padding-left: 94px; }
    .prefix { font-size: 0.95rem; gap: 6px; padding-left: 14px; }
    .flag-emoji { font-size: 1.2rem; }
}

/* ── Entrance animations ── */
.form-wrapper > * {
    opacity: 0;
    animation: fadeUp 0.6s ease forwards;
}

.form-wrapper > *:nth-child(1) { animation-delay: 0.1s; }
.form-wrapper > *:nth-child(2) { animation-delay: 0.15s; }
.form-wrapper > *:nth-child(3) { animation-delay: 0.2s; }
.form-wrapper > *:nth-child(4) { animation-delay: 0.25s; }
.form-wrapper > *:nth-child(5) { animation-delay: 0.3s; }
.form-wrapper > *:nth-child(6) { animation-delay: 0.35s; }
.form-wrapper > *:nth-child(7) { animation-delay: 0.4s; }

@keyframes fadeUp {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}
