/* Profile Page Styles (마이페이지 / 타 유저 프로필) */
.profile-wrapper {
    --profile-frame-width: 720px;
    /* 모바일에서 쓰던 커버 비율을 모든 화면의 단일 기준으로 사용 */
    --profile-cover-ratio: 12 / 5;
    --profile-avatar-size: clamp(88px, 24vw, 176px);
    --profile-avatar-overlap: calc(var(--profile-avatar-size) * 0.5);
    container-type: inline-size;
    max-width: var(--profile-frame-width);
    margin: 1.5rem auto 4rem;
}

@supports (width: 1cqi) {
    .profile-wrapper {
        --profile-avatar-size: clamp(88px, 24cqi, 176px);
    }
}

/* Header Card (커버/아바타/닉네임/레벨/태그/최애곡) */
.profile-header-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-2xl, 24px);
    padding: 0;
    text-align: left;
    box-shadow: var(--shadow-card, 0 12px 36px rgba(0, 0, 0, 0.08));
    margin-bottom: 1rem;
    overflow: hidden;
}

.avatar-container {
    position: relative;
    width: var(--profile-avatar-size);
    aspect-ratio: 1;
    margin: 0;
    z-index: 2;
}

.profile-avatar {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    border: clamp(3px, 0.6vw, 5px) solid var(--bg-card);
    background: var(--bg-secondary);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18);
}

.avatar-upload-label {
    position: absolute;
    bottom: 0;
    right: 0;
    background: var(--text-primary);
    color: var(--bg-primary);
    width: clamp(34px, 6.5vw, 46px);
    height: clamp(34px, 6.5vw, 46px);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s;
    border: 2px solid var(--bg-card);
    font-size: 0.78rem;
    padding: 0;
    appearance: none;
    -webkit-appearance: none;
}

.avatar-upload-label:hover {
    transform: scale(1.1);
}

/* 커버(배경) 사진 — 카드 상단에 꽉 차게, 아바타가 아래쪽 경계에 걸치도록 */
.cover-container {
    position: relative;
    width: 100%;
    margin: 0;
    aspect-ratio: var(--profile-cover-ratio);
    min-height: 0;
    overflow: hidden;
    background:
        radial-gradient(circle at 18% 25%, rgba(73, 196, 141, 0.28), transparent 34%),
        linear-gradient(135deg, var(--bg-secondary), var(--bg-card));
}

.profile-cover {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-cover--empty {
    background:
        radial-gradient(circle at 20% 30%, rgba(73, 196, 141, 0.3), transparent 34%),
        radial-gradient(circle at 78% 70%, rgba(117, 102, 255, 0.2), transparent 30%),
        var(--bg-secondary);
}

.cover-upload-label {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background: var(--text-primary);
    color: var(--bg-primary);
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s;
    border: 2px solid rgba(255, 255, 255, 0.72);
    box-shadow: var(--shadow-md);
    padding: 0;
    appearance: none;
    -webkit-appearance: none;
    z-index: 2;
}

.cover-upload-label:hover {
    transform: scale(1.1);
}

.profile-identity {
    display: grid;
    grid-template-columns: var(--profile-avatar-size) minmax(0, 1fr);
    align-items: start;
    gap: clamp(1rem, 3vw, 1.5rem);
    margin-top: calc(var(--profile-avatar-overlap) * -1);
    padding: 0 clamp(1rem, 4vw, 2rem);
    position: relative;
}

.profile-identity-copy {
    min-width: 0;
    padding-top: calc(var(--profile-avatar-overlap) + 0.75rem);
    padding-bottom: 0.25rem;
}

.profile-name-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem 0.75rem;
    min-height: 2rem;
}

.profile-nickname {
    font-family: var(--font-display);
    font-size: clamp(1.15rem, 3.5vw, 1.55rem);
    font-weight: 700;
    line-height: 1.25;
    margin: 0;
    color: var(--text-primary);
    overflow-wrap: anywhere;
}

