/* Sign-in, registration and profile */
.account-page {
    display: grid;
    place-items: start center;
    min-height: calc(100dvh - var(--header-height) - 120px);
    padding: 48px var(--gutter) 72px;
}

.account-card {
    width: 100%;
    max-width: 620px;
    padding: 36px;
    border: 1px solid var(--line);
    border-radius: 24px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.account-card-narrow { max-width: 440px; }

.account-head { margin-bottom: 26px; }

.account-head h1 {
    margin: 0 0 8px;
    font-family: var(--serif);
    font-size: clamp(28px, 4vw, 38px);
    font-weight: 600;
    line-height: 1.15;
    letter-spacing: -0.01em;
}

.account-head p { margin: 0; color: var(--muted); font-size: 15.5px; line-height: 1.55; }

.account-head-profile {
    display: flex;
    align-items: center;
    gap: 18px;
}

.account-head-profile h1 { margin-bottom: 4px; font-size: clamp(24px, 3.5vw, 32px); }

.account-head-profile p { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }

.account-email { overflow-wrap: anywhere; }

.account-icon {
    display: grid;
    place-items: center;
    width: 54px;
    height: 54px;
    margin-bottom: 18px;
    border-radius: 16px;
    background: color-mix(in srgb, var(--accent) 12%, transparent);
    color: var(--accent);
}

.account-icon svg { width: 28px; height: 28px; }

.account-notice {
    padding: 12px 14px;
    border: 1px solid var(--tip-line);
    border-radius: 12px;
    background: var(--tip);
    color: var(--ink) !important;
}

.account-success {
    margin: 0 0 22px;
    padding: 12px 14px;
    border-radius: 12px;
    background: var(--good-soft);
    color: var(--good);
    font-size: 15px;
    font-weight: 600;
}

.account-form { display: grid; gap: 18px; }

.field-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.field { display: grid; gap: 6px; min-width: 0; }

.field > span, .gender-picker legend {
    color: var(--ink);
    font-size: 14.5px;
    font-weight: 600;
}

.field b, .gender-picker legend b { color: var(--bad); font-weight: 700; }

.field input {
    width: 100%;
    height: 48px;
    padding: 0 14px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--bg);
    color: var(--ink);
    font: inherit;
    font-size: 16px;
    transition: border-color .15s, box-shadow .15s;
}

.field input:focus {
    border-color: var(--accent);
    outline: none;
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}

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

.field-error { color: var(--bad); font-size: 13.5px; font-weight: 500; line-height: 1.4; }

.field-hint { color: var(--muted); font-size: 13.5px; line-height: 1.4; }

.check {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--muted);
    font-size: 15px;
    cursor: pointer;
}

.check input { width: 18px; height: 18px; accent-color: var(--accent); }

.check-small { font-size: 14px; }

.account-submit {
    justify-content: center;
    width: 100%;
    border: 0;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}

.account-actions { display: flex; flex-wrap: wrap; gap: 12px; }

.account-actions .button { flex: 1 1 200px; justify-content: center; }

.account-switch {
    margin: 22px 0 0;
    color: var(--muted);
    font-size: 15px;
    text-align: center;
}

.account-switch a { font-weight: 600; }

.account-logout { margin-top: 26px; padding-top: 22px; border-top: 1px solid var(--line); }

.account-logout button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 0;
    border: 0;
    background: none;
    color: var(--bad);
    font: inherit;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
}

/* Google and Telegram sign-in */
.account-head-center { display: grid; justify-items: center; text-align: center; }

.account-head-center .avatar { margin-bottom: 16px; }

.account-error {
    margin: 0 0 18px;
    padding: 12px 14px;
    border-radius: 12px;
    background: var(--bad-soft);
    color: var(--bad);
    font-size: 15px;
    font-weight: 600;
}

.social-buttons { display: grid; gap: 12px; }

.social-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
    height: 56px;
    padding: 0 20px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--surface);
    color: var(--ink);
    font: inherit;
    font-size: 16.5px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: transform .15s, box-shadow .15s, border-color .15s;
}

.social-button svg { width: 24px; height: 24px; stroke: none; }

.social-button:hover { box-shadow: var(--shadow); transform: translateY(-1px); }

