/* Layout */
.explore-panel {
    padding: 2rem 1rem 4rem;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.profile-content {
    width: 90%;
    max-width: 1000px;
    padding: 2rem;
    background: linear-gradient(145deg, var(--geo-panel), var(--geo-panel-alt));
    border: 1px solid var(--geo-border);
    border-radius: var(--geo-radius-large);
    box-shadow: 0 18px 38px var(--geo-shadow);
}

.profile-top {
    display: flex;
    gap: 2rem;
    align-items: center;
    flex-wrap: wrap;
    justify-content: center;
}

/* Profile Header Block */
.profile-header {
    width: 100%;
    padding: 0 0 2rem;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    margin-bottom: 2rem;
}

.profile-avatar {
    width: 140px;
    height: 140px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid rgba(106, 255, 209, 0.9);
    background: linear-gradient(145deg, #153b39, #10222b);
    box-shadow:
        0 0 0 6px rgba(0, 245, 179, 0.1),
        0 0 30px rgba(0, 245, 179, 0.24);
    cursor: pointer;

    transition: filter 0.3s;
}

.profile-avatar:hover {
    filter: brightness(0.8);
}

.profile-info {
    flex: 1;
    min-width: 250px;
}

.nickname {
    font-size: 1.8rem;
    font-weight: bold;
    margin-bottom: 1rem;
}

.profile-skeleton {
    display: inline-block;
    vertical-align: middle;
}

.profile-skeleton--name {
    width: min(14rem, 70vw);
    height: 1.45rem;
}

.profile-skeleton--meta {
    width: min(12rem, 55vw);
}

.profile-skeleton--level {
    width: 8rem;
}

.profile-skeleton--stat {
    width: 5.5rem;
    height: 1.2rem;
    margin: 0.1rem auto;
}

.nickname-separator {
    border: none;
    height: 2px;
    background: linear-gradient(to right, #00ffae, #00b389);
    border-radius: 1px;
    max-width: 400px;
    margin: 1.5rem auto 2rem;
}

.bio {
    font-size: 1.1rem;
    color: #e0e0e0;
    margin-bottom: 1.2rem;
    line-height: 1.5;
}

.meta-row {
    display: grid;
    grid-template-columns: 5rem minmax(0, 1fr) auto;
    gap: 0.75rem;
    align-items: center;
    margin-bottom: 0.75rem;
    padding: 0.85rem 1rem;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 0.9rem;
    background: rgba(255, 255, 255, 0.025);
    text-align: left;
    transition:
        background-color 0.2s ease,
        border-color 0.2s ease,
        box-shadow 0.2s ease;
}

.meta-label {
    width: auto;
    font-weight: 700;
    color: rgba(183, 210, 199, 0.78);
    letter-spacing: 0.03em;
}

.meta-value {
    min-width: 0;
    color: rgba(244, 255, 249, 0.88);
    line-height: 1.5;
    overflow-wrap: anywhere;
    white-space: normal;
}

.meta-row.is-editing {
    align-items: start;
    border-color: rgba(0, 230, 160, 0.4);
    background: rgba(0, 230, 160, 0.045);
    box-shadow: 0 0 0 3px rgba(0, 230, 160, 0.06);
}

.meta-row.is-editing .edit-btn {
    display: none;
}

.level-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 1.5rem 0 0.55rem;
    color: var(--geo-text, #f4fff9);
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.level-bar {
    width: 100%;
    height: 20px;
    padding: 3px;
    background: rgba(3, 12, 15, 0.72);
    border: 1px solid rgba(159, 255, 220, 0.16);
    border-radius: 999px;
    overflow: hidden;
    box-shadow:
        inset 0 2px 5px rgba(0, 0, 0, 0.45),
        0 0 0 1px rgba(0, 0, 0, 0.12);
}

.level-fill {
    height: 100%;
    position: relative;
    min-width: 0;
    background: linear-gradient(90deg, #00b985, var(--geo-accent-strong, #00f5b3) 72%, #b4ffe2);
    border-radius: inherit;
    box-shadow:
        0 0 12px rgba(0, 255, 174, 0.42),
        inset 0 1px 0 rgba(255, 255, 255, 0.4);
    transition: width 0.5s ease-in-out;
}

.level-fill::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 999px;
    background: linear-gradient(110deg, transparent 25%, rgba(255, 255, 255, 0.35) 50%, transparent 75%);
    background-size: 220% 100%;
    animation: xp-shine 2.8s ease-in-out infinite;
}

.level-progress {
    display: block;
    font-size: 0.85rem;
    margin-top: 0.55rem;
    color: var(--geo-muted-strong, rgba(255, 255, 255, 0.82));
    text-align: right;
}

.profile-progression-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-top: 1rem;
    padding: 0.6rem 1rem;
    border-radius: 999px;
    background: rgba(0, 245, 179, 0.12);
    border: 1px solid rgba(0, 245, 179, 0.28);
    color: #dffef7;
    text-decoration: none;
    font-weight: 700;
    transition:
        transform 0.2s ease,
        border-color 0.2s ease;
}

.profile-progression-link:hover {
    transform: translateY(-1px);
    border-color: rgba(0, 245, 179, 0.48);
}

@keyframes xp-shine {
    from {
        background-position: 120% 0;
    }

    to {
        background-position: -120% 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    .level-fill {
        transition: none;
    }

    .level-fill::after {
        animation: none;
    }
}

.profile-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
    width: 100%;
}

.stat-card {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    padding: 1.5rem;
    border-radius: var(--geo-radius);
    text-align: center;
    box-shadow: none;

    transition:
        transform 0.2s,
        border-color 0.2s,
        background-color 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
    border-color: rgba(0, 255, 174, 0.4);
    background-color: rgba(0, 255, 174, 0.08);
}

.stat-card h3 {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    color: #00ffae;
}

.stat-card p {
    font-size: 1.4rem;
    font-weight: bold;
    color: #fff;
}

.profile-editor {
    grid-column: 2 / -1;
    display: grid;
    gap: 0.65rem;
    width: 100%;
    min-width: 0;
}

.profile-editor-control {
    display: block;
    width: 100%;
    min-width: 0;
    padding: 0.75rem 0.85rem;
    border: 1px solid var(--geo-control-border, rgba(159, 255, 220, 0.28));
    border-radius: 0.75rem;
    background: var(--geo-control-bg, rgba(5, 14, 18, 0.72));
    color: var(--geo-text, #f4fff9);
    font: inherit;
    font-size: 0.95rem;
    outline: none;
    transition:
        border-color 0.2s ease,
        box-shadow 0.2s ease,
        background-color 0.2s ease;
}

.profile-editor-control:focus {
    border-color: rgba(0, 255, 174, 0.7);
    background-color: var(--geo-control-bg-focus, rgba(8, 22, 25, 0.92));
    box-shadow: var(--geo-focus-ring, 0 0 0 3px rgba(0, 255, 174, 0.12));
}

.profile-editor-bio {
    min-height: 7rem;
    resize: vertical;
    line-height: 1.5;
}

.edit-select {
    appearance: none;
    cursor: pointer;
    padding-right: 2.75rem;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Cpath d='m3 6 5 5 5-5' fill='none' stroke='%2300f5b3' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.7'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.9rem center;
}

.edit-select option {
    background: var(--geo-panel, #13191e);
    color: var(--geo-text, #f4fff9);
}

.profile-editor-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.profile-editor-count {
    color: var(--geo-muted, rgba(255, 255, 255, 0.72));
    font-size: 0.78rem;
    font-variant-numeric: tabular-nums;
}

.profile-editor-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.55rem;
    margin-left: auto;
}

.profile-editor-actions button {
    min-height: 2.35rem;
    padding: 0.45rem 0.85rem;
    border: 1px solid transparent;
    border-radius: 0.65rem;
    font: inherit;
    font-size: 0.84rem;
    font-weight: 700;
    cursor: pointer;
    transition:
        transform 0.18s ease,
        background-color 0.18s ease,
        border-color 0.18s ease,
        opacity 0.18s ease;
}

.profile-editor-cancel {
    border-color: rgba(255, 255, 255, 0.12) !important;
    background: rgba(255, 255, 255, 0.045);
    color: var(--geo-muted-strong, rgba(255, 255, 255, 0.82));
}

.profile-editor-save {
    background: linear-gradient(135deg, var(--geo-accent-strong, #00f5b3), var(--geo-accent-dark, #00c78a));
    color: #05251c;
}

.profile-editor-actions button:hover:not(:disabled) {
    transform: translateY(-1px);
}

.profile-editor-cancel:hover:not(:disabled) {
    border-color: rgba(255, 255, 255, 0.24) !important;
    background: rgba(255, 255, 255, 0.08);
}

.profile-editor-actions button:focus-visible,
.edit-btn:focus-visible {
    outline: 2px solid var(--geo-accent-strong, #00f5b3);
    outline-offset: 3px;
}

.profile-editor-actions button:disabled {
    cursor: wait;
    opacity: 0.65;
}

.edit-btn {
    display: inline-grid;
    place-items: center;
    width: 2rem;
    height: 2rem;
    border: 1px solid rgba(0, 230, 160, 0.18);
    border-radius: 0.65rem;
    background: rgba(0, 230, 160, 0.07);
    color: var(--geo-accent-strong, #00f5b3);
    cursor: pointer;
    transition:
        transform 0.2s ease,
        border-color 0.2s ease,
        background-color 0.2s ease;
}

.edit-btn svg,
.avatar-edit-button svg {
    display: block;
    width: 1rem;
    height: 1rem;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.8;
}

.avatar-edit-button svg {
    width: 1.1rem;
    height: 1.1rem;
}

.edit-btn:hover {
    transform: translateY(-1px);
    border-color: rgba(0, 230, 160, 0.45);
    background: rgba(0, 230, 160, 0.14);
}

#country-text {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1rem;
    font-weight: 500;
    color: rgba(244, 255, 249, 0.88);
    word-break: break-word;
    white-space: normal;
}

#country-text .flag-icon {
    width: 20px;
    height: auto;
    border-radius: 3px;
    box-shadow: 0 0 3px rgba(0, 0, 0, 0.5);
    flex: 0 0 auto;
    border-radius: 3px;
}

.avatar-control {
    position: relative;
    flex: 0 0 auto;
}

.avatar-control .profile-avatar {
    display: block;
}

.avatar-edit-button {
    position: absolute;
    right: 4px;
    bottom: 4px;
    display: grid;
    width: 2.25rem;
    height: 2.25rem;
    place-items: center;
    border: 2px solid rgba(255, 255, 255, 0.85);
    border-radius: 50%;
    background: #00c78a;
    color: #05251c;
    cursor: pointer;
    font-size: 1.1rem;
    opacity: 0;
    transform: translateY(3px);
    transition:
        opacity 0.18s ease,
        transform 0.18s ease;
}

.avatar-control:hover .avatar-edit-button,
.avatar-control:focus-within .avatar-edit-button {
    opacity: 1;
    transform: translateY(0);
}

.avatar-dialog {
    width: min(38rem, calc(100% - 2rem));
    max-height: min(84vh, 46rem);
    overflow: hidden;
    padding: 1.4rem;
}

.avatar-dialog .dialog-heading {
    margin-bottom: 1.25rem;
}
.avatar-dialog .eyebrow {
    margin: 0;
    color: #00f5b3;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}
.avatar-presets {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.8rem;
    max-height: calc(min(84vh, 46rem) - 7rem);
    overflow-y: auto;
    padding: 0.2rem 0.35rem 0.35rem 0;
    overscroll-behavior: contain;
}
.avatar-preset {
    position: relative;
    display: flex;
    min-height: 8.7rem;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.7rem;
    padding: 0.9rem 0.5rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 1rem;
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.065), rgba(255, 255, 255, 0.018));
    color: rgba(255, 255, 255, 0.82);
    cursor: pointer;
    font: inherit;
    font-size: 0.82rem;
    font-weight: 600;
    transition:
        transform 0.18s ease,
        border-color 0.18s ease,
        background 0.18s ease,
        box-shadow 0.18s ease;
}
.avatar-preset:hover {
    transform: translateY(-3px);
    border-color: rgba(0, 230, 160, 0.65);
    background: linear-gradient(145deg, rgba(0, 230, 160, 0.15), rgba(255, 255, 255, 0.035));
}
.avatar-preset:focus-visible {
    outline: 2px solid #00e6a0;
    outline-offset: 3px;
}
.avatar-preset[aria-pressed="true"] {
    border-color: #00e6a0;
    background: linear-gradient(145deg, rgba(0, 230, 160, 0.2), rgba(255, 255, 255, 0.04));
    box-shadow:
        inset 0 0 0 1px rgba(0, 230, 160, 0.2),
        0 0 22px rgba(0, 230, 160, 0.1);
    color: #fff;
}
.avatar-preset[aria-pressed="true"]::after {
    content: "✓";
    position: absolute;
    top: 0.55rem;
    right: 0.55rem;
    display: grid;
    width: 1.25rem;
    height: 1.25rem;
    place-items: center;
    border-radius: 50%;
    background: #00d89a;
    color: #062219;
    font-size: 0.75rem;
}
.avatar-preset:disabled {
    cursor: wait;
    opacity: 0.65;
}
.avatar-preset img {
    width: 5.25rem;
    height: 5.25rem;
    padding: 0.25rem;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 50%;
    background: radial-gradient(circle at 35% 25%, rgba(139, 255, 221, 0.22), rgba(0, 0, 0, 0.35));
    box-shadow: 0 7px 20px rgba(0, 0, 0, 0.3);
    object-fit: cover;
    transition:
        transform 0.18s ease,
        box-shadow 0.18s ease;
}
.avatar-preset:hover img,
.avatar-preset[aria-pressed="true"] img {
    transform: scale(1.06);
    box-shadow:
        0 0 0 3px rgba(0, 230, 160, 0.22),
        0 8px 24px rgba(0, 0, 0, 0.35);
}

@media (max-width: 640px) {
    .explore-panel {
        padding: 1rem 0.75rem 2.5rem;
    }

    .profile-content {
        width: 100%;
        padding: 1.25rem;
    }

    .profile-header {
        padding-bottom: 1.5rem;
        margin-bottom: 1.5rem;
    }

    .profile-top {
        flex-direction: column;
        gap: 1.25rem;
    }

    .profile-avatar {
        width: 6.5rem;
        height: 6.5rem;
    }

    .avatar-edit-button {
        opacity: 1;
        transform: none;
    }

    .profile-info {
        width: 100%;
        min-width: 0;
    }

    .nickname {
        font-size: clamp(1.4rem, 7vw, 1.8rem);
        overflow-wrap: anywhere;
    }

    .nickname-separator {
        margin: 1rem auto 1.25rem;
    }

    .meta-row {
        display: grid;
        grid-template-columns: 3.75rem minmax(0, 1fr) auto;
        align-items: start;
        gap: 0.4rem;
        margin-bottom: 0.75rem;
        text-align: left;
    }

    .meta-label {
        width: auto;
        color: rgba(183, 210, 199, 0.72);
        font-size: 0.72rem;
        font-weight: 600;
        letter-spacing: 0;
        text-shadow: none;
    }

    .meta-value,
    #country-text {
        min-width: 0;
        color: rgba(224, 232, 229, 0.68);
        font-size: 0.76rem;
        line-height: 1.4;
        overflow-wrap: anywhere;
        white-space: normal;
    }

    #country-text .flag-icon {
        width: 0.9rem;
        margin-right: 0.3rem;
    }

    .meta-row .edit-btn {
        min-width: 2.5rem;
        min-height: 2.5rem;
        margin: -0.5rem -0.5rem 0 0;
    }

    .level-progress {
        font-size: 0.75rem;
    }

    .level-label {
        gap: 0.5rem;
        font-size: 0.8rem;
    }

    .profile-progression-link {
        width: 100%;
        padding-inline: 0.75rem;
        text-align: center;
    }

    .profile-stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.75rem;
    }

    .stat-card {
        min-width: 0;
        padding: 1rem 0.65rem;
    }

    .stat-card h3 {
        font-size: 0.82rem;
        overflow-wrap: anywhere;
    }

    .stat-card p {
        font-size: 1.05rem;
        overflow-wrap: anywhere;
    }
}

@media (max-width: 380px) {
    .profile-content {
        padding: 1rem 0.8rem;
    }

    .profile-stats-grid {
        grid-template-columns: 1fr;
    }

    .stat-card {
        padding: 0.9rem;
    }
}

@media (max-width: 480px) {
    .avatar-dialog {
        padding: 1.1rem;
    }

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