* { box-sizing: border-box; }

body {
    display: flex;
    min-height: 100vh;
    align-items: center;
    justify-content: center;
    margin: 0;
    padding: 16px;
    direction: rtl;
    color: var(--text);
    background: var(--canvas);
}

.modal,
.terms-page {
    width: min(100%, 440px);
    padding: 24px;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-card);
    background: var(--surface);
    box-shadow: var(--shadow-card);
}

.form-header { margin-bottom: 20px; text-align: center; }
.auth-brand { display: inline-flex; align-items: center; gap: 8px; margin: 3px auto 17px; color: #171a13; font-size: 1.35rem; font-weight: 900; letter-spacing: -.07em; direction: ltr; }
.auth-brand img { width: 38px; height: 38px; border-radius: 50%; object-fit: cover; }
.auth-brand span { color: #91b628; }
.welcome-title { margin: 0 0 6px; color: #0f172a; font-size: 1.2rem; }
.welcome-subtitle { margin: 0; color: #64748b; font-size: .875rem; }

.auth-form { display: grid; gap: 12px; }
.auth-form input:not([type="hidden"]):not([type="checkbox"]),
.auth-form select,
.auth-form textarea {
    width: 100%;
    min-height: 44px;
    padding: 11px 13px;
    border: 1px solid var(--border);
    border-radius: var(--radius-control);
    color: var(--text);
    background: var(--surface);
    font: inherit;
    transition: border-color .15s ease, box-shadow .15s ease;
}

.auth-form input:focus,
.auth-form select:focus,
.auth-form textarea:focus {
    border-color: var(--brand);
    outline: 0;
    box-shadow: 0 0 0 3px rgb(37 99 235 / 14%);
}

.password-wrapper { position: relative; width: 100%; }
.password-wrapper input { padding-left: 44px !important; }
.toggle-password { position: absolute; top: 50%; left: 11px; display: grid; place-items: center; padding: 0; border: 0; background: transparent; transform: translateY(-50%); cursor: pointer; }
.toggle-password img { display: block; width: 20px; height: 20px; }

.submit-btn {
    width: 100%;
    min-height: 44px;
    margin-top: 4px;
    padding: 10px 14px;
    border: 0;
    border-radius: 9px;
    color: #fff;
    background: var(--brand);
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    transition: background-color .15s ease, transform .15s ease;
}
.submit-btn:hover { background: var(--brand-hover); }
.submit-btn:active { transform: translateY(1px); }
.auth-link { display: block; margin-top: 6px; color: #1d4ed8; text-align: center; text-decoration: none; }
.auth-link:hover { text-decoration: underline; }

.alert { margin: 0 0 14px; padding: 10px 13px; border: 1px solid #bfdbfe; border-radius: var(--radius-control); color: #1e40af; background: #eff6ff; line-height: 1.7; }
.alert-error { border-color: #fecaca; color: #991b1b; background: #fef2f2; }
.alert-success { border-color: #bbf7d0; color: #166534; background: #f0fdf4; }
.hidden { display: none !important; }

#verify-human-code {
    width: 100%;
    padding: 12px;
    border: 1px dashed #9ca3af;
    border-radius: 8px;
    background: repeating-linear-gradient(45deg, #f3f4f6, #f3f4f6 10px, #e5e7eb 10px, #e5e7eb 20px);
    color: #1f2937;
    font: 700 20px 'Courier New', monospace;
    letter-spacing: 6px;
    text-align: center;
    user-select: none;
    cursor: pointer;
}

.terms-page { box-sizing: border-box; width: min(100%, 700px); min-width: 0; text-align: right; }
.terms-page > .academy-logo {
    display: block;
    width: min(100%, 180px);
    max-height: 140px;
    height: auto;
    margin: 0 auto 16px;
    object-fit: contain;
}
.terms-page h1 { margin: 0 0 20px; color: #0f172a; text-align: center; }
.terms-placeholder { padding: 18px; border: 1px dashed #94a3b8; border-radius: 12px; color: #475569; line-height: 2; }
.terms-placeholder h2 { margin-bottom: 8px; color: #0f4c81; font-size: 1.05rem; }
.terms-placeholder ol { margin-top: 12px; padding-right: 22px; }

@media (max-width: 480px) {
    .modal, .terms-page { padding: 16px; }
    .terms-page { box-sizing: border-box; min-width: 0; }
    .terms-page > .academy-logo { width: min(100%, 132px); max-height: 104px; }
    .terms-placeholder { overflow-wrap: anywhere; }
}

.captcha-refresh {
    display: grid;
    width: 36px;
    height: 36px;
    place-items: center;
    padding: 0;
    border: 0;
    border-radius: 8px;
    background: transparent;
    cursor: pointer;
}
.captcha-refresh:hover { background: #eff6ff; }
.captcha-refresh img { display: block; width: 21px; height: 21px; object-fit: contain; }