.level-info-container {
    margin: 0.35rem clamp(1rem, 4vw, 2rem) 0;
}

.profile-wrapper .user-level-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: var(--bg-secondary);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin: 0;
    border: 1px solid var(--border-light);
}

.level-progress-copy {
    display: flex;
    justify-content: space-between;
    font-size: 0.72rem;
    color: var(--text-muted);
}

.level-progress-bar {
    width: 100%;
    height: 5px;
    background: var(--bg-secondary);
    border-radius: 4px;
    margin-top: 5px;
    overflow: hidden;
}

.level-progress-bar>div {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--primary-hover, var(--primary-color)));
    border-radius: 4px;
    transition: width 0.5s ease-out;
}

.profile-stats-inline {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: auto;
    max-width: none;
    margin: 0.75rem clamp(1rem, 4vw, 2rem) 0;
    padding: 0.8rem 0;
    border-top: 1px solid var(--border-light);
    border-bottom: 1px solid var(--border-light);
}

.profile-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.12rem;
    min-width: 0;
    padding: 0.15rem 0.5rem;
    text-align: center;
}

.profile-stat + .profile-stat {
    border-left: 1px solid var(--border-light);
}

.profile-stat strong {
    color: var(--text-primary);
    font-size: 1.2rem;
    font-variant-numeric: tabular-nums;
}

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

/* Stats Box (타 유저 프로필에서 사용) */
.profile-stats {
    background: var(--bg-secondary);
    padding: 1rem;
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    text-align: left;
    display: grid;
    gap: 0.5rem;
    margin: 1rem auto 0;
    max-width: 320px;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.stat-label {
    color: var(--text-secondary);
}

.stat-value {
    font-weight: 600;
    color: var(--text-primary);
}

.stat-footer {
    border-top: 1px solid var(--border-color);
    margin-top: 0.25rem;
    padding-top: 0.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* 관심 태그 줄 */
.profile-extras {
    display: grid;
    gap: 0.75rem;
    padding: 1.25rem clamp(1rem, 4vw, 2rem) clamp(1.25rem, 4vw, 2rem);
}

.profile-tags-row {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin: 0;
}

.profile-tag-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: flex-start;
    flex: 1;
    min-width: 0;
}

.empty-hint {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.widget-edit-btn {
    flex: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    cursor: pointer;
    opacity: 0.82;
    transition: opacity 0.2s, background-color 0.2s, transform 0.2s;
}

.widget-edit-btn:hover {
    opacity: 1;
    background: var(--border-light);
    transform: translateY(-1px);
}

/* 최애곡 위젯 */
.profile-track-widget {
    display: block;
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
    max-width: none;
    margin: 0;
    padding: 0.9rem 1rem 0.7rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-xl);
    text-align: left;
    text-decoration: none;
    color: inherit;
    overflow: hidden;
}

.profile-track-widget-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.55rem;
}

/* 좌우 화살표는 뷰포트 바깥에 두고, 뷰포트만 스크롤 영역으로 남긴다. */
.profile-track-stage {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    min-width: 0;
}

.profile-track-arrow {
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    width: 26px;
    height: 26px;
    padding: 0;
    border: 1px solid var(--border-light);
    border-radius: 50%;
    background: var(--bg-card);
    color: var(--text-secondary);
    font-size: 0.7rem;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease, opacity 0.15s ease;
}

.profile-track-arrow:hover:not(:disabled) {
    background: var(--primary-bg-light);
    color: var(--primary-color);
}

.profile-track-arrow:disabled {
    opacity: 0.3;
    cursor: default;
}

/* 손가락으로 넘기는 화면에선 화살표가 자리만 차지한다. */
@media (hover: none) {
    .profile-track-arrow {
        display: none;
    }
}

.profile-track-viewport {
    flex: 1 1 auto;
    width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    min-width: 0;
    overscroll-behavior-x: contain;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    border-radius: var(--radius-lg);
}

.profile-track-viewport::-webkit-scrollbar {
    display: none;
}

