.ta-profile-edit {
    --ta-pe-bg: #f9f9fb;
    --ta-pe-surface: #fff;
    --ta-pe-input: #f0f0f5;
    --ta-pe-primary: #000;
    --ta-pe-text: #1d1d1f;
    --ta-pe-muted: #86868b;
    --ta-pe-accent: #ff2d55;
    --ta-pe-prefix-border: rgba(0, 0, 0, 0.08);
    --ta-pe-prefix-bg: var(--ta-pe-input);
    min-height: 100%;
    background: var(--ta-pe-bg);
    color: var(--ta-pe-text);
    display: flex;
    flex-direction: column;
    position: relative;
}

html[data-lp-color-scheme="dark"] .ta-profile-edit {
    --ta-pe-bg: #0a0a0a;
    --ta-pe-surface: #161616;
    --ta-pe-input: #222;
    --ta-pe-primary: #fff;
    --ta-pe-text: #f5f5f7;
    --ta-pe-muted: rgba(255, 255, 255, 0.55);
    --ta-pe-prefix-border: rgba(255, 255, 255, 0.14);
    --ta-pe-prefix-bg: rgba(255, 255, 255, 0.06);
}

.ta-profile-edit__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    position: sticky;
    top: 0;
    z-index: 20;
    background: color-mix(in srgb, var(--ta-pe-bg) 88%, transparent);
    backdrop-filter: blur(12px);
}

.ta-profile-edit__title {
    font-size: 17px;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin: 0;
}

.ta-profile-edit__spacer {
    width: 40px;
}

.ta-profile-edit__back {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--ta-pe-input);
    color: var(--ta-pe-text);
    text-decoration: none;
}

.ta-profile-edit__content {
    flex: 1;
    overflow-y: auto;
    padding: 8px 20px 24px;
}

.ta-profile-edit:has(.ta-profile-edit__fab.is-visible) .ta-profile-edit__content {
    padding-bottom: 120px;
}

.ta-profile-edit__avatar-block {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 8px 0 24px;
}

.ta-profile-edit__avatar-wrap {
    position: relative;
    width: 112px;
    height: 112px;
}

.ta-profile-edit__avatar,
.ta-profile-edit__avatar-fallback {
    width: 112px;
    height: 112px;
    border-radius: 50%;
    object-fit: cover;
}

.ta-profile-edit__avatar-fallback {
    display: grid;
    place-items: center;
    font-size: 2.5rem;
    font-weight: 700;
    background: linear-gradient(145deg, #ff6b62, #ff3b30);
    color: #fff;
}

.ta-profile-edit__avatar-pencil {
    position: absolute;
    right: 0;
    bottom: 0;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    padding: 0;
    background: var(--ta-pe-primary);
    color: var(--ta-pe-bg);
    display: grid;
    place-items: center;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2);
}

.ta-profile-edit__avatar-hint {
    margin: 10px 0 0;
    font-size: 12px;
    color: var(--ta-pe-muted);
    font-weight: 600;
}

.ta-profile-edit__section-title {
    font-size: 20px;
    font-weight: 700;
    margin: 28px 0 8px;
    letter-spacing: -0.03em;
}

.ta-profile-edit__section-lead {
    font-size: 14px;
    color: var(--ta-pe-muted);
    margin: 0 0 16px;
    font-weight: 500;
}

.ta-profile-edit__field {
    margin-bottom: 18px;
    position: relative;
}

.ta-profile-edit__birth-row {
    display: flex;
    gap: 12px;
    margin-bottom: 0;
}

.ta-profile-edit__field-hint-inline {
    text-transform: none;
    font-weight: 500;
    letter-spacing: normal;
}

.ta-profile-edit__field--half {
    flex: 1 1 0;
    min-width: 0;
    margin-bottom: 0;
}

.ta-profile-edit__field label,
.ta-profile-edit__field-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--ta-pe-muted);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.ta-profile-edit__input-prefix-wrap {
    position: relative;
    display: flex;
    align-items: stretch;
    width: 100%;
}

.ta-profile-edit__input-prefix {
    display: inline-flex;
    align-items: center;
    padding: 0 10px 0 12px;
    border: 1px solid var(--ta-pe-prefix-border);
    border-right: 0;
    border-radius: 10px 0 0 10px;
    background: var(--ta-pe-prefix-bg);
    color: var(--ta-pe-primary);
    font-weight: 700;
    font-size: 0.95rem;
}

.ta-profile-edit__input--prefixed {
    border-radius: 0 10px 10px 0;
    flex: 1 1 auto;
    min-width: 0;
    padding-right: 2.8rem;
}

.ta-profile-edit__username-state {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.25rem;
    height: 1.25rem;
    color: var(--ta-pe-muted);
    pointer-events: none;
}

.ta-profile-edit__username-state.is-ok {
    color: #22c55e;
}

.ta-profile-edit__username-state.is-bad {
    color: #ef4444;
}

.ta-profile-edit__username-state.is-loading {
    color: var(--ta-pe-muted);
}

.ta-profile-edit__input,
.ta-profile-edit__textarea {
    width: 100%;
    padding: 16px;
    background: var(--ta-pe-surface);
    border: 2px solid transparent;
    border-radius: 16px;
    font-size: 16px;
    font-weight: 500;
    color: var(--ta-pe-text);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.03);
}

