/*
 * 마이페이지 — Figma image 46(데스크톱) · 44(모바일). 색상은 tokens.css 의미 토큰만 (옅은 배경은 color-mix).
 * community.css 의 cm-badge · cm-tone · cm-paging 을 함께 쓴다.
 */
.legacy-page:has(> .mp) { padding-top: 24px; }
.mp { --mp-accent: var(--c-accent); display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 28px; align-items: start; padding-bottom: 64px; color: var(--c-text); }
.mp a { color: inherit; }
.mp svg { width: 18px; height: 18px; flex: none; }

/* ─── 왼쪽 메뉴 ─── */
.mp-nav { position: sticky; top: calc(var(--header-h) + 16px); display: grid; gap: 16px; }
.mp-nav__title { display: flex; align-items: center; gap: 10px; margin: 6px 8px 4px; font-size: 22px; font-weight: 800; }
.mp-nav__title svg { width: 26px; height: 26px; }
.mp-nav ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.mp-nav a { display: flex; align-items: center; gap: 12px; height: 48px; padding: 0 14px; border-radius: var(--radius-md); font-size: 16px; font-weight: 500; color: var(--c-text); }
.mp-nav a:hover { background: var(--c-surface-2); color: var(--c-text); }
.mp-nav a.is-active { background: var(--c-accent-strong); color: var(--c-on-accent); font-weight: 700; }
.mp-nav a span:first-of-type { flex: 1; }
.mp-nav .mp-nav__arrow { width: 16px; height: 16px; }
.mp-badge-count { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: var(--radius-pill); background: var(--c-accent-strong); color: var(--c-on-accent); font-size: 12px; font-weight: 800; }
.mp-nav__promo { color: var(--c-text); display: grid; justify-items: center; gap: 8px; padding: 22px 16px; text-align: center; border-radius: var(--radius-lg); border: 1px solid var(--c-border);
  background: linear-gradient(160deg, color-mix(in srgb, var(--mp-accent) 14%, var(--c-surface)), var(--c-surface)); }
.mp-nav__promo svg { width: 36px; height: 36px; color: var(--c-rank-gold); }
.mp-nav__promo strong { font-size: 17px; }
.mp-nav__promo span { font-size: 13px; color: var(--c-text-muted); line-height: 1.5; }

/* ─── 본문 머리 ─── */
.mp-main { min-width: 0; display: grid; gap: 18px; }
.mp-head { position: relative; padding: 8px 0 6px; overflow: hidden; }
.mp-head h1 { margin: 0 0 6px; font-size: clamp(26px, 3.4vw, 36px); font-weight: 800; letter-spacing: -.02em; }
.mp-head p { margin: 0; color: var(--c-text-muted); }
.mp-head__art { position: absolute; right: 12px; top: -14px; color: var(--mp-accent); opacity: .55; filter: drop-shadow(0 0 18px color-mix(in srgb, var(--mp-accent) 60%, transparent)); pointer-events: none; }
.mp .mp-head__art svg { width: 120px; height: 120px; stroke-width: 1.2; transform: rotate(-12deg); }
.mp-flash { margin: 0; padding: 12px 16px; border-radius: var(--radius-md); background: color-mix(in srgb, var(--c-success) 14%, transparent); color: var(--c-text); }
.mp-flash--error { background: color-mix(in srgb, var(--c-danger) 14%, transparent); }

/* ─── 프로필 카드 ─── */
.mp-profile { position: relative; display: flex; gap: 24px; align-items: center; padding: 22px 26px; border-radius: var(--radius-lg); border: 1px solid var(--c-border);
  background: linear-gradient(110deg, color-mix(in srgb, var(--mp-accent) 8%, var(--c-surface)), var(--c-surface) 60%); }
