.profiles-page {
    --profile-ink: #f4f6ff;
    --profile-muted: #aab3ca;
    --profile-panel: rgba(25, 34, 61, 0.92);
    min-height: 100vh;
    color: var(--profile-ink);
    background:
        radial-gradient(ellipse at 50% 0, rgba(67, 91, 210, 0.25), transparent 48%),
        linear-gradient(145deg, #0b1020 0%, #101a36 55%, #0b1020 100%);
}

.profiles-topbar {
    min-height: 82px;
    padding: 16px clamp(20px, 5vw, 72px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.profiles-brand img {
    display: block;
    width: 148px;
    max-height: 48px;
    object-fit: contain;
}

.profiles-topbar-actions {
    display: flex;
    align-items: center;
    gap: 24px;
}

.profiles-account-link,
.profiles-logout {
    color: var(--profile-muted);
    font-size: 0.9rem;
    font-weight: 600;
}

.profiles-account-link:hover,
.profiles-logout:hover {
    color: #fff;
}

.profiles-main {
    width: min(1120px, calc(100% - 40px));
    margin: 0 auto;
    padding: clamp(68px, 11vh, 124px) 0 72px;
    text-align: center;
}

.profiles-eyebrow {
    margin: 0 0 14px;
    color: #93a8ff;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.2em;
}

.profiles-main h1 {
    margin: 0;
    color: var(--profile-ink);
    font-size: clamp(2.1rem, 5vw, 3.25rem);
    font-weight: 800;
    letter-spacing: -0.04em;
}

.profiles-intro {
    margin: 14px 0 42px;
    color: var(--profile-muted);
    font-size: 1.05rem;
}

.profiles-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 24px;
}

.profile-tile {
    width: 158px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
}

.profile-pick,
.profile-add-tile {
    min-height: 188px;
    padding: 12px 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    border: 1px solid transparent;
    border-radius: 20px;
    color: var(--profile-ink);
    background: transparent;
    cursor: pointer;
    transition: transform 180ms ease, border-color 180ms ease, background 180ms ease;
}

.profile-pick:hover,
.profile-pick:focus-visible,
.profile-tile.is-active .profile-pick {
    border-color: rgba(154, 174, 255, 0.58);
    background: rgba(54, 73, 139, 0.24);
    transform: translateY(-4px);
    outline: none;
}

.profiles-avatar {
    width: 112px;
    height: 112px;
    display: grid;
    place-items: center;
    border: 3px solid rgba(255, 255, 255, 0.22);
    border-radius: 28px;
    background: linear-gradient(145deg, #5778ed, #9d67d8);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.28);
    font-size: 3.3rem;
    line-height: 1;
}

.profiles-avatar-cat,
.profiles-avatar-panda,
.profiles-avatar-owl {
    background: linear-gradient(145deg, #62a7dd, #7778e8);
}

.profiles-avatar-astronaut,
.profiles-avatar-robot,
.profiles-avatar-rocket {
    background: linear-gradient(145deg, #4567b8, #37a7b0);
}

.profiles-avatar-unicorn,
.profiles-avatar-star {
    background: linear-gradient(145deg, #b46bda, #e37baf);
}

.profiles-avatar-dinosaur,
.profiles-avatar-dragon,
.profiles-avatar-bear {
    background: linear-gradient(145deg, #e78a48, #c95565);
}

.profile-tile-name {
    overflow: hidden;
    max-width: 100%;
    color: var(--profile-ink);
    font-size: 1rem;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.profile-tile-meta {
    min-height: 20px;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
}

.profile-kids-badge,
.profile-lock-badge,
.profile-current-badge {
    padding: 3px 7px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 999px;
    color: #c8d2ff;
    font-size: 0.62rem;
    font-weight: 800;
    letter-spacing: 0.06em;
}

.profile-kids-badge {
    color: #192747;
    background: #f0c468;
}

.profile-current-badge {
    color: #b8f2d3;
}

.profile-tile-actions {
    display: flex;
    justify-content: center;
    gap: 12px;
}

.profile-edit-button,
.profile-delete-button,
.profiles-recover-link {
    padding: 4px 2px;
    border: 0;
    color: #aabaff;
    background: transparent;
    font: inherit;
    font-size: 0.78rem;
    cursor: pointer;
}

.profile-delete-button {
    color: #efa3aa;
}

.profile-edit-button:hover,
.profile-delete-button:hover,
.profiles-recover-link:hover {
    text-decoration: underline;
}

.profile-delete-button:disabled {
    color: #737d94;
    cursor: not-allowed;
    text-decoration: none;
}

.profile-add-tile {
    width: 158px;
    border-color: rgba(169, 185, 231, 0.22);
    color: #c1c9dd;
    font-size: 0.95rem;
    font-weight: 700;
}

.profile-add-tile:hover,
.profile-add-tile:focus-visible {
    border-color: rgba(154, 174, 255, 0.72);
    background: rgba(54, 73, 139, 0.2);
    outline: none;
}

.profile-add-icon {
    width: 96px;
    height: 96px;
    display: grid;
    place-items: center;
    border: 2px dashed rgba(192, 204, 244, 0.5);
    border-radius: 26px;
    color: #d3dcff;
    font-size: 3.5rem;
    font-weight: 300;
    line-height: 1;
}

.profiles-continue,
.profiles-save {
    min-height: 46px;
    padding: 0 24px;
    border: 0;
    border-radius: 12px;
    color: #fff;
    background: linear-gradient(110deg, #385cda, #6755d7);
    box-shadow: 0 8px 24px rgba(40, 65, 170, 0.28);
    font: inherit;
    font-weight: 800;
    cursor: pointer;
}

.profiles-continue {
    margin-top: 34px;
}

.profiles-continue:hover,
.profiles-save:hover {
    filter: brightness(1.12);
}

.profiles-save:disabled {
    opacity: 0.6;
    cursor: wait;
}

.profiles-hint {
    margin: 26px 0 0;
    color: #8893ad;
    font-size: 0.82rem;
}

.profiles-empty {
    width: min(440px, 100%);
    padding: 28px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.035);
}

.profiles-empty > span {
    display: block;
    margin-bottom: 12px;
    font-size: 2.5rem;
}

.profiles-empty h2 {
    margin: 0 0 8px;
    color: var(--profile-ink);
    font-size: 1.25rem;
}

.profiles-empty p,
.profiles-modal > p:not(.profiles-eyebrow) {
    margin: 0;
    color: var(--profile-muted);
}

.profiles-loading,
.profiles-error {
    color: var(--profile-muted);
}

.profiles-modal-backdrop {
    position: fixed;
    z-index: 1000;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 20px;
    background: rgba(4, 7, 17, 0.78);
    backdrop-filter: blur(10px);
}

.profiles-modal {
    position: relative;
    width: min(620px, 100%);
    max-height: min(90vh, 840px);
    overflow-y: auto;
    padding: 34px;
    border: 1px solid rgba(178, 193, 245, 0.2);
    border-radius: 24px;
    color: var(--profile-ink);
    background: var(--profile-panel);
    box-shadow: 0 28px 90px rgba(0, 0, 0, 0.52);
}

.profiles-modal h2 {
    margin: 0 0 24px;
    color: var(--profile-ink);
    font-size: 1.75rem;
}

.profiles-modal-close {
    position: absolute;
    top: 14px;
    right: 16px;
    width: 38px;
    height: 38px;
    border: 0;
    border-radius: 50%;
    color: #d4dcf4;
    background: rgba(255, 255, 255, 0.08);
    font-size: 1.6rem;
    line-height: 1;
    cursor: pointer;
}

.profile-editor-form {
    display: grid;
    gap: 16px;
}

.profiles-field {
    display: grid;
    gap: 7px;
    color: #e5e9f7;
    font-size: 0.88rem;
    font-weight: 700;
    text-align: left;
}

.profiles-field input,
.profiles-field select {
    width: 100%;
    min-height: 46px;
    padding: 0 13px;
    border: 1px solid rgba(192, 204, 244, 0.2);
    border-radius: 10px;
    color: #fff;
    background: rgba(6, 10, 24, 0.55);
    font: inherit;
}

.profiles-field input:focus,
.profiles-field select:focus {
    border-color: #8ea2ff;
    outline: 2px solid rgba(104, 130, 255, 0.25);
}

.profile-avatar-picker {
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
    text-align: left;
}

.profile-avatar-picker legend {
    margin-bottom: 10px;
    color: #e5e9f7;
    font-size: 0.88rem;
    font-weight: 700;
}

.profile-avatar-options {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 8px;
}

.profile-avatar-option {
    min-height: 78px;
    display: grid;
    place-items: center;
    padding: 6px 2px;
    border: 1px solid rgba(192, 204, 244, 0.12);
    border-radius: 12px;
    color: #dfe5fa;
    background: rgba(255, 255, 255, 0.035);
    cursor: pointer;
}

.profile-avatar-option.selected,
.profile-avatar-option:focus-within {
    border-color: #92a6ff;
    background: rgba(76, 98, 191, 0.26);
}

.profile-avatar-option input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
}

.profile-avatar-option > span {
    font-size: 1.8rem;
}

.profile-avatar-option small {
    font-size: 0.62rem;
}

.profile-kids-toggle {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border: 1px solid rgba(192, 204, 244, 0.12);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.035);
    cursor: pointer;
}

.profile-kids-toggle input {
    width: 18px;
    height: 18px;
    accent-color: #6d82f0;
}

.profile-kids-toggle span {
    display: grid;
    gap: 2px;
    color: #edf0fc;
    font-size: 0.86rem;
}

.profile-kids-toggle small {
    color: var(--profile-muted);
    font-size: 0.76rem;
    font-weight: 400;
}

.profiles-pin-fields {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.profiles-pin-fields.is-hidden {
    display: none;
}

.profiles-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 8px;
}

.profiles-cancel {
    min-height: 44px;
    padding: 0 18px;
    border: 1px solid rgba(192, 204, 244, 0.2);
    border-radius: 10px;
    color: #d5dcef;
    background: transparent;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.profiles-pin-modal {
    width: min(440px, 100%);
    text-align: center;
}

.profiles-pin-modal h2 {
    margin-bottom: 10px;
    font-size: 1.4rem;
}

.profiles-modal-avatar {
    width: 82px;
    height: 82px;
    display: grid;
    place-items: center;
    margin: 0 auto 18px;
    border-radius: 24px;
    background: linear-gradient(145deg, #5778ed, #9d67d8);
    font-size: 2.6rem;
}

.profiles-pin-modal .profile-editor-form {
    margin-top: 22px;
}

.profiles-pin-modal .profiles-modal-actions {
    width: 100%;
}

.profiles-pin-modal .profiles-save,
.profiles-pin-modal .profiles-cancel {
    flex: 1;
}

.profiles-recover-link {
    justify-self: center;
    font-size: 0.86rem;
}

@media (max-width: 640px) {
    .profiles-topbar {
        min-height: 68px;
        padding: 12px 18px;
    }

    .profiles-brand img {
        width: 120px;
    }

    .profiles-main {
        width: min(100% - 28px, 500px);
        padding-top: 72px;
    }

    .profiles-grid {
        gap: 12px;
    }

    .profile-tile,
    .profile-add-tile {
        width: 132px;
    }

    .profile-pick,
    .profile-add-tile {
        min-height: 160px;
    }

    .profiles-avatar {
        width: 92px;
        height: 92px;
        border-radius: 24px;
        font-size: 2.8rem;
    }

    .profile-add-icon {
        width: 80px;
        height: 80px;
        border-radius: 22px;
    }

    .profiles-modal {
        padding: 28px 20px 22px;
    }

    .profile-avatar-options {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

@media (prefers-reduced-motion: reduce) {
    .profile-pick,
    .profile-add-tile {
        transition: none;
    }
}
