/* ============================================================
   META — 메타 게임 패널 10종
   (미션 / 출석 / 시즌 패스 / 룰렛 / 랭킹 / 도감 / 상점 / 클라우드 저장 / 프레스티지 / 업적)
   공통 골격은 base.css 의 ui-overlay / ui-sheet / ui-sheet__head / ui-sheet__body /
   ui-close / ui-btn / ui-tabs 를 그대로 쓰고, 여기서는
     1) 패널 공통 확장 (.meta-overlay / .meta-sheet / .meta-sheet__bar)
     2) 패널별 헤더 색 + 내용물
     3) 모바일 가로 / 넓은 화면 보정
   만 정의한다. 색은 base.css 토큰만 사용.
   ============================================================ */

/* ===== 1. 공통 골격 ===== */
.meta-overlay { animation: fadeIn 0.2s ease-out; }
#achievement-overlay.hidden, #ranking-overlay.hidden, #sync-overlay.hidden,
#prestige-overlay.hidden, #spin-overlay.hidden, #season-overlay.hidden,
#shop-overlay.hidden, #attendance-overlay.hidden, #collection-overlay.hidden,
#missions-overlay.hidden { display: none; }

/* 레이어 순서 (기존 값 유지) */
#achievement-overlay, #missions-overlay, #collection-overlay { z-index: 750; }
#season-overlay, #shop-overlay, #attendance-overlay { z-index: 755; }
#ranking-overlay { z-index: 757; }
#spin-overlay, #sync-overlay { z-index: 758; }
#prestige-overlay { z-index: 760; }

.meta-sheet {
    --head: var(--purple); --head-d: var(--purple-d);
    --tint: var(--panel-2);
}
.meta-sheet > .ui-sheet__head {
    position: relative;
    background:
        linear-gradient(180deg, rgba(255,255,255,0.28), rgba(255,255,255,0) 55%),
        linear-gradient(180deg, var(--head), var(--head-d));
    box-shadow: inset 0 -4px 0 rgba(0,0,0,0.18);
}
.meta-sheet .ui-sheet__title {
    min-width: 0;
    font-size: 20px; line-height: 1.2; letter-spacing: 0.3px;
    text-shadow: 0 2px 0 rgba(0,0,0,0.3);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.meta-sheet .ui-close { font-size: 26px; }

/* 헤더 아래 고정 영역 (탭 / 진행도 등 스크롤되지 않는 띠) */
.meta-sheet__bar {
    flex: none;
    padding: 12px var(--gutter);
    background: var(--bg-1);
    border-bottom: var(--line) solid var(--ink);
}
.meta-sheet__bar:empty { display: none; }

/* 패널별 헤더 색 */
#missions-panel    { --head: var(--blue);   --head-d: var(--blue-d); }
#attendance-panel  { --head: var(--orange); --head-d: var(--orange-d); }
#season-panel      { --head: var(--purple); --head-d: var(--purple-d); }
#spin-panel        { --head: var(--pink);   --head-d: var(--pink-d); }
#ranking-panel     { --head: var(--orange); --head-d: var(--red-d); }
#collection-panel  { --head: var(--green);  --head-d: var(--green-d); }
#shop-panel        { --head: var(--blue);   --head-d: var(--purple-d); }
#sync-panel        { --head: var(--blue);   --head-d: var(--blue-d); }
#achievement-panel { --head: var(--yellow); --head-d: var(--orange-d); }

/* 공용 안내문 (출석/시즌/클라우드에서 함께 사용) */
.attendance-hint {
    font-size: var(--fs-sm); font-weight: 600; line-height: 1.5;
    color: var(--text-dim);
    word-break: keep-all; overflow-wrap: anywhere;
}
.mission-desc, .achievement-card-desc, .achievement-card-title, .collection-skill-desc,
.season-tier-reward, #prestige-desc, .ranking-loading, .ranking-hint { word-break: keep-all; overflow-wrap: anywhere; }

/* 공용 진행 바 (미션 + 시즌) — ui-progress 와 같은 모양 */
.mission-bar {
    height: 16px; border-radius: var(--r-pill);
    border: 2px solid var(--ink); background: var(--ink);
    overflow: hidden;
}
.mission-fill {
    height: 100%; min-width: 0; border-radius: inherit;
    background: linear-gradient(180deg, rgba(255,255,255,0.5), rgba(255,255,255,0) 55%), var(--yellow);
    transition: width 0.4s var(--ease-out);
}

@keyframes meta-pop {
    0% { transform: scale(0.5); opacity: 0; }
    60% { transform: scale(1.18); opacity: 1; }
    100% { transform: none; opacity: 1; }
}
@keyframes meta-glow {
    0%, 100% { box-shadow: 0 0 0 0 rgba(255,255,255,0), 0 4px 0 rgba(0,0,0,0.25); }
    50% { box-shadow: 0 0 0 5px var(--glow, var(--yellow)), 0 4px 0 rgba(0,0,0,0.25); }
}
@keyframes meta-bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }
@keyframes meta-shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-4px); }
    75% { transform: translateX(4px); }
}

/* ===== 2. 오늘의 미션 ===== */
#missions-list { display: flex; flex-direction: column; gap: 12px; }
.mission-card {
    display: flex; align-items: center; gap: 12px;
    padding: 12px;
    border: var(--line) solid var(--ink); border-radius: var(--r-md);
    background: var(--panel-2);
    box-shadow: inset 0 2px 0 rgba(255,255,255,0.1), 0 4px 0 rgba(0,0,0,0.25);
}
.mission-icon {
    flex: none; width: 52px; height: 52px;
    display: flex; align-items: center; justify-content: center;
    border: 2px solid var(--ink); border-radius: 14px;
    background: var(--bg-1);
    box-shadow: inset 0 -3px 0 rgba(0,0,0,0.3);
    font-size: 28px; line-height: 1;
}
.mission-info { flex: 1; min-width: 0; }
.mission-desc {
    margin-bottom: 7px;
    font-size: var(--fs-md); font-weight: 900; line-height: 1.25;
    text-shadow: var(--text-shadow);
}
.mission-progress-text {
    margin-top: 4px;
    font-size: var(--fs-xs); font-weight: 800; color: var(--text-dim);
    font-variant-numeric: tabular-nums;
}
.mission-reward {
    flex: none;
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 68px; min-height: 40px; padding: 0 10px 3px;
    border: 2px solid var(--ink); border-radius: var(--r-pill);
    background: var(--yellow);
    box-shadow: inset 0 -4px 0 var(--yellow-d);
    color: var(--text-on-bright);
    font-size: var(--fs-md); font-weight: 900; white-space: nowrap;
    font-variant-numeric: tabular-nums;
}
.mission-card.done {
    background: var(--green-d);
    background: color-mix(in srgb, var(--green) 26%, var(--panel-2));
}
.mission-card.done .mission-icon { background: var(--green-d); }
.mission-card.done .mission-desc { color: var(--c-accent-soft); }
.mission-card.done .mission-fill { background: linear-gradient(180deg, rgba(255,255,255,0.5), rgba(255,255,255,0) 55%), var(--green); }
.mission-card.done .mission-reward {
    min-width: 44px; width: 44px; height: 44px; padding: 0 0 3px;
    border-radius: 50%;
    background: var(--green);
    box-shadow: inset 0 -4px 0 var(--green-d);
    color: #fff; font-size: 22px;
    text-shadow: 0 2px 0 rgba(0,0,0,0.25);
}