.social-google:hover { border-color: #4285f4; }

.social-telegram { border-color: #229ed9; background: #229ed9; color: #fff; }

.social-telegram:hover { background: #1d8cc2; }

.social-button[aria-disabled="true"] { opacity: .55; }

.account-fineprint {
    margin: 20px 0 0;
    color: var(--muted);
    font-size: 13.5px;
    line-height: 1.5;
    text-align: center;
}

.account-provider {
    padding: 2px 10px;
    border-radius: 999px;
    background: var(--surface-2);
    color: var(--muted);
    font-size: 12.5px;
    font-weight: 600;
}

.gender-choice {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.gender-choice-button {
    display: grid;
    justify-items: center;
    gap: 10px;
    padding: 24px 12px 20px;
    border: 2px solid var(--line);
    border-radius: 18px;
    background: var(--bg);
    color: var(--ink);
    font: inherit;
    font-size: 17px;
    font-weight: 700;
    cursor: pointer;
    transition: border-color .15s, background .15s, transform .15s;
}

.gender-choice-button .gender-symbol { width: 60px; height: 60px; font-size: 32px; }

.gender-choice-button:hover {
    border-color: var(--gender-color);
    background: color-mix(in srgb, var(--gender-color) 8%, var(--surface));
    transform: translateY(-2px);
}

.account-logout-center { text-align: center; }

.account-logout-center button { color: var(--muted); font-weight: 500; }

/* Level on the profile */
.profile-level {
    margin: 0 0 24px;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: var(--surface-2);
}

.profile-level-label { margin: 0; color: var(--muted); font-size: 13px; font-weight: 600; }

.profile-level-value { display: flex; align-items: center; gap: 10px; margin: 4px 0 0; font-size: 18px; font-weight: 700; }

.profile-level-value.is-empty { color: var(--muted); }

.profile-level-hint { margin: 10px 0 14px; color: var(--muted); font-size: 13.5px; line-height: 1.5; }

.profile-level-exams { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }

.exam-chip {
    display: grid;
    justify-items: center;
    gap: 2px;
    padding: 10px 4px;
    border: 1px solid color-mix(in srgb, var(--level) 35%, var(--line));
    border-radius: 14px;
    background: var(--surface);
    color: var(--level);
    text-decoration: none;
    transition: transform .15s, background .15s;
}

.exam-chip strong { font-size: 17px; }

.exam-chip small { color: var(--muted); font-size: 11.5px; }

.exam-chip:hover { transform: translateY(-2px); }

.exam-chip.is-done { background: color-mix(in srgb, var(--level) 12%, var(--surface)); }

.exam-chip.is-done small { color: var(--level); font-weight: 700; }

@media (max-width: 420px) {
    .profile-level-exams { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* Avatar picker */
.avatar-picker {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 18px;
    border: 1px dashed var(--line);
    border-radius: 18px;
    background: var(--surface-2);
}

.avatar-picker-preview { position: relative; flex: none; cursor: pointer; }

.avatar-placeholder {
    background: var(--surface) !important;
    color: var(--muted);
    box-shadow: inset 0 0 0 2px var(--line);
}

.avatar-placeholder svg { width: 44%; height: 44%; }

.avatar-picker-badge {
    position: absolute;
    right: -2px;
    bottom: -2px;
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border: 3px solid var(--surface-2);
    border-radius: 50%;
    background: var(--accent);
    color: var(--on-accent);
}

.avatar-picker-badge svg { width: 16px; height: 16px; }

.avatar-picker-text { display: grid; gap: 4px; min-width: 0; }

.avatar-picker-text strong { font-size: 15.5px; }

.avatar-picker-text > span { color: var(--muted); font-size: 13.5px; line-height: 1.45; }

.avatar-picker-button {
    justify-self: start;
    margin-top: 6px;
    padding: 7px 14px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface);
    color: var(--ink);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

.avatar-picker-button:hover { border-color: var(--accent); color: var(--accent); }

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

/* Gender picker */
.gender-picker { margin: 0; padding: 0; border: 0; min-width: 0; }

.gender-picker legend { margin-bottom: 8px; padding: 0; }

.gender-options {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.gender-option {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border: 2px solid var(--line);
    border-radius: 14px;
    background: var(--bg);
    font-weight: 600;
    cursor: pointer;
    transition: border-color .15s, background .15s;
}

.gender-option input { position: absolute; opacity: 0; pointer-events: none; }

.gender-symbol {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: color-mix(in srgb, var(--gender-color) 14%, transparent);
    color: var(--gender-color);
    font-size: 21px;
    line-height: 1;
}

.gender-option:has(input:checked) {
    border-color: var(--gender-color);
    background: color-mix(in srgb, var(--gender-color) 8%, var(--surface));
}

.gender-option:has(input:focus-visible) { outline: 2px solid var(--gender-color); outline-offset: 2px; }

.gender-picker[aria-invalid="true"] .gender-option { border-color: color-mix(in srgb, var(--bad) 55%, var(--line)); }

@media (max-width: 620px) {
    .account-page { padding: 20px 16px 48px; }

    .account-card { padding: 24px 18px; border-radius: 20px; }

    .field-row { grid-template-columns: minmax(0, 1fr); }

    .avatar-picker { gap: 16px; padding: 14px; }
}