/* 폭은 뷰포트 기준이어야 한다. max-content로 두면 아래 슬라이드의 100%가
   무엇에 대한 100%인지 순환해서, 곡이 두 개일 때 슬라이드가 두 배로 넓어진다. */
.profile-track-track {
    display: flex;
    align-items: flex-start;
    width: 100%;
    min-height: 1px;
}

/* 슬라이드는 위쪽 정보 줄과 아래쪽 플레이어 자리로 나뉜다.
   플레이어가 닫혀 있으면 예전과 같은 한 줄 카드로 보인다.
   min-width는 반드시 0이다. 100%로 두면 JS가 잡아준 px 폭을 덮어써
   한 슬라이드가 트랙 전체 폭까지 늘어나고, 재생 버튼이 화면 밖으로 밀린다. */
.profile-track-slide {
    display: flex;
    flex-direction: column;
    flex: 0 0 100%;
    min-width: 0;
    box-sizing: border-box;
    gap: 0.5rem;
    padding: 0.55rem 0.2rem 0.65rem;
    scroll-snap-align: start;
}

.profile-track-row {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    min-width: 0;
}

.profile-track-slide--empty {
    min-height: 58px;
}

.profile-track-actions {
    display: flex;
    flex: none;
    align-items: center;
    gap: 0.5rem;
}

.profile-track-play {
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: var(--primary-color);
    color: #fff;
    font-size: 0.7rem;
    cursor: pointer;
    transition: transform 0.15s ease, filter 0.15s ease;
}

.profile-track-play:hover {
    transform: scale(1.06);
    filter: brightness(1.05);
}

.profile-track-slide.is-playing .profile-track-play {
    background: var(--text-secondary);
}

.profile-track-player iframe {
    display: block;
    width: 100%;
    height: 120px;
    border: 0;
    border-radius: var(--radius-lg);
}

.profile-track-slide .track-disc {
    display: grid;
    place-items: center;
    flex: 0 0 48px;
    width: 48px;
    height: 48px;
    border: 1px solid color-mix(in srgb, var(--primary-color) 35%, var(--border-light));
    border-radius: 50%;
    background:
        radial-gradient(circle at center, var(--bg-secondary) 0 18%, transparent 19% 25%, var(--primary-bg-light) 26% 42%, transparent 43%),
        var(--bg-card);
    color: var(--primary-color);
    font-size: 1.35rem;
    box-shadow: 0 4px 12px color-mix(in srgb, var(--primary-color) 16%, transparent);
    transition: transform 0.25s ease;
}

.profile-track-slide:hover .track-disc {
    transform: rotate(12deg);
}

/* 공개 프로필은 순번을 원판 안에 숫자로 넣는다. */
.profile-track-slide .track-disc span {
    font-size: 0.85rem;
    font-weight: 800;
}

.profile-track-artist {
    display: block;
    margin-top: 0.1rem;
    color: var(--text-secondary);
    font-size: 0.82rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.profile-track-external {
    flex: none;
    color: var(--text-muted);
    font-size: 0.78rem;
}

.profile-track-summary {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.profile-track-summary strong {
    display: block;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.track-more {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-left: 0.4rem;
}

.track-widget-label {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.profile-track-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.55rem;
    min-height: 20px;
    margin-top: 0.15rem;
}

.profile-track-dots {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.28rem;
}

.profile-track-dot {
    width: 6px;
    height: 6px;
    padding: 0;
    border: 0;
    border-radius: 999px;
    background: var(--border-medium);
    cursor: pointer;
    transition: width 0.18s ease, background-color 0.18s ease, transform 0.18s ease;
}

.profile-track-dot.is-active {
    width: 18px;
    background: var(--primary-color);
}

.profile-track-dot:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 3px;
}

.profile-track-counter {
    color: var(--text-muted);
    font-size: 0.68rem;
    font-variant-numeric: tabular-nums;
}

/* Body: 개인정보 변경 | 작성글 보기 */
.profile-body-grid {
    display: grid;
    /* 1fr의 최소값은 min-content라, 안쪽에 안 줄어드는 요소가 하나라도 있으면
       컬럼이 컨테이너보다 넓어지며 패널 전체가 화면 밖으로 밀려난다.
       minmax(0, ...)로 최소값을 풀어 좁은 화면에서도 컨테이너 폭을 지키게 한다. */
    grid-template-columns: minmax(0, 1fr);
    gap: 1rem;
    align-items: start;
}

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

.profile-info-panel,
.profile-posts-panel {
    --profile-panel-padding: clamp(1.25rem, 4vw, 2rem);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-2xl, 24px);
    padding: var(--profile-panel-padding);
    box-shadow: var(--shadow-card, 0 12px 36px rgba(0, 0, 0, 0.08));
}

.profile-wrapper .section-title {
    font-family: var(--font-display);
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-light);
    padding-bottom: 1rem;
    color: var(--text-primary);
}