/* ===== 3. 출석 체크 ===== */
#attendance-panel .attendance-hint { margin-bottom: 14px; }
#attendance-grid {
    display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px;
    margin-bottom: 18px;
}
.attendance-cell {
    display: flex; flex-direction: column; align-items: center; justify-content: space-between;
    min-height: 104px;
    border: var(--line) solid var(--ink); border-radius: var(--r-md);
    background: var(--panel-2);
    box-shadow: inset 0 2px 0 rgba(255,255,255,0.1), 0 4px 0 rgba(0,0,0,0.25);
    overflow: hidden; text-align: center;
}
.attendance-cell-day {
    align-self: stretch;
    padding: 4px 0;
    background: var(--bg-1);
    font-size: var(--fs-xs); font-weight: 900; color: var(--text-dim);
}
.attendance-cell-mark { font-size: 30px; line-height: 1; }
.attendance-cell-coins {
    padding-bottom: 8px;
    font-size: var(--fs-md); font-weight: 900; color: var(--yellow);
    text-shadow: var(--text-shadow); font-variant-numeric: tabular-nums;
}
/* 7일차 = 큰 보상 타일 (2칸) */
.attendance-cell:last-child {
    grid-column: span 2;
    background: linear-gradient(180deg, var(--orange), var(--orange-d));
}
.attendance-cell:last-child:not(.claimed):not(.today) .attendance-cell-coins { color: var(--c-accent-soft); }
.attendance-cell:last-child .attendance-cell-day { background: var(--orange-d); color: #fff; }
.attendance-cell:last-child .attendance-cell-mark { font-size: 38px; }
.attendance-cell:last-child .attendance-cell-coins { font-size: var(--fs-lg); }
/* 오늘 */
.attendance-cell.today {
    --glow: var(--yellow);
    border-color: var(--ink);
    background: var(--yellow);
    animation: meta-glow 1.4s ease-in-out infinite;
}
.attendance-cell.today .attendance-cell-day { background: var(--yellow-d); color: #fff; }
.attendance-cell.today .attendance-cell-mark { animation: meta-bob 1.4s ease-in-out infinite; }
.attendance-cell.today .attendance-cell-coins { color: var(--text-on-bright); text-shadow: 0 1px 0 rgba(255,255,255,0.45); }
/* 받은 날 */
.attendance-cell.claimed {
    background: var(--green-d);
    background: color-mix(in srgb, var(--green) 22%, var(--panel));
    box-shadow: none;
}
.attendance-cell.claimed .attendance-cell-day { background: var(--green-d); color: #fff; }
.attendance-cell.claimed .attendance-cell-mark {
    width: 34px; height: 34px;
    display: flex; align-items: center; justify-content: center;
    border: 2px solid var(--ink); border-radius: 50%;
    background: var(--green); box-shadow: inset 0 -3px 0 var(--green-d);
    color: #fff; font-size: 18px; font-weight: 900;
}
.attendance-cell.claimed .attendance-cell-coins { color: var(--text-faint); text-shadow: none; }
#attendance-claim-btn { font-size: var(--fs-lg); }
#attendance-claim-btn:disabled { font-size: var(--fs-md); }

/* ===== 4. 시즌 패스 ===== */
.season-progress-row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.season-tier-badge {
    flex: none;
    display: inline-flex; align-items: center;
    min-height: 34px; padding: 0 14px 3px;
    border: 2px solid var(--ink); border-radius: var(--r-pill);
    background: var(--yellow); box-shadow: inset 0 -4px 0 var(--yellow-d);
    color: var(--text-on-bright);
    font-size: var(--fs-md); font-weight: 900; white-space: nowrap;
}
.season-bar { flex: 1; min-width: 0; height: 20px; }
.season-bar .mission-fill { background: linear-gradient(180deg, rgba(255,255,255,0.5), rgba(255,255,255,0) 55%), var(--purple); }
.season-sp-text {
    flex: none;
    font-size: var(--fs-sm); font-weight: 900; color: var(--text);
    white-space: nowrap; font-variant-numeric: tabular-nums;
}
#season-progress .attendance-hint { font-size: 12px; }
#season-tiers { min-height: 160px; }

/* 티어 트랙: 왼쪽 세로선 + 번호 노드, 오른쪽 보상 카드 */
.season-tier {
    position: relative;
    display: flex; align-items: center; gap: 12px;
    padding: 5px 0;
}
.season-tier::before {
    content: ''; position: absolute; left: 18px; top: 0; bottom: 0; width: 8px;
    background: var(--ink);
}
.season-tier:first-child::before { top: 50%; }
.season-tier:last-child::before { bottom: 50%; }
.season-tier.claimed::before { background: linear-gradient(90deg, var(--ink) 0 2px, var(--green) 2px 6px, var(--ink) 6px); }
.season-tier-num {
    position: relative; flex: none;
    width: 44px; height: 44px;
    display: flex; align-items: center; justify-content: center;
    border: var(--line) solid var(--ink); border-radius: 50%;
    background: var(--gray-d);
    box-shadow: inset 0 -4px 0 rgba(0,0,0,0.25);
    color: var(--text-dim);
    font-size: var(--fs-md); font-weight: 900; font-variant-numeric: tabular-nums;
}
.season-tier-card {
    flex: 1; min-width: 0;
    display: flex; align-items: center; gap: 10px;
    min-height: 52px; padding: 8px 12px;
    border: var(--line) solid var(--ink); border-radius: var(--r-md);
    background: var(--panel-2);
    box-shadow: 0 3px 0 rgba(0,0,0,0.25);
}
.season-tier-reward { flex: 1; min-width: 0; font-size: var(--fs-md); font-weight: 900; line-height: 1.25; color: var(--text-dim); }
.season-tier-state {
    flex: none;
    padding: 4px 10px; border-radius: var(--r-pill);
    background: var(--ink);
    font-size: var(--fs-xs); font-weight: 900; color: var(--text-dim);
    white-space: nowrap; font-variant-numeric: tabular-nums;
}
/* 받은 티어 */
.season-tier.claimed .season-tier-num { background: var(--green); box-shadow: inset 0 -4px 0 var(--green-d); color: #fff; text-shadow: var(--text-shadow); }
.season-tier.claimed .season-tier-card {
    background: var(--green-d);
    background: color-mix(in srgb, var(--green) 22%, var(--panel));
    box-shadow: none;
}
.season-tier.claimed .season-tier-reward { color: var(--text); }
.season-tier.claimed .season-tier-state {
    width: 30px; height: 30px; padding: 0;
    display: flex; align-items: center; justify-content: center;
    border: 2px solid var(--ink); border-radius: 50%;
    background: var(--green); color: #fff; font-size: 16px;
}
/* 다음 목표 티어 */
.season-tier.current .season-tier-num {
    --glow: var(--yellow);
    width: 48px; height: 48px; margin: 0 -2px;
    background: var(--yellow); box-shadow: inset 0 -4px 0 var(--yellow-d);
    color: var(--text-on-bright); font-size: var(--fs-lg);
    animation: meta-glow 1.4s ease-in-out infinite;
}
.season-tier.current .season-tier-card {
    min-height: 64px;
    border-color: var(--ink);
    background: var(--panel-3);
    box-shadow: inset 0 0 0 3px var(--yellow), 0 4px 0 rgba(0,0,0,0.3);
}
.season-tier.current .season-tier-reward { color: #fff; font-size: var(--fs-lg); text-shadow: var(--text-shadow); }
.season-tier.current .season-tier-state { background: var(--yellow); color: var(--text-on-bright); font-size: var(--fs-sm); }

/* ===== 5. 행운의 룰렛 ===== */
.spin-body {
    display: flex; flex-direction: column; align-items: center; gap: 12px;
    background: radial-gradient(circle at 50% 34%, var(--panel-3), var(--panel) 62%);
}
#spin-wheel-wrap {
    --wheel: min(300px, calc(100vw - 72px), calc(100dvh - 330px));
    position: relative; flex: none;
    width: var(--wheel); height: var(--wheel);
    min-width: 200px; min-height: 200px;
    margin: 14px 0 6px;
}
#spin-pointer {
    position: absolute; top: -16px; left: 50%; z-index: 3;
    width: 36px; height: 40px; margin-left: -18px;
    font-size: 0; color: transparent;
    background: var(--red);
    clip-path: polygon(0 0, 100% 0, 50% 100%);
    filter: none;
}
/* 포인터 외곽선: clip-path 는 테두리를 못 그리므로 뒤에 한 겹 더 */
#spin-wheel-wrap::before {
    content: ''; position: absolute; top: -20px; left: 50%; z-index: 2;
    width: 48px; height: 52px; margin-left: -24px;
    background: var(--ink);
    clip-path: polygon(0 0, 100% 0, 50% 100%);
}
#spin-wheel {
    position: relative;
    width: 100%; height: 100%;
    border: 9px solid var(--yellow); border-radius: 50%;
    box-shadow: 0 0 0 var(--line) var(--ink), inset 0 0 0 var(--line) var(--ink), 0 10px 0 rgba(0,0,0,0.3);
    will-change: transform;
}
/* 칸 구분선 (--slice 는 JS 가 칸 수에 맞춰 넣어 준다) */
#spin-wheel::after {
    content: ''; position: absolute; inset: 0; border-radius: 50%;
    background: repeating-conic-gradient(from -0.6deg, var(--ink) 0 1.2deg, transparent 1.2deg var(--slice, 45deg));
    pointer-events: none;
}
.spin-label {
    position: absolute; top: 0; left: 50%;
    width: 50%; height: 50%;
    transform-origin: left bottom;       /* 휠 중심 기준 회전 */
    pointer-events: none; z-index: 1;
}
.spin-label span {
    position: absolute; top: 32px; left: -36px;
    width: 72px;
    text-align: center; white-space: nowrap;
    font-size: var(--fs-md); font-weight: 900; line-height: 1.2;
    color: var(--ink);
    text-shadow: 0 1px 0 rgba(255,255,255,0.5);
    transform: rotate(90deg);
}
.spin-label.jackpot span { color: var(--text-on-bright); }
#spin-hub {
    position: absolute; top: 50%; left: 50%; z-index: 2;
    width: 68px; height: 68px; margin: -34px 0 0 -34px;
    display: flex; align-items: center; justify-content: center;
    border: var(--line) solid var(--ink); border-radius: 50%;
    background: linear-gradient(180deg, rgba(255,255,255,0.35), rgba(255,255,255,0) 50%), var(--pink);
    box-shadow: inset 0 -5px 0 var(--pink-d), 0 4px 0 rgba(0,0,0,0.3);
    padding-bottom: 4px;
    color: #fff; font-size: var(--fs-md); font-weight: 900; letter-spacing: 0.5px;
    text-shadow: 0 2px 0 rgba(0,0,0,0.3);
}
.spin-actions { align-self: stretch; display: flex; flex-direction: column; align-items: stretch; gap: 10px; }
#spin-result {
    min-height: 38px;
    display: flex; align-items: center; justify-content: center;
    text-align: center;
}
.spin-win, .spin-jackpot {
    display: inline-block;
    font-size: 28px; font-weight: 900; color: var(--yellow);
    text-shadow: var(--text-outline);
    animation: meta-pop 0.45s var(--ease-bounce) both;
}
.spin-jackpot { font-size: 30px; color: var(--c-accent-soft); }
#spin-go-btn { font-size: var(--fs-lg); line-height: 1.2; }
#spin-go-btn.spin-go-free {
    --btn: var(--yellow); --btn-d: var(--yellow-d); --btn-text: var(--text-on-bright); --glow: var(--c-accent-soft);
    font-size: var(--fs-xl); text-shadow: 0 1px 0 rgba(255,255,255,0.45);
    animation: spin-go-pulse 1.3s ease-in-out infinite;
}
@keyframes spin-go-pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.035); } }
#spin-go-btn.spin-go-free:active { animation: none; }
#spin-go-btn.spin-go-ad { --btn: var(--green); --btn-d: var(--green-d); --btn-text: #06331c; text-shadow: 0 1px 0 rgba(255,255,255,0.4); }
#spin-go-btn.spin-go-paid { --btn: var(--purple); --btn-d: var(--purple-d); }
#spin-go-btn.spin-go-done { --btn: var(--panel-2); --btn-d: var(--bg-0); font-size: var(--fs-md); filter: none; color: var(--text-dim); }
#spin-go-btn:disabled:not(.spin-go-done) { filter: saturate(0.6) brightness(0.8); animation: none; }
#spin-sub-actions { display: flex; justify-content: center; }
#spin-sub-actions:empty { display: none; }
#spin-sub-actions button { min-height: 44px; }

