.player-profile-trigger {
    position: absolute;
    inset: 0;
    z-index: 1;
    width: 100%;
    padding: 0;
    border: 0;
    border-radius: inherit;
    background: transparent;
    cursor: pointer;
}

:is(.player-card, .players-modal-card):has(> .player-profile-trigger) {
    position: relative;
}

.player-profile-trigger:focus-visible {
    outline: 2px solid var(--gold, #dbab55);
    outline-offset: -3px;
}
.player-profile-dialog {
    --profile-ink: #f7f9ff;
    --profile-muted: #c5cbda;
    --profile-accent: #ecc069;
    --profile-name-color: #ecc069;
    --profile-line: #cbd6ee24;
    --profile-fill: #10141f;
    --profile-glow: #58422135;
    --profile-control: #ffffff09;
    --light-text: var(--profile-ink);
    position: fixed;
    inset: 0;
    margin: auto;
    box-sizing: border-box;
    width: min(480px, calc(100% - 24px));
    max-height: calc(100vh - 24px);
    max-height: calc(100dvh - 24px);
    padding: 0;
    border: 1px solid var(--profile-line);
    border-radius: 17px;
    background: radial-gradient(ellipse at top left, var(--profile-glow), transparent 65%), var(--profile-fill);
    color: var(--profile-ink);
    box-shadow: 0 20px 66px #0006, inset 0 1px #ffffff18;
    overflow: auto;
    overscroll-behavior: contain;
}

.player-profile-dialog[data-profile-theme="cobalt"] {
    --profile-accent: #8bc6ff;
    --profile-fill: #101b31;
    --profile-glow: #3a7fe650;
    --profile-line: #c4d8f138;
}

.player-profile-dialog[data-profile-theme="light"] {
    --profile-ink: #142e58;
    --profile-muted: #405678;
    --profile-accent: #2453a8;
    --profile-name-color: #795105;
    --profile-line: #a5b8d6;
    --profile-fill: #f7faff;
    --profile-glow: #b6d7ff75;
    --profile-control: #1237630a;
}

.player-profile-dialog::backdrop {
    background: #050a15b5;
    backdrop-filter: blur(5px);
}

html:has(.player-profile-dialog[open]) { overflow: hidden; }

.player-profile-panel {
    position: relative;
    padding: clamp(16px, 4vw, 26px);
}

@media (prefers-reduced-motion: no-preference) {
    .player-profile-dialog[open] {
        animation: player-profile-reveal 560ms cubic-bezier(.2, .78, .28, 1) both,
                   player-profile-halo 900ms ease-out;
    }

    :is(.player-profile-panel, :is(.player-card, .players-modal-card):has(> .player-profile-trigger))::after {
        content: '';
        position: absolute;
        inset: 0;
        border-radius: inherit;
        opacity: 0;
        pointer-events: none;
        background:
            radial-gradient(circle at 17% 19%, #fff1c7 0 1px, #f6bd6270 2px, transparent 6px),
            radial-gradient(circle at 75% 24%, #e0f3ff 0 1px, #85baff82 2px, transparent 5px),
            radial-gradient(circle at 86% 71%, #fff1c7 0 1px, #f6bd6270 2px, transparent 5px),
            linear-gradient(118deg, transparent 37%, #83baff25 47%, #ffe2a574 50%, #a7cbff36 54%, transparent 64%) 100% 0 / 260% 100% no-repeat;
    }

    .player-profile-dialog[open] .player-profile-panel::after {
        animation: player-profile-shimmer 850ms ease-out both;
    }

    @media (hover: hover) and (pointer: fine) {
        :is(.player-card, .players-modal-card):has(> .player-profile-trigger):hover {
            z-index: 1;
            animation: player-profile-halo 900ms ease-out;
        }

        :is(.player-card, .players-modal-card):has(> .player-profile-trigger):hover::after {
            animation: player-profile-shimmer 850ms ease-out both;
        }
    }

    @keyframes player-profile-reveal {
        from { opacity: 0; transform: translateY(14px) scale(.94); }
        62% { opacity: 1; }
        to { opacity: 1; transform: none; }
    }

    @keyframes player-profile-halo {
        34% {
            box-shadow: 0 20px 66px #0006, inset 0 1px #ffe5a37d,
                        0 0 24px 2px #eab75978, 0 0 65px 9px #5187fd70;
        }
    }

    @keyframes player-profile-shimmer {
        from { opacity: 0; background-position: 0 0, 0 0, 0 0, 100% 0; }
        35% { opacity: .88; }
        to { opacity: 0; background-position: 0 0, 0 0, 0 0, 0 0; }
    }
}

.player-profile-close {
    --light-text: var(--profile-muted);
    position: absolute;
    z-index: 1;
    top: 10px;
    right: 10px;
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border: 1px solid var(--profile-line);
    border-radius: 8px;
    background: var(--profile-control);
    color: var(--profile-muted);
    cursor: pointer;
}

.player-profile-close:hover { border-color: var(--profile-accent); }

.player-profile-heading {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: clamp(11px, 3vw, 20px);
    padding-inline-end: 31px;
}

.player-profile-avatar {
    flex: 0 0 clamp(60px, 19vw, 96px);
    aspect-ratio: 1;
    display: grid;
    place-items: center;
    overflow: hidden;
    background: var(--profile-control);
    border: 2px solid var(--profile-accent);
    border-radius: 50%;
}

.player-profile-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 29%;
}
.player-profile-avatar i { --light-text: var(--profile-accent); color: var(--profile-accent); font-size: 25px; }

.player-profile-identity { min-width: 0; overflow-wrap: anywhere; }
.player-profile-identity h2 {
    --light-text: var(--profile-name-color);
    margin: 0;
    font-size: clamp(19px, 5vw, 27px);
    line-height: 1.13;
    color: var(--profile-name-color);
}
.player-profile-identity p { margin: 4px 0 0; line-height: 1.35; }
.player-profile-role {
    --light-text: var(--profile-accent);
    color: var(--profile-accent);
    font-size: 14px;
    font-weight: 750;
}
.player-profile-name, .player-profile-bio {
    --light-text: var(--profile-muted);
    color: var(--profile-muted);
    font-size: 13px;
}
.player-profile-bio {
    margin: 19px 0 0;
    padding-top: 16px;
    border-top: 1px solid var(--profile-line);
    line-height: 1.65;
    white-space: pre-line;
    overflow-wrap: anywhere;
}

.player-profile-socials {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin-top: 19px;
    padding-top: 15px;
    border-top: 1px solid var(--profile-line);
}
.player-profile-social {
    --network-color: var(--profile-ink);
    --light-text: var(--network-color);
    display: grid;
    place-items: center;
    width: 43px;
    height: 43px;
    border: 1px solid var(--profile-line);
    border-radius: 9px;
    background: var(--profile-control);
    color: var(--network-color);
    font-size: 19px;
    text-decoration: none;
}
.player-profile-social i, .player-profile-social span { --light-text: var(--network-color); color: var(--network-color); }
.player-profile-social:is(:hover, :focus-visible) { border-color: var(--network-color); }
.player-profile-social[data-network="youtube"] { --network-color: #ff5050; }
.player-profile-social[data-network="twitch"] { --network-color: #b78aff; }
.player-profile-social[data-network="kick"] { --network-color: #73f642; }
.player-profile-social[data-network="instagram"] { --network-color: #ff86b7; }
[data-profile-theme="light"] .player-profile-social[data-network="youtube"] { --network-color: #b32325; }
[data-profile-theme="light"] .player-profile-social[data-network="twitch"] { --network-color: #6535a9; }
[data-profile-theme="light"] .player-profile-social[data-network="kick"] { --network-color: #287006; }
[data-profile-theme="light"] .player-profile-social[data-network="instagram"] { --network-color: #ad3568; }
.player-profile-kick { font-weight: 900; font-size: 21px; }
