.profile-hero {
    padding: var(--sp-6);
    margin-bottom: var(--sp-6);
}

.profile-auth-card {
    padding: var(--sp-6);
}

.profile-provider-grid {
    margin-top: var(--sp-4);
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: var(--sp-3);
}

.profile-provider-btn {
    justify-content: flex-start;
}

.profile-provider-icon {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--color-surface-alt);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-xs);
    font-weight: 700;
}

.profile-error {
    margin-top: var(--sp-3);
    color: var(--color-danger);
    font-size: var(--text-sm);
}

.profile-dev-tools {
    margin-top: var(--sp-4);
}

.profile-summary {
    padding: var(--sp-6);
    margin-bottom: var(--sp-6);
}

.profile-onboarding-card {
    max-width: 760px;
    margin-left: auto;
    margin-right: auto;
}

.profile-onboarding-card h1 {
    margin: 0 0 var(--sp-2) 0;
}

.profile-onboarding-form {
    margin-top: var(--sp-4);
}

.profile-overview {
    overflow: visible;
}

.profile-overview:hover,
.profile-overview:active {
    transform: none;
}

.profile-overview-header {
    margin-bottom: var(--sp-4);
}

.profile-overview-header h1 {
    margin: 0 0 var(--sp-2) 0;
}

.profile-overview-header p {
    margin: 0;
}

.profile-overview-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(280px, 420px);
    gap: var(--sp-4);
    align-items: start;
}

.profile-overview-grid h2 {
    margin: 0;
}

.profile-overview-grid > div > .text-secondary,
.profile-overview-grid > div > .text-xs {
    margin-top: var(--sp-2);
}

.profile-username-form {
    margin-top: var(--sp-3);
    display: grid;
    gap: var(--sp-2);
    max-width: 520px;
}

.profile-username-controls {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
}

.profile-username-prefix {
    height: 40px;
    min-width: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-surface-alt);
    color: var(--color-text-muted);
    font-weight: 600;
    padding: 0 var(--sp-2);
}

.profile-username-input {
    flex: 1;
    min-width: 0;
}

.profile-username-status {
    margin: 0;
}

[data-username-status].is-success {
    color: var(--color-success);
}

[data-username-status].is-error {
    color: var(--color-danger);
}

.profile-avatar-inline {
    margin-top: var(--sp-3);
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: var(--sp-3);
    background: var(--color-surface-alt);
}

.profile-avatar-open-btn {
    margin-left: auto;
    white-space: nowrap;
}

.profile-stat-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(80px, 1fr));
    gap: var(--sp-2);
}

.profile-stat {
    border: 1px solid var(--color-border);
    background: var(--color-surface-alt);
    border-radius: var(--radius-md);
    padding: var(--sp-3);
    text-align: center;
}

.profile-stat strong {
    display: block;
    font-size: var(--text-lg);
}

.profile-stat span {
    font-size: var(--text-xs);
    color: var(--color-text-muted);
}

.profile-section {
    padding: var(--sp-5);
    margin-bottom: var(--sp-5);
}

.profile-avatar-current-image {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid var(--color-border);
    background: var(--color-surface-alt);
}

.profile-avatar-current-meta {
    display: grid;
    gap: 2px;
}

.profile-avatar-modal[hidden] {
    display: none !important;
}

.profile-avatar-modal {
    position: fixed;
    inset: 0;
    z-index: 1200;
    display: grid;
    place-items: center;
    padding: var(--sp-4);
}

.profile-avatar-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(11, 16, 32, 0.55);
    backdrop-filter: blur(2px);
}

.profile-avatar-modal-dialog {
    position: relative;
    z-index: 1;
    width: min(920px, 100%);
    max-height: min(88vh, 860px);
    overflow: auto;
    padding: var(--sp-5);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
}

.profile-avatar-modal-dialog:hover,
.profile-avatar-modal-dialog:active {
    transform: none;
}

.profile-avatar-modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--sp-2);
    margin-bottom: var(--sp-3);
}

.profile-avatar-modal-head h3 {
    margin: 0;
}

.profile-avatar-modal-open {
    overflow: hidden;
}

.profile-avatar-picker {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: var(--sp-2);
    margin-top: var(--sp-3);
}

.profile-avatar-option {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-surface-alt);
    color: var(--color-text);
    display: grid;
    place-items: center;
    gap: var(--sp-1);
    padding: var(--sp-3);
    min-height: 120px;
    cursor: pointer;
    transition: border-color .18s ease, transform .18s ease, background-color .18s ease;
}