.sub-section {
    margin-bottom: 2.5rem;
}

.sub-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.marketing-consent-row {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    color: var(--text-secondary);
    font-size: 0.875rem;
    line-height: 1.5;
    cursor: pointer;
}

.marketing-consent-row input {
    margin-top: 0.25rem;
    accent-color: var(--primary-color);
}

.marketing-consent-meta {
    margin: 0.6rem 0 0;
    color: var(--text-muted);
    font-size: 0.8rem;
}

.form-row {
    display: flex;
    gap: 1rem;
}

.form-column {
    display: grid;
    gap: 1rem;
}

.email-change-step {
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.error-message {
    color: #ef4444;
    font-size: 0.875rem;
    padding: 0.5rem;
    background: rgba(239, 68, 68, 0.1);
    border-radius: 4px;
    border-left: 3px solid #ef4444;
}

.success-message {
    color: #10b981;
    font-size: 0.875rem;
    padding: 0.5rem;
    background: rgba(16, 185, 129, 0.1);
    border-radius: 4px;
    border-left: 3px solid #10b981;
}

.action-btn {
    background: var(--primary-color);
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 12px;
    font-weight: 600;
    white-space: nowrap;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
}

.action-btn:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

/* 작성글 서브탭 */
.profile-subtabs {
    display: flex;
    gap: 0.25rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-light);
}

.subtab-btn {
    flex: 1;
    min-height: 44px;
    padding: 0.6rem 0.5rem;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-weight: 500;
    cursor: pointer;
    border-bottom: 2px solid transparent;
}

.subtab-btn.active {
    color: var(--text-primary);
    font-weight: 700;
    border-bottom-color: var(--primary-color);
}