.mp-avatar { display: inline-grid; place-items: center; flex: none; border-radius: 50%; overflow: hidden; background: var(--c-surface-2); color: var(--c-text);
  box-shadow: 0 0 0 3px var(--c-surface), 0 0 0 5px color-mix(in srgb, var(--mp-accent) 60%, transparent); font-weight: 800; }
.mp-avatar img { width: 100%; height: 100%; object-fit: cover; }
.mp-avatar--xl { width: 112px; height: 112px; font-size: 40px; }
.mp-avatar--lg { width: 72px; height: 72px; font-size: 28px; }
.mp-profile__body { flex: 1; min-width: 0; display: grid; gap: 8px; }
.mp-profile__name { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.mp-profile__name h2 { margin: 0; font-size: 26px; font-weight: 800; }
.mp-pill { display: inline-flex; align-items: center; height: 28px; padding: 0 12px; border-radius: var(--radius-pill); border: 1px solid var(--c-border-strong); font-size: 13px; font-weight: 600; color: var(--c-text); }
.mp-profile__meta { margin: 0; display: flex; gap: 10px; color: var(--c-text-muted); font-size: 15px; flex-wrap: wrap; }
.mp-sep { opacity: .5; }
.mp-level { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 4px; }
.mp-level__lv { font-size: 24px; font-weight: 800; }
.mp-grade { display: inline-flex; align-items: center; height: 28px; padding: 0 12px; border-radius: var(--radius-pill); font-size: 13px; font-weight: 800;
  color: var(--c-rank-gold); background: color-mix(in srgb, var(--c-rank-gold) 18%, transparent); border: 1px solid color-mix(in srgb, var(--c-rank-gold) 50%, transparent); }
.mp-grade--0 { color: var(--c-rank-bronze); background: color-mix(in srgb, var(--c-rank-bronze) 18%, transparent); border-color: color-mix(in srgb, var(--c-rank-bronze) 50%, transparent); }
.mp-grade--1 { color: var(--c-rank-silver); background: color-mix(in srgb, var(--c-rank-silver) 18%, transparent); border-color: color-mix(in srgb, var(--c-rank-silver) 50%, transparent); }
.mp-grade--3 { color: var(--c-tone-6); background: color-mix(in srgb, var(--c-tone-6) 18%, transparent); border-color: color-mix(in srgb, var(--c-tone-6) 50%, transparent); }
.mp-grade--4 { color: var(--c-tone-1); background: color-mix(in srgb, var(--c-tone-1) 18%, transparent); border-color: color-mix(in srgb, var(--c-tone-1) 50%, transparent); }
.mp-level__bar { flex: 1 1 240px; max-width: 360px; height: 12px; border-radius: var(--radius-pill); background: var(--c-surface-2); overflow: hidden; }
.mp-level__bar span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--c-accent-strong), var(--c-accent)); }
.mp-level__xp { font-size: 14px; color: var(--c-text-muted); font-weight: 600; }
.mp-level__next { margin: 0; font-size: 13px; color: var(--c-text-muted); }
.mp-profile__edit { position: absolute; top: 22px; right: 26px; }

/* ─── 통계 ─── */
.mp-stats { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; }
.mp-stats li { display: flex; align-items: center; gap: 14px; padding: 18px; border-radius: var(--radius-lg); border: 1px solid var(--c-border); background: var(--c-surface); }
.mp-stats__icon { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 50%; flex: none; color: var(--cm-tone); background: color-mix(in srgb, var(--cm-tone) 18%, transparent); }
.mp .mp-stats__icon svg { width: 24px; height: 24px; }
.mp-stats small { display: block; color: var(--c-text-muted); font-size: 13px; }
.mp-stats strong { font-size: 22px; font-weight: 800; }