.profile-avatar-option:hover {
    border-color: color-mix(in srgb, var(--color-accent) 40%, var(--color-border));
    transform: translateY(-1px);
}

.profile-avatar-option img {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    object-fit: cover;
}

.profile-avatar-option span {
    font-size: var(--text-sm);
    color: var(--color-text-muted);
}

.profile-avatar-option.is-selected {
    border-color: color-mix(in srgb, var(--color-accent) 50%, var(--color-border));
    background: color-mix(in srgb, var(--color-accent) 10%, var(--color-surface-alt));
}

.profile-avatar-option.is-selected span {
    color: var(--color-accent);
    font-weight: 600;
}

.profile-avatar-actions {
    margin-top: var(--sp-3);
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    flex-wrap: wrap;
}

[data-avatar-status].is-success {
    color: var(--color-success);
}

[data-avatar-status].is-error {
    color: var(--color-danger);
}

.profile-section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--sp-3);
    margin-bottom: var(--sp-4);
}

.profile-list {
    display: grid;
    gap: var(--sp-2);
}

.profile-section-note {
    margin: 0 0 var(--sp-3) 0;
}

.profile-day-group {
    display: block;
}

.profile-day-group + .profile-day-group {
    margin-top: var(--sp-2);
}

.profile-day-accordion {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-surface-alt);
    overflow: hidden;
}

.profile-day-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--sp-2);
    padding: var(--sp-3);
    cursor: pointer;
    user-select: none;
    list-style: none;
}

.profile-day-summary::-webkit-details-marker {
    display: none;
}

.profile-day-title {
    margin: 0;
    font-size: var(--text-xs);
    color: var(--color-text-muted);
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.profile-day-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 22px;
    padding: 0 8px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--color-accent) 12%, var(--color-surface-alt));
    color: var(--color-accent);
    font-size: var(--text-xs);
    font-weight: 700;
    margin-left: auto;
}

.profile-day-summary::after {
    content: '▸';
    color: var(--color-text-muted);
    font-size: 12px;
    transform: translateY(-1px);
    transition: transform 0.18s ease;
}

.profile-day-accordion[open] .profile-day-summary::after {
    transform: rotate(90deg) translateX(1px);
}

.profile-day-items {
    display: grid;
    gap: var(--sp-2);
    padding: 0 var(--sp-3) var(--sp-3) var(--sp-3);
}

.profile-list-entry.is-hidden {
    display: none;
}

.profile-day-toggle-wrap {
    margin-top: var(--sp-3);
    display: flex;
    justify-content: flex-start;
}

.profile-day-list-toggle-wrap {
    margin-top: var(--sp-3);
    display: flex;
    justify-content: flex-start;
}

.profile-day-group.is-hidden {
    display: none;
}

.profile-list-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: var(--sp-3);
    align-items: center;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: var(--sp-3);
    background: var(--color-surface-alt);
}

.profile-list-main a {
    color: var(--color-text);
    font-weight: 600;
}

.profile-item-topline {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    flex-wrap: wrap;
}

.profile-game-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 999px;
    border: 1px solid var(--color-border);
    background: var(--color-surface-alt);
    color: var(--color-accent);
    border: 1px solid color-mix(in srgb, var(--color-accent) 35%, var(--color-border));
    background: color-mix(in srgb, var(--color-accent) 10%, var(--color-surface-alt));
    color: color-mix(in srgb, var(--color-accent) 75%, var(--color-text));
    font-size: var(--text-xs);
    font-weight: 600;
    line-height: 1.3;
}

.profile-list-main a:hover {
    color: var(--color-accent);
}

.profile-list-main p {
    margin-bottom: 0;
}

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

    .profile-avatar-inline {
        flex-wrap: wrap;
    }

    .profile-username-controls {
        flex-wrap: wrap;
    }

    .profile-username-controls .btn {
        width: 100%;
    }

    .profile-avatar-open-btn {
        margin-left: 0;
    }

    .profile-stat-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .profile-list-item {
        grid-template-columns: 1fr;
        gap: var(--sp-1);
    }

    .profile-avatar-picker {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .profile-avatar-option {
        min-height: 104px;
        padding: var(--sp-2);
    }

    .profile-avatar-option img {
        width: 56px;
        height: 56px;
    }

    .profile-avatar-option span {
        font-size: var(--text-xs);
    }

    .profile-avatar-modal {
        padding: var(--sp-2);
    }

    .profile-avatar-modal-dialog {
        width: 100%;
        max-height: 92vh;
        padding: var(--sp-4);
    }

    .profile-avatar-modal-head {
        align-items: flex-start;
        flex-direction: column;
    }
}