/* 작성글 카드 리스트 */
.post-card-list {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

/* 세 탭(작성글·댓글 단 글·반응 표시한 글)은 같은 카드 양식을 쓴다.
   작성글만 패널 패딩을 음수 마진으로 상쇄해 꽉 찬 리스트로 만들던 예외가 있었는데,
   모양이 달라 보이는 것은 물론 패널의 min-content를 컨테이너보다 크게 만들어
   좁은 화면에서 목록이 통째로 밀려나는 원인이기도 했다. */

.post-card {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-xl);
    padding: 0.6rem 0.85rem;
    min-height: 56px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.post-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.post-card--pop {
    border-color: color-mix(in srgb, var(--primary-color, #49c48d) 52%, var(--border-light, #e5e7eb));
    background: linear-gradient(135deg, color-mix(in srgb, var(--primary-color, #49c48d) 10%, transparent), transparent 68%), var(--bg-card);
}

.profile-post-pop-badge {
    display: inline-flex;
    width: 42px;
    height: 19px;
    margin-right: 5px;
    vertical-align: -0.28em;
}

.profile-post-pop-badge img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.profile-post-title-prefix {
    margin-right: 6px;
}

.post-card[hidden] {
    display: none !important;
}

/* 썸네일은 원본이 아니라 저화질 파생본(`-thumb.webp`)이지만 그래도 최대 1280px다.
   크기를 고정하지 않으면 카드가 원본 크기로 늘어난다. */
.post-card-thumb {
    flex: 0 0 auto;
    width: 48px;
    height: 48px;
    border-radius: var(--radius-lg);
    object-fit: cover;
    background: var(--bg-secondary);
}

/* 대체 이미지는 글리프라서 꽉 채우지 않고 안쪽에 여백을 준다. */
.post-card-thumb--placeholder {
    object-fit: contain;
    border: 1px solid var(--border-light);
}

.post-card-body {
    flex: 1;
    min-width: 0;
}

.post-card-title {
    display: block;
    font-weight: 700;
    font-size: 0.95rem;
    line-height: 1.3;
    color: var(--text-primary);
    text-decoration: none;
    margin-bottom: 0.18rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.post-card-title:hover {
    color: var(--primary-color);
}

.post-card-meta {
    font-size: 0.7rem;
    line-height: 1.35;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.post-card-side {
    display: flex;
    flex: none;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.25rem;
}

.post-card-metrics {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    color: var(--text-muted);
    font-size: 0.68rem;
    white-space: nowrap;
}

.post-card-metrics i {
    margin-right: 0.12rem;
}

.post-card-tags {
    display: flex;
    flex-wrap: nowrap;
    gap: 0.3rem;
    max-height: 1.25rem;
    overflow: hidden;
}

.post-card-actions {
    flex: none;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.action-edit {
    color: #7566ff;
    font-weight: 600;
    text-decoration: none;
    font-size: 0.78rem;
}

.action-delete {
    color: #ff6669;
    font-weight: 600;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.78rem;
    padding: 0;
}

.post-list-pagination {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1.5rem;
}

.post-list-pagination .page-ellipsis {
    display: grid;
    place-items: center;
    min-width: 1.25rem;
    color: var(--text-muted);
}

.post-list-pagination .page-btn--arrow:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

/* Settings Section (테마 변경 / 회원 탈퇴) */
.profile-settings {
    margin: 1rem auto 0;
    max-width: var(--profile-frame-width);
}

.settings-group {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    max-width: none;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.settings-item {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 1rem;
    background: transparent;
    border: none;
    border-bottom: none;
    border-right: 1px solid var(--border-light);
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.95rem;
    cursor: pointer;
    transition: background 0.2s;
}

.settings-item:last-child {
    border-right: none;
}

.settings-item i {
    width: 20px;
    text-align: center;
}

.settings-item.delete {
    color: #ef4444;
}

.settings-item:hover {
    background: var(--bg-hover, var(--bg-secondary));
}

.profile-wrapper .empty-state {
    color: var(--text-muted);
    text-align: center;
    padding: 3rem;
}

/* 관심 태그 / 최애곡 편집 팝오버 */
.profile-popover.hidden {
    display: none;
}

body.profile-dialog-open {
    overflow: hidden;
}

.profile-popover {
    position: fixed;
    inset: 0;
    z-index: 1200;
    display: flex;
    align-items: center;
    justify-content: center;
}

.profile-popover-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
}

.profile-popover-panel {
    position: relative;
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    padding: 2rem;
    width: 90%;
    max-width: 640px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.25);
}

.profile-popover-panel h4 {
    margin-bottom: 1.25rem;
    color: var(--text-primary);
}

/* 마이페이지(헤더의 관심 태그 칩·글 카드 태그·팝오버 수정 화면)는 Figma 톤(크림/핑크)을
   그대로 유지 — 온보딩(public/css/onboarding.css의 .onboarding-card 스코프)과는 다른 배색 */
.profile-tag-chips .tag-badge,
.post-card-tags .tag-badge,
.profile-popover-panel .tag-chip,
.profile-popover-panel .tag-autocomplete-item .tag-badge {
    background: #fefdd9;
    border: 1px solid #fcb5b5;
    color: #ff6868;
}

.post-card-tags .tag-badge {
    flex: none;
    padding: 2px 6px;
    font-size: 0.68rem;
    line-height: 1.1;
}

.profile-tag-chips .tag-badge:hover,
.post-card-tags .tag-badge:hover,
.profile-popover-panel .tag-chip:hover,
.profile-popover-panel .tag-autocomplete-item:hover {
    background: #fdf6b8;
}

.profile-popover-panel .track-input {
    background: #ffe2e2;
}

[data-theme="dark"] .profile-popover-panel .track-input {
    background: rgba(255, 130, 130, 0.18);
    color: var(--text-primary);
}

.profile-popover-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.cancel-btn {
    background: var(--bg-secondary);
    color: var(--text-secondary);
    padding: 0.75rem 1.5rem;
    border-radius: 12px;
    font-weight: 600;
    border: none;
    cursor: pointer;
}

@media (max-width: 768px) {
    .profile-wrapper {
        margin-top: 1rem;
        margin-bottom: 1rem;
    }

    /* 마이페이지 상단 카드도 아래 정보 카드와 동일한 content-wrapper 폭과
       좌우 여백을 사용한다. 커버의 12:5 비율과 둥근 모서리는 유지한다. */
    .profile-wrapper--own .profile-header-card {
        position: static;
        width: 100%;
        max-width: none;
        margin-left: 0;
        margin-right: 0;
        box-sizing: border-box;
        border-left: 1px solid var(--border-color);
        border-right: 1px solid var(--border-color);
        border-radius: var(--radius-2xl, 24px);
    }

    /* 모바일 마이페이지의 모든 패널은 같은 content-wrapper 안에서
       가운데 폭을 공유한다. 내부 목록 카드도 패널 밖으로 밀려나지 않게 한다. */
    .profile-wrapper--own .profile-body-grid,
    .profile-wrapper--own .profile-info-panel,
    .profile-wrapper--own .profile-posts-panel,
    .profile-wrapper--own .profile-settings,
    .profile-wrapper--own .settings-group,
    .profile-wrapper--own .post-card-list,
    .profile-wrapper--own .post-card {
        width: 100%;
        max-width: 100%;
        margin-left: auto;
        margin-right: auto;
    }

    .profile-wrapper--own .profile-body-grid {
        justify-items: center;
    }

    /* 좁은 화면에선 패널 여백이 카드에 쓸 폭을 그대로 깎아먹는다.
       바깥(main 1rem)은 그대로 두고 패널 안쪽만 줄여 제목이 더 보이게 한다. */
    .profile-info-panel,
    .profile-posts-panel {
        --profile-panel-padding: 0.75rem;
        padding: 1.25rem 0.75rem;
    }

    .post-card {
        gap: 0.6rem;
        padding: 0.55rem 0.6rem;
        min-height: 58px;
    }

    .post-card-thumb {
        width: 46px;
        height: 46px;
    }

    /* 내 마이페이지의 작성글은 텍스트 목록 전용이다. 이전 캐시/마크업이 남아도
       모바일에서 게시글 썸네일이 노출되지 않게 방어한다. */
    .profile-wrapper--own .post-card-thumb {
        display: none !important;
    }

    .post-card-actions {
        flex-direction: column;
        width: auto;
        gap: 0.25rem;
    }

    .profile-track-widget {
        padding: 0.75rem 0.75rem 0.6rem;
    }

    .profile-track-slide {
        padding-inline: 0.1rem;
    }

    .profile-track-row {
        gap: 0.65rem;
    }
}

@media (max-width: 520px) {
    .profile-identity { gap: 0.875rem; }

    .profile-stats-inline {
        gap: 0.4rem;
    }

    .profile-stat {
        display: grid;
        gap: 0;
    }

    .form-row {
        flex-direction: column;
    }

    .form-row .action-btn {
        width: 100%;
    }

    .profile-popover-panel {
        width: calc(100% - 2rem);
        padding: 1.25rem;
    }

    .post-list-pagination .page-btn:not(.active):not(.page-btn--arrow),
    .post-list-pagination .page-ellipsis {
        display: none;
    }
}