/* ─── 카드 ─── */
.mp-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.mp-col { display: grid; gap: 18px; min-width: 0; }
.mp-card { min-width: 0; padding: 18px 20px; border-radius: var(--radius-lg); border: 1px solid var(--c-border); background: var(--c-surface); }
.mp-card__head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.mp-card__head h2 { margin: 0; display: flex; align-items: center; gap: 8px; font-size: 18px; font-weight: 800; }
.mp-card__head h2 strong { color: var(--c-accent-text); }
.mp-card .more-link { display: inline-flex; align-items: center; gap: 2px; font-size: 13px; color: var(--c-text-muted); }
.mp-card .more-link svg { width: 14px; height: 14px; }
.mp-empty { margin: 0; padding: 20px 4px; color: var(--c-text-muted); }
.mp-empty a { color: var(--c-accent-text); text-decoration: underline; }

.mp-games { list-style: none; margin: 0; padding: 0; }
.mp-games li { display: flex; align-items: center; gap: 14px; padding: 12px 0; }
.mp-games li + li { border-top: 1px solid var(--c-border); }
.mp-games__thumb { width: 96px; height: 64px; flex: none; border-radius: var(--radius-sm); overflow: hidden; background: var(--c-surface-2); }
.mp-games__thumb img { width: 100%; height: 100%; object-fit: cover; }
.mp-games__info { flex: 1; min-width: 0; display: grid; gap: 6px; }
.mp-games__title { font-weight: 800; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mp-games__title:hover { color: var(--c-accent-text); }
.mp-games__tags { display: flex; gap: 6px; flex-wrap: wrap; }
.mp-games__tags span { padding: 2px 10px; border-radius: var(--radius-pill); background: var(--c-surface-2); font-size: 12px; color: var(--c-text-muted); }
.mp-games__when { display: grid; font-size: 13px; color: var(--c-text-muted); text-align: left; min-width: 92px; }
.mp-games__when small { font-size: 12px; }

.mp-favs { position: relative; }
.mp-favs__track { list-style: none; margin: 0; padding: 4px 2px; display: flex; gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
.mp-favs__track::-webkit-scrollbar { display: none; }
.mp-favs__track li { flex: 0 0 92px; scroll-snap-align: start; }
.mp-favs__track a { display: grid; justify-items: center; gap: 6px; text-align: center; }
.mp-favs__thumb { width: 84px; height: 84px; border-radius: var(--radius-md); overflow: hidden; background: var(--c-surface-2); }
.mp-favs__thumb img { width: 100%; height: 100%; object-fit: cover; }
.mp-favs__name { font-size: 13px; font-weight: 600; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.mp-favs__heart { color: var(--c-danger); }
.mp .mp-favs__heart svg { width: 16px; height: 16px; }
.mp-favs .carousel__btn { top: 30px; }

.mp-activity, .mp-notes, .mp-list { list-style: none; margin: 0; padding: 0; }
.mp-activity li { display: flex; align-items: center; gap: 12px; padding: 10px 0; font-size: 14px; }
.mp-activity li + li, .mp-notes li + li, .mp-list li + li { border-top: 1px solid var(--c-border); }
.mp-activity__icon { display: grid; place-items: center; width: 32px; height: 32px; border-radius: var(--radius-sm); flex: none; color: var(--c-accent-text); background: color-mix(in srgb, var(--mp-accent) 18%, transparent); }
.mp .mp-activity__icon svg { width: 16px; height: 16px; }
.mp-activity__label { flex: 1; min-width: 0; }
.mp-xp { font-weight: 800; color: var(--c-success); white-space: nowrap; }
.mp-xp.is-minus { color: var(--c-danger); }
.mp-activity time, .mp-notes time { color: var(--c-text-muted); font-size: 13px; white-space: nowrap; }

.mp-notes a { display: flex; align-items: center; gap: 12px; padding: 12px 4px; }
.mp-notes__body { flex: 1; min-width: 0; display: grid; gap: 2px; }
.mp-notes__body small { color: var(--c-text-muted); font-size: 12px; }
.mp-notes li.is-unread .mp-notes__body { font-weight: 700; }
.mp-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--c-accent); flex: none; }

.mp-list li { display: flex; align-items: center; gap: 10px; padding: 12px 2px; flex-wrap: wrap; }
.mp-list__title { flex: 1 1 260px; min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mp-list__title:hover { color: var(--c-accent-text); }
.mp-list__meta { display: inline-flex; align-items: center; gap: 4px; color: var(--c-text-muted); font-size: 13px; }
.mp .mp-list__meta svg { width: 14px; height: 14px; }
.mp-list--comments li { display: grid; gap: 4px; }

.mp-table-wrap { overflow-x: auto; }
.mp-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.mp-table th, .mp-table td { padding: 12px 10px; border-bottom: 1px solid var(--c-border); text-align: left; white-space: nowrap; }
.mp-table th { color: var(--c-text-muted); font-weight: 600; }
.mp-table a { color: var(--c-accent-text); font-weight: 700; }

.mp-fav-grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }

.mp-settings__row { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; margin-bottom: 18px; }
.mp-settings__avatar, .mp-settings__form { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.mp-field { display: grid; gap: 6px; font-size: 14px; font-weight: 600; }
.mp-field small { color: var(--c-text-muted); font-weight: 400; }
.mp-field input[type=text] { width: 280px; max-width: 100%; height: 40px; padding: 0 14px; border: 1px solid var(--c-border-strong); border-radius: var(--radius-md); background: var(--c-bg); color: var(--c-text); font: inherit; }
.mp-field input[type=file] { color: var(--c-text-muted); font-weight: 400; }
.mp-dl { display: grid; grid-template-columns: 100px 1fr; gap: 12px 16px; margin: 0; align-items: center; }
.mp-dl dt { color: var(--c-text-muted); }
.mp-dl dd { margin: 0; }

/* ─── 반응형 (image 44) ─── */
@media (max-width: 1100px) { .mp-grid { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 900px) {
  .mp { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .mp-nav { position: static; }
  .mp-nav__title, .mp-nav__promo { display: none; }
  .mp-nav ul { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; border-bottom: 1px solid var(--c-border); padding-bottom: 6px; }
  .mp-nav li { flex: none; }
  .mp-nav a { height: 40px; padding: 0 14px; font-size: 14px; white-space: nowrap; }
  .mp-nav a.is-active { background: none; color: var(--c-accent-text); box-shadow: inset 0 -3px 0 var(--c-accent); border-radius: 0; }
  .mp-nav .mp-nav__arrow { display: none; }
}
@media (max-width: 640px) {
  .mp-profile { flex-direction: column; align-items: flex-start; padding: 18px; }
  .mp-avatar--xl { width: 88px; height: 88px; font-size: 32px; }
  .mp-profile__edit { top: 18px; right: 18px; }
  .mp-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mp-games__when { display: none; }
  .mp-games .btn span { display: none; }
  .mp-head__art { display: none; }
}

/* 배지 (image 45) */
.mp-badges { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 14px; }
.mp-badges li { display: grid; justify-items: center; gap: 8px; padding: 18px 10px; text-align: center; border-radius: var(--radius-lg); border: 1px solid var(--c-border); background: var(--c-surface-2); }
.mp-badges__icon { display: grid; place-items: center; width: 64px; height: 64px; border-radius: 18px; color: var(--c-on-accent); background: linear-gradient(135deg, var(--c-accent), var(--c-accent-strong)); box-shadow: 0 6px 18px color-mix(in srgb, var(--c-accent) 35%, transparent); }
.mp .mp-badges__icon svg { width: 30px; height: 30px; }
.mp-badges strong { font-size: 14px; }
.mp-badges small { font-size: 12px; color: var(--c-text-muted); }
.mp-badges li.is-locked { opacity: .55; }
.mp-badges li.is-locked .mp-badges__icon { background: var(--c-surface); color: var(--c-text-muted); box-shadow: none; border: 1px solid var(--c-border-strong); }