/* ===== 6. 글로벌 랭킹 ===== */
.ranking-nick-row { display: flex; gap: 8px; margin-bottom: 10px; }
#ranking-nick-input, #sync-import-input {
    flex: 1; min-width: 0; width: 100%;
    height: var(--tap); padding: 0 14px;
    border: var(--line) solid var(--ink); border-radius: var(--r-md);
    background: var(--bg-0);
    box-shadow: inset 0 3px 0 rgba(0,0,0,0.35);
    color: var(--text); font-size: 16px; font-weight: 800;   /* 16px: iOS 자동 확대 방지 */
    -webkit-user-select: text; user-select: text;
    outline: none;
}
#ranking-nick-input::placeholder, #sync-import-input::placeholder { color: var(--text-faint); font-weight: 600; }
#ranking-nick-input:focus, #sync-import-input:focus { border-color: var(--yellow); }
#ranking-nick-save { flex: none; min-width: 84px; white-space: nowrap; }
.ranking-tab { min-height: 44px; white-space: nowrap; }
#ranking-list {
    display: flex; flex-direction: column; gap: 8px;
    min-height: 220px;
}
.ranking-row {
    flex: none;
    display: flex; align-items: center; gap: 10px;
    min-height: 52px; padding: 6px 14px 6px 8px;
    border: var(--line) solid var(--ink); border-radius: var(--r-md);
    background: var(--panel-2);
    box-shadow: 0 3px 0 rgba(0,0,0,0.25);
}
.ranking-rank {
    flex: none; width: 46px; height: 34px;
    display: flex; align-items: center; justify-content: center;
    border-radius: var(--r-sm);
    background: var(--bg-1);
    font-size: var(--fs-sm); font-weight: 900; color: var(--text-dim);
    white-space: nowrap; font-variant-numeric: tabular-nums;
}
.ranking-name {
    flex: 1; min-width: 0;
    font-size: var(--fs-md); font-weight: 900;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ranking-tier {
    display: inline-block; margin-left: 4px; padding: 2px 8px;
    border-radius: var(--r-pill); background: var(--ink);
    font-size: var(--fs-xs); font-weight: 900; color: var(--c-brand-light);
    vertical-align: 1px;
}
.ranking-score {
    flex: none;
    font-size: var(--fs-md); font-weight: 900; color: var(--yellow);
    white-space: nowrap; font-variant-numeric: tabular-nums;
    text-shadow: var(--text-shadow);
}
/* 1~3위: 메달 강조 */
.ranking-row:nth-child(-n+3):not(.ranking-row-gap) { min-height: 60px; }
.ranking-row:nth-child(-n+3):not(.ranking-row-gap) .ranking-rank { background: none; height: 40px; font-size: 32px; line-height: 1; }
.ranking-row:nth-child(-n+3):not(.ranking-row-gap) .ranking-name { font-size: var(--fs-lg); }
.ranking-row:nth-child(-n+3):not(.ranking-row-gap) { background: var(--panel-3); }
.ranking-row:nth-child(1):not(.ranking-row-gap) { box-shadow: inset 0 0 0 3px var(--yellow), 0 3px 0 rgba(0,0,0,0.25); }
.ranking-row:nth-child(2):not(.ranking-row-gap) { box-shadow: inset 0 0 0 3px var(--gray), 0 3px 0 rgba(0,0,0,0.25); }
.ranking-row:nth-child(3):not(.ranking-row-gap) { box-shadow: inset 0 0 0 3px var(--orange-d), 0 3px 0 rgba(0,0,0,0.25); }
/* 내 순위: 노란 테두리 + 스크롤해도 붙어 있음 */
.ranking-row.me, .ranking-row.me:nth-child(n) {
    position: sticky; top: 0; bottom: 0; z-index: 2;
    background: var(--blue-d);
    box-shadow: inset 0 0 0 3px var(--yellow), 0 4px 0 rgba(0,0,0,0.35);
}
.ranking-row.me .ranking-rank { background: var(--yellow); color: var(--text-on-bright); }
.ranking-row.me:nth-child(-n+3):not(.ranking-row-gap) .ranking-rank { background: none; }
.ranking-row-gap { margin-top: 10px; }
.ranking-loading, .ranking-hint {
    padding: 28px 12px;
    text-align: center;
    font-size: var(--fs-md); font-weight: 700; line-height: 1.6; color: var(--text-dim);
}
.ranking-loading { margin: auto 0; }
.ranking-hint {
    padding: 12px;
    border: 2px dashed var(--panel-line); border-radius: var(--r-md);
    font-size: var(--fs-sm);
}

/* ===== 7. 클라우드 저장 ===== */
#sync-status {
    display: flex; align-items: center; gap: 8px;
    margin-bottom: 14px; padding: 10px 14px;
    border: 2px solid var(--ink); border-radius: var(--r-md);
    background: var(--bg-1);
    color: var(--text); font-weight: 800;
}
#sync-status::before { content: '☁️'; flex: none; font-size: 22px; line-height: 1; }
#sync-status:empty { display: none; }
.sync-block { padding: 14px; margin-bottom: 14px; }
.sync-block:last-child { margin-bottom: 0; }
.sync-block .attendance-hint { margin-top: 10px; }
.sync-section-label {
    margin-bottom: 10px;
    font-size: var(--fs-md); font-weight: 900; color: var(--text);
    text-shadow: var(--text-shadow);
}
.sync-code-row { display: flex; align-items: stretch; gap: 8px; }
#sync-code {
    flex: 1; min-width: 0;
    display: flex; align-items: center;
    min-height: var(--tap); padding: 8px 12px;
    border: var(--line) solid var(--ink); border-radius: var(--r-md);
    background: var(--bg-0);
    box-shadow: inset 0 3px 0 rgba(0,0,0,0.35);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: var(--fs-sm); font-weight: 700; line-height: 1.35; color: var(--yellow);
    word-break: break-all;
    -webkit-user-select: all; user-select: all;
}
#sync-copy-btn { flex: none; min-width: 84px; white-space: nowrap; }
#sync-import-input {
    display: block; margin-bottom: 10px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 16px;
}
#sync-import-btn:disabled { filter: grayscale(0.6) brightness(0.8); }
.sync-import-warn { color: var(--c-enemy-light); }
#sync-import-msg:empty { display: none; }
.sync-msg-ok, .sync-msg-err {
    margin-top: 10px; padding: 10px 12px;
    border: 2px solid var(--ink); border-radius: var(--r-sm);
    font-size: var(--fs-sm); font-weight: 900; line-height: 1.4;
}
.sync-msg-ok { background: var(--green); color: #06331c; }
.sync-msg-err { background: var(--red); color: #fff; }

/* ===== 8. 프레스티지 ===== */
#prestige-panel { text-align: center; }
.prestige-hero {
    position: relative; flex: none;
    padding: 18px 16px 14px;
    background:
        radial-gradient(circle at 50% 30%, rgba(255,255,255,0.55), rgba(255,255,255,0) 60%),
        linear-gradient(180deg, var(--yellow), var(--orange));
    border-bottom: var(--line) solid var(--ink);
}
.prestige-star {
    font-size: 64px; line-height: 1.1;
    filter: drop-shadow(0 4px 0 rgba(0,0,0,0.25));
    animation: meta-bob 2s ease-in-out infinite;
}
#prestige-panel h2 { font-size: var(--fs-2xl); line-height: 1.2; }
#prestige-desc { font-size: var(--fs-md); font-weight: 700; line-height: 1.5; color: var(--text); }
#prestige-desc b { color: var(--yellow); font-weight: 900; }
.prestige-list {
    list-style: none;
    display: flex; flex-direction: column; gap: 8px;
    margin: 12px 0; text-align: left;
}
.prestige-list li {
    display: flex; align-items: center; gap: 8px;
    min-height: 48px; padding: 8px 14px;
    border: var(--line) solid var(--ink); border-radius: var(--r-md);
    background: var(--panel-2);
    box-shadow: inset 0 2px 0 rgba(255,255,255,0.1), 0 3px 0 rgba(0,0,0,0.25);
    font-weight: 800;
}
.prestige-list li b { margin-left: auto; font-size: var(--fs-lg); white-space: nowrap; }
.prestige-note { margin-bottom: 16px; font-size: var(--fs-sm); font-weight: 600; color: var(--text-dim); }
#prestige-go-btn { margin-bottom: 10px; }

/* ===== 9. 상점 (코스메틱) ===== */
.shop-coins { flex: none; padding-left: 12px; color: var(--yellow); white-space: nowrap; }
.shop-tab {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
    min-width: 0; min-height: 50px; padding: 4px 2px 6px;
    font-size: var(--fs-xs); white-space: nowrap;
}
.shop-tab span { font-size: 20px; line-height: 1.1; }
/* 탭에 해당하는 섹션만 표시 */
#shop-panel[data-tab="skins"] .shop-section:not([data-cat="skins"]),
#shop-panel[data-tab="trails"] .shop-section:not([data-cat="trails"]),
#shop-panel[data-tab="charcolors"] .shop-section:not([data-cat="charcolors"]),
#shop-panel[data-tab="victory"] .shop-section:not([data-cat="victory"]),
#shop-panel[data-tab="themes"] .shop-section:not([data-cat="themes"]) { display: none; }
#shop-body { min-height: 300px; }
.shop-section-title {
    display: flex; align-items: center; gap: 10px;
    margin-bottom: 12px;
    font-size: var(--fs-md); font-weight: 900; color: var(--text);
    text-shadow: var(--text-shadow);
}
.shop-section-title::after { content: ''; flex: 1; height: 3px; border-radius: 2px; background: var(--panel-line); }
.shop-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.shop-item {
    position: relative;
    display: flex; flex-direction: column; align-items: stretch; gap: 6px;
    padding: 8px 8px 10px;
    border: var(--line) solid var(--ink); border-radius: var(--r-md);
    background: var(--panel-2);
    box-shadow: inset 0 2px 0 rgba(255,255,255,0.1), 0 4px 0 rgba(0,0,0,0.25);
    text-align: center; cursor: pointer;
    transition: transform 0.08s ease;
}
.shop-item:active { transform: translateY(2px); }
/* 미리보기 무대 */
.shop-item::before {
    content: ''; position: absolute; top: 8px; left: 8px; right: 8px; height: 68px;
    border-radius: var(--r-sm);
    background: radial-gradient(circle at 50% 40%, var(--panel-3), var(--bg-0));
    box-shadow: inset 0 3px 0 rgba(0,0,0,0.3);
}
.shop-swatch {
    position: relative; flex: none; align-self: center;
    width: 46px; height: 46px; margin: 11px 0;
    border-radius: 50%;
    outline: 2px solid var(--ink);
}
.shop-swatch.trail {
    width: 72%; max-width: 84px; height: 16px; margin: 26px 0;
    border-radius: var(--r-pill);
}
.shop-swatch.emoji {
    outline: none; background: none;
    display: flex; align-items: center; justify-content: center;
    font-size: 36px; line-height: 1;
}
.shop-item-name {
    min-height: 2.4em;
    display: flex; align-items: center; justify-content: center;
    font-size: var(--fs-sm); font-weight: 900; line-height: 1.2;
    word-break: keep-all; overflow-wrap: anywhere;
}
.shop-state {
    display: flex; align-items: center; justify-content: center;
    min-height: 34px; padding: 0 4px 3px;
    border: 2px solid var(--ink); border-radius: var(--r-sm);
    font-size: var(--fs-sm); font-weight: 900; white-space: nowrap;
    font-variant-numeric: tabular-nums;
}
.shop-state.price {
    background: var(--yellow); box-shadow: inset 0 -4px 0 var(--yellow-d);
    color: var(--text-on-bright);
}
.shop-state.owned {
    background: var(--blue); box-shadow: inset 0 -4px 0 var(--blue-d);
    color: #fff; text-shadow: var(--text-shadow);
}
.shop-state.equipped {
    padding-bottom: 0;
    border-color: transparent; background: none;
    color: var(--green);
}
.shop-state.insufficient {
    background: var(--red); box-shadow: inset 0 -4px 0 var(--red-d);
    color: #fff; font-size: var(--fs-xs);
    animation: meta-shake 0.2s 2;
}
.shop-item.equipped {
    cursor: default;
    background: var(--green-d);
    background: color-mix(in srgb, var(--green) 24%, var(--panel));
    box-shadow: inset 0 0 0 3px var(--green), 0 4px 0 rgba(0,0,0,0.25);
}
.shop-item.equipped:active { transform: none; }
.shop-item.equipped::after {
    content: '✓'; position: absolute; top: -8px; right: -8px;
    width: 26px; height: 26px;
    display: flex; align-items: center; justify-content: center;
    border: 2px solid var(--ink); border-radius: 50%;
    background: var(--green); color: #fff;
    font-size: 14px; font-weight: 900;
}

/* --- 상점 미리보기 --- */
/* 트레일: 색이 막대를 따라 흐름 */
.trail-preview { animation: trailFlow 1.1s linear infinite; }
@keyframes trailFlow { from { background-position: 0% 0; } to { background-position: -200% 0; } }
.trail-preview.rainbow {
    background: linear-gradient(90deg, var(--red), var(--yellow), var(--green), var(--blue), var(--purple), var(--pink), var(--red));
    background-size: 200% 100%;
}
/* 승리 연출: 아이콘 주위로 파티클이 터짐 */
.victory-burst {
    outline: none; background: none;
    display: flex; align-items: center; justify-content: center;
    overflow: visible;
}
.victory-burst .vb-icon { position: relative; z-index: 1; font-size: 30px; line-height: 1; }
.vb-p {
    position: absolute; top: 50%; left: 50%;
    width: 6px; height: 6px; border-radius: 50%;
    background: var(--c);
    animation: vbBurst 1.5s ease-out infinite;
    animation-delay: var(--vd);
}
@keyframes vbBurst {
    0%   { opacity: 0; transform: translate(-50%, -50%) rotate(var(--a)) translateY(0) scale(0.4); }
    25%  { opacity: 1; }
    100% { opacity: 0; transform: translate(-50%, -50%) rotate(var(--a)) translateY(-28px) scale(1); }
}
/* 테마: 미니 경기장 (위 = 상대 코트, 네트, 아래 = 내 코트) */
.shop-swatch.theme-arena {
    width: 58px; height: 52px; margin: 8px 0;
    display: flex; flex-direction: column;
    padding: 0; overflow: hidden;
    border: 3px solid var(--ink); border-radius: var(--r-sm);
    outline: 2px solid var(--ink);
}
.theme-arena .ta-half { flex: 1; }
.theme-arena .ta-net { flex: none; height: 3px; }

/* ===== 10. 도감 ===== */
#collection-summary {
    display: flex; align-items: stretch; gap: 10px;
    margin-bottom: 14px;
}
#collection-summary.hidden, #collection-grid.hidden, #collection-detail.hidden { display: none; }
.collection-summary-item {
    flex: 1;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    padding: 8px 10px;
    border: 2px solid var(--ink); border-radius: var(--r-md);
    background: var(--bg-1);
    font-size: var(--fs-xs); font-weight: 800; color: var(--text-dim);
}
.collection-summary-item b { font-size: var(--fs-lg); font-weight: 900; color: var(--yellow); text-shadow: var(--text-shadow); font-variant-numeric: tabular-nums; }
.collection-summary-sep { display: none; }

#collection-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.collection-card {
    padding: 10px 8px;
    border: var(--line) solid var(--ink); border-radius: var(--r-md);
    background: var(--panel-2);
    box-shadow: inset 0 2px 0 rgba(255,255,255,0.1), 0 4px 0 rgba(0,0,0,0.25);
    text-align: center; cursor: pointer;
    transition: transform 0.08s ease;
}
.collection-card:active { transform: translateY(2px); }
.collection-portrait, .collection-detail-portrait {
    position: relative;
    border: var(--line) solid var(--ink); border-radius: 50%;
    background: radial-gradient(circle at 50% 35%, var(--c-brand-light), var(--purple-d) 75%);
    overflow: hidden;
}
.collection-portrait { width: 76%; max-width: 88px; aspect-ratio: 1; margin: 0 auto 8px; }
.collection-portrait img, .collection-detail-portrait img { display: block; width: 100%; height: 100%; object-fit: cover; }
.collection-lock {
    position: absolute; inset: 0;
    display: flex; align-items: center; justify-content: center;
    font-size: 26px;
    filter: drop-shadow(0 2px 0 rgba(0,0,0,0.5));
}
.collection-name {
    margin-bottom: 3px;
    font-size: var(--fs-sm); font-weight: 900;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.collection-stars { margin-bottom: 6px; font-size: var(--fs-sm); line-height: 1; letter-spacing: 0; white-space: nowrap; }
.cstar-on { color: var(--yellow); text-shadow: 0 1px 0 var(--ink); }
.cstar-off { color: var(--panel-line); }
.collection-card .cstar-off { color: var(--ink); }
.collection-card.locked .cstar-off { color: var(--panel-line); }
.collection-star-count { display: none; }
.collection-bar {
    height: 10px; margin-bottom: 5px;
    border: 2px solid var(--ink); border-radius: var(--r-pill);
    background: var(--ink); overflow: hidden;
}
.collection-fill {
    height: 100%; border-radius: inherit;
    background: linear-gradient(180deg, rgba(255,255,255,0.5), rgba(255,255,255,0) 55%), var(--green);
    transition: width 0.4s var(--ease-out);
}
.collection-fill.maxed { background: linear-gradient(180deg, rgba(255,255,255,0.5), rgba(255,255,255,0) 55%), var(--yellow); }
.collection-sub { font-size: var(--fs-xs); font-weight: 700; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* 미보유: 실루엣 */
.collection-card.locked { background: var(--bg-1); box-shadow: 0 4px 0 rgba(0,0,0,0.25); }
.collection-card.locked .collection-portrait,
.collection-detail-portrait.locked { background: radial-gradient(circle at 50% 35%, var(--gray), var(--gray-d) 75%); }
.collection-card.locked .collection-portrait img,
.collection-detail-portrait.locked img { filter: brightness(0); opacity: 0.55; }
.collection-card.locked .collection-name { color: var(--text-faint); }
.collection-card.locked .collection-sub { color: var(--text-faint); }

/* 카드 모서리의 필살기 아이콘 */
.collection-card { position: relative; }
.collection-skill-badge {
    position: absolute; top: 5px; right: 5px;
    width: 28px; height: 28px;
    display: flex; align-items: center; justify-content: center;
    border: 2px solid var(--ink); border-radius: 10px;
    background: var(--bg-1); box-shadow: inset 0 -2px 0 rgba(0,0,0,0.3), 0 2px 0 rgba(0,0,0,0.25);
    font-size: 15px; line-height: 1;
    pointer-events: none;
}
.collection-card.locked .collection-skill-badge { filter: grayscale(0.7); opacity: 0.8; }

/* --- 도감 상세: 캐릭터 프로필 (.cprof) --- */
/* 도감에서 연 해금 팝업은 도감 시트 위로 */
#char-shop-overlay.from-collection { z-index: 765; }

.cprof { word-break: keep-all; overflow-wrap: anywhere; }
.cprof-nav { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.cprof-nav .ui-btn { min-height: 44px; }
.cprof-back { order: 1; margin-right: auto; }
.cprof-prev { order: 2; min-width: 48px; padding-left: 0; padding-right: 0; }
.cprof-pos {
    order: 3; min-width: 58px; text-align: center;
    font-size: var(--fs-sm); font-weight: 900; color: var(--text-dim);
    font-variant-numeric: tabular-nums; white-space: nowrap;
}
.cprof-next { order: 4; min-width: 48px; padding-left: 0; padding-right: 0; }

.cprof-col { min-width: 0; }

/* 무대: 드래그로 돌려 보는 3D 모델 (로비 hero 무대와 같은 구성) */
.cprof-stage {
    --stage-a: #b79bff; --stage-b: var(--purple-d); --stage-glow: rgba(162,116,255,0.7);
    position: relative;
    height: clamp(188px, 30dvh, 270px);
    border: var(--line) solid var(--ink); border-radius: var(--r-lg);
    background:
        radial-gradient(ellipse at 50% 108%, rgba(18,11,51,0.55) 0%, rgba(18,11,51,0) 55%),
        radial-gradient(ellipse at 50% 18%, var(--stage-a), var(--stage-b) 78%);
    box-shadow: inset 0 3px 0 rgba(255,255,255,0.22), 0 5px 0 rgba(0,0,0,0.28);
    overflow: hidden;
    touch-action: pan-y;          /* 세로 스크롤은 그대로, 가로 드래그 = 회전 */
    cursor: grab;
    -webkit-user-select: none; user-select: none;
}
.cprof-stage.dragging { cursor: grabbing; }
.cprof-stage.is-static { cursor: default; }
.cprof-stage--speed   { --stage-a: #9bdcff; --stage-b: var(--blue-d);   --stage-glow: rgba(63,169,255,0.7); }
.cprof-stage--power   { --stage-a: #ffc48f; --stage-b: var(--orange-d); --stage-glow: rgba(255,138,61,0.7); }
.cprof-halo {
    position: absolute; left: 50%; top: 46%;
    height: 96%; aspect-ratio: 1;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255,255,255,0.42) 0%, rgba(255,255,255,0.14) 40%, rgba(255,255,255,0) 68%);
    pointer-events: none;
}
/* 발밑 원형 무대 (모델 발은 프레임 아래에서 약 5.5% 지점) */
.cprof-pedestal {
    position: absolute; left: 50%; bottom: 10%;
    height: 13%; aspect-ratio: 3.6 / 1;
    transform: translate(-50%, 50%);
    border: var(--line) solid var(--ink); border-radius: 50%;
    background:
        radial-gradient(ellipse at 50% 38%, rgba(255,255,255,0.6) 0%, rgba(255,255,255,0) 60%),
        var(--stage-a);
    box-shadow: 0 5px 0 var(--stage-b), 0 5px 0 3px var(--ink), 0 0 30px var(--stage-glow);
    pointer-events: none;
}
.cprof-model {
    position: absolute; left: 0; top: 2%;
    display: block; width: 100%; height: 96%;
    object-fit: contain; object-position: 50% 100%;
    filter: drop-shadow(0 5px 0 rgba(18,11,51,0.3));
    pointer-events: none;         /* 포인터는 .cprof-stage 가 받는다 */
    animation: hero-pop 0.4s var(--ease-bounce);
}
.cprof-hint {
    position: absolute; right: 8px; bottom: 8px;
    padding: 3px 9px;
    border-radius: var(--r-pill);
    background: rgba(18,11,51,0.6);
    font-size: 10px; font-weight: 900; letter-spacing: 0.3px; white-space: nowrap;
    color: var(--text-dim);
    pointer-events: none;
    transition: opacity 0.4s ease;
}
.cprof-hint.used, .cprof-stage.is-static .cprof-hint { opacity: 0; }
/* 미보유: 어둡게 가린 실루엣 + 자물쇠 */
.cprof.is-locked .cprof-stage { --stage-a: var(--gray); --stage-b: var(--gray-d); --stage-glow: rgba(0,0,0,0); }
.cprof.is-locked .cprof-model { filter: brightness(0.16) saturate(0.3) drop-shadow(0 5px 0 rgba(18,11,51,0.3)); }
.cprof-lock {
    position: absolute; left: 10px; top: 10px;
    width: 44px; height: 44px;
    display: flex; align-items: center; justify-content: center;
    border: var(--line) solid var(--ink); border-radius: 14px;
    background: var(--gray-d); box-shadow: inset 0 -4px 0 rgba(0,0,0,0.3), 0 3px 0 rgba(0,0,0,0.3);
    font-size: 22px; line-height: 1;
    pointer-events: none;
}

/* 표정 칩 */
.cprof-expr { display: flex; justify-content: center; gap: 8px; margin-top: 8px; }
.cprof-expr-chip {
    flex: none; width: 52px; height: 44px;
    display: flex; align-items: center; justify-content: center;
    border: var(--line) solid var(--ink); border-radius: 14px;
    background: var(--panel-2); box-shadow: inset 0 -4px 0 rgba(0,0,0,0.28);
    font-size: 22px; line-height: 1; padding-bottom: 3px;
    transition: transform 0.08s ease;
}
.cprof-expr-chip:active { transform: translateY(2px); }
.cprof-expr-chip.active { background: var(--yellow); box-shadow: inset 0 -4px 0 var(--yellow-d); }

/* 이름 + 태그 + 한 줄 소개 */
.cprof-id { margin: 10px 0 12px; text-align: center; }
.cprof-name { font-size: var(--fs-xl); font-weight: 900; line-height: 1.2; text-shadow: var(--text-outline); margin-bottom: 8px; }
.cprof-tags { display: flex; flex-wrap: wrap; justify-content: center; gap: 5px; }
.cprof-tag {
    display: inline-flex; align-items: center;
    min-height: 24px; padding: 0 9px;
    border: 2px solid var(--ink); border-radius: var(--r-pill);
    background: var(--panel-3); color: #fff;
    font-size: var(--fs-xs); font-weight: 900; white-space: nowrap;
}
.cprof-tag--speed   { background: var(--blue); }
.cprof-tag--power   { background: var(--orange); }
.cprof-tag--balance { background: var(--purple); }
.cprof-tag--owned   { background: var(--green); color: #06331c; }
.cprof-tag--locked  { background: var(--gray-d); }
.cprof-tag--cat     { background: var(--pink); }
.cprof-tag--cd      { background: var(--bg-1); font-variant-numeric: tabular-nums; }
.cprof-desc { margin: 9px 0 0; font-size: var(--fs-sm); font-weight: 700; line-height: 1.5; color: var(--text-dim); }

/* 정보 카드 공통 */
.cprof-card {
    margin-bottom: 12px; padding: 12px 14px 14px;
    border: var(--line) solid var(--ink); border-radius: var(--r-md);
    background: var(--panel-2);
    box-shadow: inset 0 2px 0 rgba(255,255,255,0.1), 0 4px 0 rgba(0,0,0,0.25);
}
.cprof-card:last-child { margin-bottom: 0; }
.cprof-label {
    display: inline-block; margin-bottom: 10px; padding: 3px 10px;
    border-radius: var(--r-pill); background: var(--bg-1);
    font-size: var(--fs-xs); font-weight: 900; letter-spacing: 0.5px; color: var(--text-dim);
}

/* 필살기 (주인공 카드) */
.cprof-skill {
    background: linear-gradient(180deg, var(--panel-3), var(--panel-2));
    box-shadow: inset 0 0 0 3px var(--yellow), 0 4px 0 rgba(0,0,0,0.25);
}
.cprof-label--skill { background: var(--yellow); color: var(--text-on-bright); }
.cprof-skill-head { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.cprof-skill-icon {
    flex: none; width: 60px; height: 60px;
    display: flex; align-items: center; justify-content: center;
    border: var(--line) solid var(--ink); border-radius: 16px;
    background: var(--yellow); box-shadow: inset 0 -4px 0 var(--yellow-d);
    font-size: 32px; line-height: 1; padding-bottom: 3px;
}
.cprof-skill-title { flex: 1; min-width: 0; }
.cprof-skill-title .cprof-tags { justify-content: flex-start; }
.cprof-skill-name { margin-bottom: 6px; font-size: 20px; font-weight: 900; line-height: 1.2; text-shadow: var(--text-shadow); }
.cprof-skill-desc { margin: 0; font-size: var(--fs-md); font-weight: 700; line-height: 1.5; }
.cprof-skill-tip {
    margin: 10px 0 0; padding: 8px 10px;
    border-radius: var(--r-sm); background: rgba(18,11,51,0.45);
    font-size: var(--fs-sm); font-weight: 700; line-height: 1.5; color: var(--text-dim);
}
.cprof-skill-tip b { display: block; color: var(--yellow); font-weight: 900; }

/* 능력치 */
.cprof-stat { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.cprof-stat-lbl { flex: none; width: 66px; font-size: var(--fs-sm); font-weight: 900; white-space: nowrap; }
.cprof-stat-bar {
    flex: 1; min-width: 0; height: 18px;
    border: 2px solid var(--ink); border-radius: var(--r-pill);
    background: var(--ink); overflow: hidden;
}
.cprof-stat-fill {
    display: block; height: 100%; border-radius: inherit;
    background: linear-gradient(180deg, rgba(255,255,255,0.5), rgba(255,255,255,0) 55%), var(--blue);
}
.cprof-stat-fill.pow { background: linear-gradient(180deg, rgba(255,255,255,0.5), rgba(255,255,255,0) 55%), var(--orange); }
.cprof-stat-val {
    flex: none; width: 26px; text-align: right;
    font-size: var(--fs-lg); font-weight: 900; color: var(--yellow); text-shadow: var(--text-shadow);
    font-variant-numeric: tabular-nums;
}
.cprof-facts { margin-top: 12px; display: grid; gap: 6px; }
.cprof-fact {
    display: flex; align-items: baseline; gap: 10px;
    padding: 7px 10px; border-radius: var(--r-sm); background: rgba(18,11,51,0.45);
    font-size: var(--fs-sm); line-height: 1.45;
}
.cprof-fact-k { flex: none; width: 44px; font-weight: 900; color: var(--text-dim); }
.cprof-fact-v { flex: 1; min-width: 0; font-weight: 800; }
.cprof-fact-v small { font-size: var(--fs-xs); font-weight: 700; color: var(--text-dim); margin-left: 4px; }
.cprof-fact-v.none { color: var(--text-faint); }
.cprof-fact-v.has-passive { color: var(--c-accent-soft); }

/* 상성 */
.cprof-match-row + .cprof-match-row { margin-top: 10px; }
.cprof-match-title { margin-bottom: 6px; font-size: var(--fs-sm); font-weight: 900; }
.cprof-match-row--strong .cprof-match-title { color: var(--green); }
.cprof-match-row--weak .cprof-match-title { color: var(--c-enemy-light); }
.cprof-match-row--even .cprof-match-title { color: var(--yellow); }
.cprof-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.cprof-chip {
    display: inline-flex; align-items: center; gap: 7px;
    min-height: 44px; padding: 3px 13px 5px 4px;
    border: 2px solid var(--ink); border-radius: var(--r-pill);
    background: var(--panel-3); box-shadow: inset 0 -3px 0 rgba(0,0,0,0.25);
    color: #fff; font-family: var(--font-display); font-size: var(--fs-sm); font-weight: 900;
    transition: transform 0.08s ease;
}
.cprof-chip:active { transform: translateY(2px); }
.cprof-chip-face {
    flex: none; width: 34px; height: 34px;
    border: 2px solid var(--ink); border-radius: 50%;
    background: radial-gradient(circle at 50% 35%, var(--c-brand-light), var(--purple-d) 75%);
    overflow: hidden;
}
.cprof-chip-face img { display: block; width: 100%; height: 100%; object-fit: cover; }
.cprof-chip.locked .cprof-chip-face { background: radial-gradient(circle at 50% 35%, var(--gray), var(--gray-d) 75%); }
.cprof-chip.locked .cprof-chip-face img { filter: brightness(0); opacity: 0.55; }

/* 마스터리 + 전적 (간단히) */
.cprof-record-mastery { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.cprof-record-mastery .cprof-label { margin-bottom: 0; }
.cprof-record-stars { font-size: var(--fs-lg); line-height: 1; white-space: nowrap; }
.cprof-record-stars .cstar-off { color: var(--ink); }
.cprof-record-next { margin-left: auto; font-size: var(--fs-xs); font-weight: 800; color: var(--text-dim); white-space: nowrap; }
.cprof-record-nums { display: flex; gap: 8px; }
.cprof-record-nums > div {
    flex: 1; min-width: 0;
    display: flex; flex-direction: column; align-items: center; gap: 1px;
    padding: 6px 4px; border-radius: var(--r-sm); background: rgba(18,11,51,0.45);
}
.cprof-record-nums b { font-size: var(--fs-lg); font-weight: 900; color: var(--yellow); text-shadow: var(--text-shadow); font-variant-numeric: tabular-nums; }
.cprof-record-nums span { font-size: var(--fs-xs); font-weight: 800; color: var(--text-dim); }

/* 해금 방법 */
.cprof-unlock { background: var(--bg-1); }
.cprof-label--lock { background: var(--gray-d); color: #fff; }
.cprof-unlock-list { margin: 0 0 12px; padding: 0; list-style: none; display: grid; gap: 6px; }
.cprof-unlock-list li {
    display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 6px;
    padding: 8px 10px; border-radius: var(--r-sm); background: rgba(255,255,255,0.07);
    font-size: var(--fs-sm); font-weight: 800; line-height: 1.4;
}
.cprof-unlock-list b { color: var(--yellow); font-size: var(--fs-md); font-weight: 900; }
.cprof-unlock-now { margin-left: auto; font-size: var(--fs-xs); font-weight: 800; color: var(--text-dim); white-space: nowrap; }

/* ===== 11. 업적 목록 ===== */
#achievement-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
.achievement-card {
    position: relative;
    display: flex; align-items: center; gap: 12px;
    padding: 10px 12px;
    border: var(--line) solid var(--ink); border-radius: var(--r-md);
    background: var(--panel-2);
    box-shadow: inset 0 2px 0 rgba(255,255,255,0.1), 0 4px 0 rgba(0,0,0,0.25);
}
.achievement-card-icon {
    flex: none; width: 52px; height: 52px;
    display: flex; align-items: center; justify-content: center;
    border: 2px solid var(--ink); border-radius: 14px;
    background: var(--bg-1); box-shadow: inset 0 -3px 0 rgba(0,0,0,0.3);
    font-size: 28px; line-height: 1;
}
.achievement-card-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.achievement-card-title { font-size: var(--fs-md); font-weight: 900; line-height: 1.25; text-shadow: var(--text-shadow); }
.achievement-card-desc { font-size: var(--fs-sm); font-weight: 600; line-height: 1.35; color: var(--text-dim); }
.achievement-card-reward { margin-top: 2px; font-size: var(--fs-sm); font-weight: 900; color: var(--yellow); }
.achievement-card.unlocked {
    background: var(--panel-3);
    box-shadow: inset 0 0 0 3px var(--yellow), 0 4px 0 rgba(0,0,0,0.25);
}
.achievement-card.unlocked .achievement-card-icon { background: var(--yellow); box-shadow: inset 0 -3px 0 var(--yellow-d); }
.achievement-card.unlocked::after {
    content: '✓'; flex: none;
    width: 30px; height: 30px;
    display: flex; align-items: center; justify-content: center;
    border: 2px solid var(--ink); border-radius: 50%;
    background: var(--green); color: #fff; font-size: 16px; font-weight: 900;
}
.achievement-card.locked { background: var(--bg-1); box-shadow: none; }
.achievement-card.locked .achievement-card-icon { filter: grayscale(1) brightness(0.7); }
.achievement-card.locked .achievement-card-title { color: var(--text-dim); text-shadow: none; }
.achievement-card.locked .achievement-card-desc { color: var(--text-faint); }
.achievement-card.locked .achievement-card-reward { color: var(--text-faint); }
.achievement-card.locked::after { content: '🔒'; flex: none; font-size: 18px; opacity: 0.6; }

/* ===== 12. 반응형 ===== */
/* 아주 좁은 폰 */
@media (max-width: 374px) {
    .meta-sheet .ui-sheet__title { font-size: var(--fs-lg); }
    #attendance-grid { gap: 8px; }
    .attendance-cell { min-height: 96px; }
    #collection-grid, .shop-grid { gap: 8px; }
    .collection-card { padding: 8px 5px; }
    .collection-stars { font-size: 12px; }
    .collection-sub { white-space: normal; word-break: keep-all; line-height: 1.25; min-height: 2.5em; }
    .shop-item { padding: 8px 6px 8px; }
    .shop-item::before { left: 6px; right: 6px; }
    .ranking-tab { font-size: 12px; }
    .season-sp-text { font-size: var(--fs-xs); }
}
/* 낮은 화면 (360×640 등): 룰렛 여백 축소 */
@media (max-height: 700px) {
    #spin-wheel-wrap { --wheel: min(300px, calc(100vw - 72px), calc(100dvh - 300px)); margin: 10px 0 2px; }
    .spin-body { gap: 8px; }
    .cprof-stage { height: clamp(170px, 29dvh, 200px); }
    .cprof-id { margin: 8px 0 10px; }
}

/* 넓은 화면: 가운데 다이얼로그 */
@media (min-width: 600px) and (min-height: 560px) {
    #collection-panel, #achievement-panel { max-width: 640px; }
    #shop-panel { max-width: 600px; }
    #prestige-panel, #spin-panel { max-width: 420px; }
    #collection-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
    .shop-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
    #achievement-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    #attendance-grid { grid-template-columns: repeat(4, 1fr); }
    #spin-wheel-wrap { --wheel: min(300px, calc(100dvh - 380px)); }
    .shop-tab { flex-direction: row; gap: 6px; font-size: var(--fs-sm); }
    /* 도감 프로필: 모델 왼쪽(고정) / 정보 오른쪽 */
    .cprof-layout { display: grid; grid-template-columns: minmax(0, 0.82fr) minmax(0, 1.18fr); gap: 16px; align-items: start; }
    .cprof-col--hero { position: sticky; top: 0; }
    .cprof-stage { height: clamp(200px, calc(100dvh - 420px), 280px); }
    #shop-body { min-height: 340px; }
}

/* 모바일 가로 (844×390 등): 낮은 높이에 맞춰 넓고 얕게 */
@media (max-height: 520px) and (orientation: landscape) {
    .meta-overlay { padding: 0 max(8px, var(--sa-r)) 0 max(8px, var(--sa-l)); }
    .meta-sheet { max-width: 720px; max-height: calc(100dvh - var(--sa-t) - 8px); }
    .meta-sheet > .ui-sheet__head { min-height: 50px; padding-top: 3px; padding-bottom: 3px; }
    .meta-sheet .ui-close { width: 44px; height: 44px; }
    .meta-sheet .ui-sheet__body { padding: 12px var(--gutter); }
    .meta-sheet__bar { padding: 8px var(--gutter); }

    #attendance-panel .attendance-hint { margin-bottom: 10px; }
    #attendance-grid { grid-template-columns: repeat(8, 1fr); gap: 8px; margin-bottom: 12px; }
    .attendance-cell { min-height: 92px; }
    #attendance-claim-btn { min-height: 52px; }

    #collection-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
    .shop-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
    #shop-body { min-height: 0; }
    .shop-tab { flex-direction: row; gap: 6px; min-height: 44px; font-size: var(--fs-sm); padding: 0 4px; }
    #achievement-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    #ranking-list { min-height: 0; }
    #season-progress .attendance-hint { display: none; }
    .season-progress-row { margin-bottom: 0; }
    .ranking-nick-row { margin-bottom: 0; flex: 1; }
    #ranking-panel .meta-sheet__bar { display: flex; gap: 10px; align-items: center; }
    #ranking-panel .ranking-tabs { flex: 1.3; }

    /* 룰렛: 휠 왼쪽 / 버튼 오른쪽 */
    .spin-body { flex-direction: row; justify-content: center; gap: 24px; }
    #spin-wheel-wrap { --wheel: min(260px, calc(100dvh - 130px)); min-width: 180px; min-height: 180px; margin: 12px 0 4px; }
    .spin-actions { align-self: center; flex: 1; max-width: 320px; }
    .spin-label span { top: 22px; font-size: var(--fs-sm); }
    #spin-hub { width: 56px; height: 56px; margin: -28px 0 0 -28px; font-size: var(--fs-sm); }

    /* 프레스티지: 배너를 낮게 */
    .prestige-hero { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 6px 16px; }
    .prestige-star { font-size: 34px; animation: none; }
    #prestige-panel h2 { font-size: var(--fs-xl); }
    .prestige-list { flex-direction: row; }
    .prestige-list li { flex: 1; flex-direction: column; align-items: flex-start; gap: 0; font-size: var(--fs-sm); }
    .prestige-list li b { margin-left: 0; }
    .prestige-note { margin-bottom: 10px; }

    /* 도감 상세: 초상화 왼쪽, 정보 오른쪽 */
    .cprof-layout { display: grid; grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr); gap: 14px; align-items: start; }
    .cprof-nav { margin-bottom: 8px; }
    .cprof-col--hero { position: sticky; top: 0; }
    .cprof-stage { height: clamp(150px, calc(100dvh - 196px), 220px); }
    /* 표정 칩은 무대 오른쪽에 세로로 겹쳐 높이를 아낀다 */
    .cprof-expr { position: absolute; top: 5px; right: 6px; flex-direction: column; gap: 3px; margin: 0; }
    .cprof-expr-chip { width: 46px; height: 44px; }
    .cprof-hint { right: auto; left: 8px; }
    .cprof.is-locked .cprof-hint { left: auto; right: 8px; }
    .cprof-id { margin: 8px 0 0; }
}