.ta-profile-edit__input:focus,
.ta-profile-edit__textarea:focus {
    outline: none;
    border-color: var(--ta-pe-primary);
}

.ta-profile-edit__input[readonly] {
    opacity: 0.65;
}

.ta-profile-edit__textarea {
    resize: none;
    min-height: 100px;
    line-height: 1.45;
}

.ta-profile-edit__char-count {
    position: absolute;
    right: 14px;
    bottom: 12px;
    font-size: 12px;
    font-weight: 600;
    color: var(--ta-pe-muted);
}

.ta-profile-edit__char-count.is-limit {
    color: var(--ta-pe-accent);
}

.ta-profile-edit__hint {
    display: block;
    margin-top: 6px;
    font-size: 12px;
    color: var(--ta-pe-muted);
}

.ta-profile-edit__chips {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 8px;
}

.ta-profile-edit__chip {
    cursor: pointer;
}

.ta-profile-edit__chip input {
    display: none;
}

.ta-profile-edit__chip.ta-pill {
    padding: 10px 18px;
    font-size: 0.9rem;
    font-weight: 500;
    box-shadow: none;
}

html[data-lp-color-scheme="dark"] .ta-profile-edit__chip.ta-pill {
    background-color: #ffffff;
    color: #000000;
    border: 1px solid #e2e8f0;
}

html[data-lp-color-scheme="dark"] .ta-profile-edit__chip.ta-pill:hover:not(:has(input:checked)) {
    background-color: #f8fafc;
    border-color: #cbd5e1;
}

html[data-lp-color-scheme="dark"] .ta-profile-edit__chip.ta-pill:has(input:checked) {
    background-color: #000000;
    color: #ffffff;
    border-color: #000000;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

html[data-lp-color-scheme="light"] .ta-profile-edit__chip.ta-pill {
    background-color: #ffffff;
    color: #0f172a;
    border-color: #e2e8f0;
}

html[data-lp-color-scheme="light"] .ta-profile-edit__chip.ta-pill:hover:not(:has(input:checked)) {
    background-color: #f8fafc;
    border-color: #cbd5e1;
}

html[data-lp-color-scheme="light"] .ta-profile-edit__chip.ta-pill:has(input:checked) {
    background-color: #0f172a;
    color: #ffffff;
    border-color: #0f172a;
    box-shadow: 0 4px 15px rgba(15, 23, 42, 0.12);
}

.ta-profile-edit__divider {
    height: 1px;
    margin: 32px 0;
    background: linear-gradient(90deg, transparent, rgba(0, 0, 0, 0.06), transparent);
}

html[data-lp-color-scheme="dark"] .ta-profile-edit__divider {
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.08), transparent);
}

.ta-profile-edit__fab-wrap {
    position: sticky;
    bottom: 0;
    left: 0;
    width: 100%;
    z-index: 85;
    height: 0;
    padding: 0;
    overflow: hidden;
    pointer-events: none;
    background: none;
}

.ta-profile-edit__fab-wrap:has(.ta-profile-edit__fab.is-visible) {
    position: fixed;
    left: 0;
    right: 0;
    bottom: calc(var(--ta-nav-h, 92px) + env(safe-area-inset-bottom, 0px));
    height: auto;
    padding: 12px 20px 16px;
    overflow: visible;
    pointer-events: auto;
    background: linear-gradient(to top, var(--ta-pe-bg) 82%, transparent);
    z-index: 90;
}

/* Bottom-nav glass matches profile-edit surface (not feed-dark gradient). */
html:not([data-lp-color-scheme="dark"]) body:has(#ta-profile-edit) .ta-tiktok-nav.ta-ng-bottom-nav {
    background: linear-gradient(0deg, rgba(249, 249, 251, 0.98) 0%, rgba(249, 249, 251, 0.55) 52%, rgba(249, 249, 251, 0) 100%) !important;
}

html[data-lp-color-scheme="dark"] body:has(#ta-profile-edit) .ta-tiktok-nav.ta-ng-bottom-nav {
    background: linear-gradient(0deg, rgba(10, 10, 10, 0.98) 0%, rgba(10, 10, 10, 0.55) 52%, rgba(10, 10, 10, 0) 100%) !important;
}

.ta-profile-edit__fab {
    width: 100%;
    padding: 16px;
    border: none;
    border-radius: 999px;
    background: var(--ta-pe-primary);
    color: var(--ta-pe-bg);
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transform: translateY(16px);
    transition: transform 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.1), opacity 0.2s ease, background 0.2s ease;
    opacity: 0;
    pointer-events: none;
}

.ta-profile-edit__fab.is-visible {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
}

.ta-profile-edit__fab.is-success {
    background: #34c759;
    color: #fff;
}

.ta-social-profile__avatar-wrap {
    position: relative;
}

.ta-social-profile__avatar-edit {
    position: absolute;
    right: 2px;
    bottom: 2px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #111;
    color: #fff;
    display: grid;
    place-items: center;
    text-decoration: none;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
    z-index: 2;
}

html:not([data-lp-color-scheme="dark"]) .ta-social-profile__avatar-edit {
    background: #0f172a;
}
