.profile-dashboard {
    --profile-gap: clamp(12px, 1.45vw, 20px);
    --profile-padding: clamp(18px, 2.15vw, 30px);
    --profile-line: #30382e;
    --profile-muted: #a5afa3;
    --profile-ease: cubic-bezier(.22, 1, .36, 1);
    display: grid;
    gap: var(--profile-gap);
    padding-bottom: 8px;
}

.profile-dashboard .profile-title {
    margin: 0 0 3px;
    font-size: clamp(34px, 4.9vw, 54px);
    font-weight: 850;
    letter-spacing: -.065em;
}

.profile-overview,
.profile-stats,
.profile-details {
    display: grid;
    gap: var(--profile-gap);
    min-width: 0;
}

.profile-overview { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); }
.profile-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.profile-details { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.profile-card {
    position: relative;
    min-width: 0;
    border: 1px solid var(--profile-line);
    border-radius: 24px;
    background: #181c18;
    box-shadow: inset 0 1px #ffffff06, 0 10px 26px #0002;
}

.profile-identity,
.profile-wallet {
    isolation: isolate;
    overflow: hidden;
    min-height: 238px;
    padding: var(--profile-padding);
}

.profile-identity {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-end;
    gap: 18px;
    background: linear-gradient(125deg, #202920, #171d17 57%, #131812);
}

.profile-cover {
    position: absolute;
    z-index: -1;
    inset: 0 0 0 24%;
    pointer-events: none;
    overflow: hidden;
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 22%);
    mask-image: linear-gradient(90deg, transparent, #000 22%);
}

.profile-cover::before,
.profile-cover::after {
    content: '';
    position: absolute;
    inset: 0;
}

.profile-cover::before {
    inset: -12px -7px;
    background: url('/miniapp/assets/profile-cover.webp') 74% center / cover no-repeat;
    opacity: .93;
}

.profile-cover::after {
    background: linear-gradient(90deg, #192119, #182018b7 20%, #18201826 57%, transparent 78%),
        linear-gradient(0deg, #151c15, #151c152e 45%, transparent 68%);
}

.profile-avatar {
    display: grid;
    place-items: center;
    width: 64px;
    height: 64px;
    flex: none;
    border: 1px solid #e4ffb349;
    border-radius: 21px;
    background: linear-gradient(145deg, #b8e65e, #6b9332);
    background: linear-gradient(145deg, color-mix(in srgb, var(--accent) 82%, #fff), color-mix(in srgb, var(--accent) 56%, #172311));
    box-shadow: inset 0 1px #ffffff5e, 0 8px 23px #0005;
    color: #15200f;
    font-size: 24px;
    font-weight: 850;
}

.profile-identity-copy { max-width: min(100%, 380px); }

.profile-identity h2 {
    font-size: clamp(26px, 3.15vw, 40px);
    font-weight: 850;
    letter-spacing: -.06em;
    overflow-wrap: anywhere;
    text-shadow: 0 2px 12px #111b10;
}

.profile-handle {
    margin: 5px 0 0;
    color: #bec9b7;
    font-size: 13px;
    overflow-wrap: anywhere;
}

.profile-account {
    display: inline-block;
    max-width: 100%;
    margin-top: 12px;
    padding: 4px 9px;
    border: 1px solid #d1e9c125;
    border-radius: 7px;
    background: #161d16d9;
    color: #c4d0be;
    font-size: 10px;
    letter-spacing: .025em;
    font-weight: 700;
    overflow-wrap: anywhere;
}

.profile-wallet {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    background: radial-gradient(ellipse at 111% 4%, #344826 0%, transparent 66%), linear-gradient(145deg, #252f20, #1a2219);
    border-color: #3a4830;
}

.profile-wallet-art {
    position: absolute;
    z-index: -1;
    top: -38px;
    right: -36px;
    width: min(72%, 310px);
    height: 218px;
    opacity: .7;
    pointer-events: none;
    transform: rotate(-29deg);
}

.profile-wallet-art span {
    position: absolute;
    inset: 23% 5%;
    border: 1px solid #d7ff9f27;
    border-right-color: #d7ff9f75;
    border-radius: 50%;
}

.profile-wallet-art span:nth-child(2) {
    inset: 13% -4%;
    opacity: .67;
}

.profile-wallet-art span:nth-child(3) {
    inset: 3% -13%;
    opacity: .36;
}

.profile-wallet-heading,
.profile-panel-heading {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.profile-wallet-heading h2 {
    color: #d9e6d1;
    font-size: 14px;
    font-weight: 750;
    letter-spacing: -.02em;
}

.profile-icon {
    --profile-icon-color: var(--accent);
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    flex: none;
    border: 1px solid #b9df7830;
    border-color: color-mix(in srgb, var(--profile-icon-color) 22%, transparent);
    border-radius: 12px;
    background: #b9df7814;
    background: color-mix(in srgb, var(--profile-icon-color) 10%, transparent);
    color: var(--profile-icon-color);
}

.profile-icon svg { width: 19px; height: 19px; }
.profile-wallet-heading .profile-icon { width: 33px; height: 33px; border-radius: 10px; }
.profile-wallet-heading .profile-icon svg { width: 17px; height: 17px; }

.profile-wallet-value {
    margin: 9px 0 17px;
    max-width: 100%;
    color: #f2f9e9;
    font-size: clamp(38px, 4.4vw, 56px);
    line-height: 1.08;
    font-weight: 850;
    letter-spacing: -.055em;
    font-variant-numeric: tabular-nums;
    overflow-wrap: anywhere;
    transform-origin: left center;
}

.profile-wallet-value-long { font-size: clamp(26px, 3.1vw, 42px); }

.profile-dashboard .profile-topup {
    position: relative;
    overflow: hidden;
    isolation: isolate;
    margin-top: auto;
    min-height: 46px;
    border-radius: 13px;
    padding: 11px 15px;
    box-shadow: inset 0 1px #ffffff52, 0 5px 16px #0003;
    font-size: 13px;
    font-weight: 850;
    transition: transform .25s var(--profile-ease), filter .2s, box-shadow .25s;
}

.profile-topup svg { width: 17px; height: 17px; stroke-width: 2.25; }

.profile-topup::after {
    content: '';
    position: absolute;
    z-index: -1;
    inset: 0;
    background: linear-gradient(100deg, transparent 25%, #ffffff66 50%, transparent 75%);
    transform: translateX(-100%);
}

.profile-wallet-note {
    margin: 8px 0 0;
    color: #bdcab4;
    font-size: 11px;
}

.profile-metric {
    display: flex;
    align-items: center;
    gap: 13px;
    min-height: 86px;
    padding: 15px 19px;
    text-align: left;
    border-radius: 19px;
    background: linear-gradient(135deg, #1d241c, #191d19);
}

.profile-metric-chart .profile-icon { --profile-icon-color: #92dfc2; }
.profile-metric-heart .profile-icon { --profile-icon-color: #cfb9ff; }
.profile-metric-copy { display: grid; gap: 2px; min-width: 0; }

.profile-metric-copy strong {
    font-size: clamp(17px, 2.4vw, 26px);
    line-height: 1.1;
    font-weight: 850;
    letter-spacing: -.035em;
    font-variant-numeric: tabular-nums;
    overflow-wrap: anywhere;
}

.profile-metric-copy > span {
    color: var(--profile-muted);
    font-size: 12px;
}

.profile-metric-arrow {
    width: 15px;
    height: 15px;
    margin-left: auto;
    align-self: flex-start;
    color: #8e9a89;
}

.profile-panel {
    padding: var(--profile-padding);
}

.profile-panel h2 {
    font-size: clamp(20px, 2.1vw, 25px);
    font-weight: 850;
}

.profile-panel-heading { justify-content: space-between; }
.profile-panel-link { flex-shrink: 0; min-height: 36px; }
.profile-panel-link svg,
.profile-empty .link-button svg { width: 15px; height: 15px; }

.profile-shortcut-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-top: 17px;
}

.profile-shortcut:last-child:nth-child(odd) { grid-column: 1 / -1; }

.profile-shortcut {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
    gap: 10px;
    min-width: 0;
    min-height: 100px;
    padding: 12px;
    border: 1px solid #333a31;
    border-radius: 15px;
    background: #202621;
    text-align: left;
}

.profile-shortcut-referral .profile-icon { --profile-icon-color: #cfb9ff; }
.profile-shortcut-giveaways .profile-icon { --profile-icon-color: #f4bf7b; }
.profile-shortcut-info .profile-icon { --profile-icon-color: #92dfc2; }
.profile-shortcut-admin .profile-icon { --profile-icon-color: #f1c889; }
.profile-shortcut .profile-icon,
.profile-preference .profile-icon { width: 33px; height: 33px; border-radius: 10px; }
.profile-shortcut .profile-icon svg,
.profile-preference .profile-icon svg { width: 16px; height: 16px; }

.profile-shortcut-arrow {
    width: 15px;
    height: 15px;
    margin-top: 3px;
    color: #98a394;
}

.profile-shortcut-copy,
.profile-preference-copy {
    display: grid;
    gap: 3px;
    min-width: 0;
    overflow-wrap: anywhere;
}

.profile-shortcut-copy { grid-column: 1 / -1; }
.profile-shortcut-copy strong,
.profile-preference-copy strong { font-size: 13px; font-weight: 800; line-height: 1.3; }
.profile-shortcut-copy > span,
.profile-preference-copy > span { color: var(--profile-muted); font-size: 11px; line-height: 1.4; }

.profile-activity { display: flex; flex-direction: column; }

.profile-empty {
    display: grid;
    justify-items: center;
    align-content: center;
    flex: 1;
    gap: 5px;
    min-height: 201px;
    padding: 20px 10px 6px;
    text-align: center;
}

.profile-empty-icon {
    position: relative;
    display: grid;
    place-items: center;
    width: 52px;
    height: 52px;
    margin: 0 0 10px;
    border: 1px solid #576842;
    border-radius: 17px;
    background: linear-gradient(140deg, #323e2a, #222a1f);
    color: var(--accent);
}

.profile-empty-icon::after {
    content: '';
    position: absolute;
    inset: -6px;
    border: 1px solid #bde6751b;
    border-radius: 22px;
}

.profile-empty-icon svg { width: 24px; height: 24px; }
.profile-empty strong { font-size: 15px; }
.profile-empty p { margin: 0; color: var(--profile-muted); font-size: 12px; }
.profile-empty .link-button { min-height: 38px; font-size: 12px; }

.profile-order-list { margin-top: 7px; }
.profile-order-list .order-row { gap: 10px; padding: 12px 2px; border-color: #30382e; }
.profile-order-list .order-row:last-child { padding-bottom: 0; }
.profile-order-list .order-thumb { width: 47px; height: 47px; }
.profile-order-list .order-row .grow { overflow-wrap: anywhere; }
.profile-order-list .order-row .right { flex: none; max-width: 43%; }
.profile-order-list .order-row .right strong { overflow-wrap: anywhere; }
.profile-order-list .order-row > svg { width: 14px; height: 14px; color: #98a394; }
.profile-order-list .order-row .pill { font-size: 9px; }

.profile-preferences { grid-column: 1 / -1; }

.profile-preference-list {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin-top: 16px;
}

.profile-preference {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 9px;
    min-height: 65px;
    padding: 10px;
    border: 1px solid #333a31;
    border-radius: 14px;
    background: #202621;
    text-align: left;
}

.profile-preference .profile-icon { --profile-icon-color: #b4c8aa; }

.profile-switch {
    position: relative;
    width: 42px;
    height: 25px;
    border: 1px solid #566153;
    border-radius: 20px;
    background: #353d34;
    transition: background .22s, border-color .22s;
}

.profile-switch::before {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 17px;
    height: 17px;
    border-radius: 50%;
    background: #c1cbbb;
    box-shadow: 0 1px 4px #0004;
    transition: transform .32s var(--profile-ease), background .22s;
}

.profile-preference[aria-checked="true"] .profile-switch {
    background: var(--accent);
    border-color: var(--accent);
}

.profile-preference[aria-checked="true"] .profile-switch::before {
    transform: translateX(17px);
    background: #192212;
}

.profile-dashboard :is(button.profile-metric, .profile-shortcut, .profile-preference) {
    transition: transform .32s var(--profile-ease), background .25s, border-color .25s, box-shadow .25s;
}

.profile-dashboard :is(.profile-metric-arrow, .profile-shortcut-arrow, .profile-order-list .order-row > svg) {
    transition: transform .32s var(--profile-ease), color .25s;
}

.profile-dashboard button:focus-visible { outline-offset: 3px; }

@media (hover: hover) {
    .profile-dashboard :is(button.profile-metric, .profile-shortcut, .profile-preference):hover {
        border-color: #677c50;
        background: #283326;
        transform: translateY(-2px);
        box-shadow: 0 8px 20px #0003;
    }

    .profile-dashboard :is(button.profile-metric, .profile-shortcut, .profile-order-list .order-row):hover > svg {
        transform: translateX(3px);
        color: var(--accent);
    }

    .profile-dashboard .profile-topup:hover::after { animation: profile-topup-shine .7s var(--profile-ease); }
}

.profile-dashboard :is(button.profile-metric, .profile-shortcut, .profile-preference, .profile-topup):active {
    transform: scale(.98);
}

@media (max-width: 1000px) {
    .profile-preference-list { grid-template-columns: 1fr; }
    .profile-preference { padding: 9px 12px; min-height: 58px; }
}

@media (max-width: 850px) {
    .profile-details { grid-template-columns: 1fr; }
}

@media (max-width: 700px) {
    .profile-dashboard { --profile-gap: 12px; }
    .profile-overview { grid-template-columns: 1fr; }
    .profile-card { border-radius: 19px; }
    .profile-identity, .profile-wallet { min-height: 0; }
    .profile-identity { min-height: 182px; gap: 13px; }
    .profile-cover { left: 20%; }
    .profile-avatar { width: 52px; height: 52px; border-radius: 17px; font-size: 21px; }
    .profile-wallet-value { margin-bottom: 13px; }
    .profile-wallet-note { margin-top: 7px; }
    .profile-stats { gap: 7px; }
    .profile-metric { position: relative; align-items: flex-start; flex-direction: column; gap: 8px; min-height: 96px; padding: 10px; border-radius: 15px; }
    .profile-metric .profile-icon { width: 30px; height: 30px; border-radius: 9px; }
    .profile-metric .profile-icon svg { width: 15px; height: 15px; }
    .profile-metric-copy > span { font-size: 10px; }
    .profile-metric-arrow { position: absolute; top: 12px; right: 9px; width: 12px; height: 12px; }
    .profile-shortcut-grid { margin-top: 14px; }
    .profile-empty { min-height: 170px; }
}

@media (prefers-reduced-motion: no-preference) {
    :is(body:not(.launch-active), body.launch-revealing) .profile-enter :is(
        .profile-title,
        .profile-overview > *,
        .profile-stats > *,
        .profile-details > *
    ) {
        animation: profile-appear .62s var(--profile-ease) backwards;
        animation-delay: var(--profile-delay, 0ms);
    }

    .profile-overview > :nth-child(1) { --profile-delay: 45ms; }
    .profile-overview > :nth-child(2) { --profile-delay: 95ms; }
    .profile-stats > :nth-child(1) { --profile-delay: 125ms; }
    .profile-stats > :nth-child(2) { --profile-delay: 165ms; }
    .profile-stats > :nth-child(3) { --profile-delay: 205ms; }
    .profile-details > :nth-child(1) { --profile-delay: 225ms; }
    .profile-details > :nth-child(2) { --profile-delay: 265ms; }
    .profile-details > :nth-child(3) { --profile-delay: 305ms; }
    .profile-cover::before { animation: profile-cover-drift 7s ease-in-out infinite alternate; }
    .profile-wallet-art { animation: profile-orbit 6s ease-in-out infinite alternate; }
    .profile-wallet-updated { animation: profile-balance-change .65s var(--profile-ease); }
}

@media (prefers-reduced-motion: reduce) {
    .profile-dashboard :is(button.profile-metric, .profile-shortcut, .profile-preference, .profile-topup, .profile-metric-arrow, .profile-shortcut-arrow, .order-row > svg) {
        transform: none !important;
    }
}

@keyframes profile-appear {
    from { opacity: 0; transform: translateY(13px) scale(.985); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes profile-orbit {
    from { transform: rotate(-29deg) translate(-4px, 3px); }
    to { transform: rotate(-22deg) translate(7px, -4px); }
}

@keyframes profile-cover-drift {
    from { transform: translate3d(0, 2px, 0); }
    to { transform: translate3d(4px, -6px, 0); }
}

@keyframes profile-balance-change {
    35% { color: var(--accent); transform: translateY(-3px) scale(1.04); }
}

@keyframes profile-topup-shine {
    to { transform: translateX(100%); }
}
