/* ============================================================
   SETUP — 경기 전 화면
   팀 편성(#team-setup-overlay) · 아레나 선택 · 캐릭터 상세/해금(#char-shop-overlay)
   캠페인 맵(#campaign-overlay) + 스테이지 팝업 · 온라인/랭크(#online-overlay)
   모바일 세로 우선. 토큰/공용 컴포넌트는 base.css.
   z-index 는 구 CSS 값 유지: campaign 710 · team/shop/online 720 · stage popup 800 · toast 900
   ============================================================ */

/* 공용: 화면 전체를 쓰는 "페이지"형 배경 */
#team-setup-overlay,
#campaign-overlay {
    position: fixed; inset: 0;
    display: flex; justify-content: center; align-items: stretch;
    background:
        radial-gradient(circle at 12px 12px, rgba(255,255,255,0.05) 2px, transparent 3px) 0 0 / 28px 28px,
        radial-gradient(120% 70% at 50% 0%, var(--bg-2) 0%, var(--bg-1) 48%, var(--bg-0) 100%);
    animation: fadeIn 0.25s ease-out;
}
#team-setup-overlay { z-index: 720; }
#campaign-overlay { z-index: 710; }
#team-setup-overlay.hidden,
#campaign-overlay.hidden,
#online-overlay.hidden,
#char-shop-overlay.hidden { display: none; }

/* 가로 스크롤 스트립 공용 (아레나, 존 탭) */
#theme-buttons,
.campaign-zone-tabs {
    display: flex;
    overflow-x: auto; overflow-y: hidden;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-x pan-y;
    scrollbar-width: none;
}
#theme-buttons::-webkit-scrollbar,
.campaign-zone-tabs::-webkit-scrollbar { display: none; }

/* ============================================================
   TEAM SETUP — 모바일: 전체 화면 페이지 / 넓은 화면: 가운데 다이얼로그
   ============================================================ */
#team-setup-box {
    display: flex; flex-direction: column;
    width: 100%; max-width: 640px; min-height: 0;
}
.team-setup-head {
    flex: none;
    display: flex; align-items: center; gap: 12px;
    padding: calc(10px + var(--sa-t)) calc(var(--gutter) + var(--sa-r)) 10px calc(var(--gutter) + var(--sa-l));
}
.team-setup-back { flex: none; font-size: 24px; line-height: 1; }
.team-setup-title {
    flex: 1; min-width: 0;
    font-family: var(--font-display); font-size: var(--fs-xl); font-weight: 900; line-height: 1.15;
    color: #fff; text-shadow: var(--text-outline); letter-spacing: 0.3px;
    overflow-wrap: anywhere;
}
.team-setup-body {
    flex: 1; min-height: 0;
    display: flex; flex-direction: column; gap: 22px;
    overflow-y: auto; overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch; touch-action: pan-y;
    padding: 12px calc(var(--gutter) + var(--sa-r)) 20px calc(var(--gutter) + var(--sa-l));
}
.team-setup-foot {
    flex: none;
    padding: 12px calc(var(--gutter) + var(--sa-r)) calc(14px + var(--sa-b)) calc(var(--gutter) + var(--sa-l));
    background: linear-gradient(180deg, rgba(18,11,51,0) 0%, rgba(18,11,51,0.7) 40%);
}
#team-go-btn { letter-spacing: 1px; }

/* ----- 팀 선택 영역 ----- */
#char-select-row { display: flex; flex-direction: column; gap: 12px; }
.char-selector { display: flex; flex-direction: column; min-width: 0; }
.char-selector-label,
.theme-selector-label {
    display: flex; align-items: center; gap: 8px;
    margin-bottom: 12px;
    font-family: var(--font-display); font-size: var(--fs-lg); font-weight: 900;
    color: #fff; text-shadow: var(--text-shadow); letter-spacing: 0.5px;
}
.char-selector-label::before,
.theme-selector-label::before {
    content: ''; flex: none;
    width: 8px; height: 22px; border-radius: 4px;
    border: 2px solid var(--ink); background: var(--yellow);
}
.char-selector-label.player-label::before { background: var(--c-player); }
.char-selector-label.cpu-label::before { background: var(--c-enemy); }
.char-vs {
    align-self: center;
    font-family: var(--font-display); font-size: var(--fs-xl); font-weight: 900;
    color: var(--yellow); text-shadow: var(--text-outline); letter-spacing: 2px;
}

/* ----- 팀 슬롯: 큰 캐릭터 카드 ----- */
.char-team-slots {
    display: flex; align-items: stretch; justify-content: center; gap: 10px;
    padding-top: 8px;                 /* 모서리 × 버튼이 스크롤 영역에 잘리지 않게 */
}
.char-team-slot {
    position: relative;
    flex: 1 1 0; min-width: 0; max-width: 190px; min-height: clamp(204px, 29dvh, 250px);
    display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 5px;
    padding: 14px 8px 8px;
    border: var(--line) solid var(--ink); border-radius: var(--r-md);
    background: linear-gradient(180deg, var(--blue-d) 0%, var(--panel-3) 46%, var(--panel-2) 100%);
    box-shadow: inset 0 2px 0 rgba(255,255,255,0.22), inset 0 -5px 0 rgba(0,0,0,0.22), 0 5px 0 rgba(0,0,0,0.3);
    cursor: pointer;
    -webkit-user-select: none; user-select: none;
    transition: transform 0.08s ease, box-shadow 0.08s ease;
}
#cpu-char-selector .char-team-slot.filled {
    background: linear-gradient(180deg, var(--red-d) 0%, var(--panel-3) 46%, var(--panel-2) 100%);
}
.char-team-slot:active {
    transform: translateY(3px);
    box-shadow: inset 0 2px 0 rgba(255,255,255,0.22), inset 0 -3px 0 rgba(0,0,0,0.22), 0 2px 0 rgba(0,0,0,0.3);
}
/* "탭하면 교체" 표시 배지 */
.char-team-slot.filled::before {
    content: '\21C4';
    position: absolute; top: 6px; left: 6px; z-index: 3;
    width: 26px; height: 26px; border-radius: 50%;
    border: 2px solid var(--ink); background: var(--yellow);
    box-shadow: inset 0 -3px 0 var(--yellow-d);
    color: var(--text-on-bright); font-size: 17px; font-weight: 900; line-height: 19px; text-align: center;
    pointer-events: none;
}
.char-team-slot .slot-icon {
    position: relative; flex: none;
    width: min(100%, 96px); height: auto; aspect-ratio: 1; border-radius: 50%;
    border: var(--line) solid var(--ink);
    box-shadow: inset 0 0 0 3px rgba(255,255,255,0.18), 0 4px 0 rgba(0,0,0,0.25);
    display: flex; align-items: center; justify-content: center;
    overflow: hidden;
}
.char-team-slot .slot-icon img {
    width: 100% !important; height: 100% !important;    /* JS 가 넣는 고정 px 크기 무시 */
    border-radius: 50%; object-fit: cover; display: block;
}
.char-team-slot .slot-icon .slot-icon-inner { width: 60%; height: 60%; border-radius: 50%; }
.char-team-slot .slot-icon .slot-icon-ears {
    position: absolute; top: 4px; left: 0; width: 100%;
    display: flex; justify-content: space-between; padding: 0 12px;
}
.char-team-slot .slot-icon .slot-icon-ear { width: 18px; height: 18px; border-radius: 50% 50% 0 0; }
.char-team-slot .slot-name {
    position: relative; z-index: 2;
    max-width: 100%; margin-top: 4px;
    font-family: var(--font-display); font-size: var(--fs-md); font-weight: 900; line-height: 1.2;
    color: #fff; text-shadow: var(--text-shadow); text-align: center;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.char-team-slot .slot-skill {
    position: relative; z-index: 2;
    max-width: 100%; padding: 3px 8px;
    border-radius: var(--r-pill); background: rgba(18,11,51,0.55);
    font-size: var(--fs-xs); font-weight: 800; color: var(--c-player-light);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.char-team-slot .slot-nav-hint { font-size: var(--fs-xs); color: var(--text-faint); }

/* 소개 버튼 (카드 하단 전체 폭) */
.char-team-slot .info-btn {
    position: relative; z-index: 3;
    align-self: stretch; margin-top: auto;
    display: flex; align-items: center; justify-content: center; gap: 4px;
    min-height: 40px; padding: 0 6px 3px;
    border: 2px solid var(--ink); border-radius: var(--r-sm);
    background: var(--blue); box-shadow: inset 0 -4px 0 var(--blue-d);
    color: #fff; font-size: var(--fs-sm); font-weight: 900; text-shadow: var(--text-shadow);
}
.char-team-slot .info-btn:active { transform: translateY(2px); box-shadow: inset 0 -2px 0 var(--blue-d); }
.char-team-slot .info-btn .info-btn-mark { font-size: var(--fs-md); font-weight: 900; }

/* 빼기 버튼 (모서리) */
.char-team-slot .remove-btn {
    position: absolute; top: -10px; right: -8px; z-index: 4;
    width: 32px; height: 32px; border-radius: 50%; padding: 0 0 3px;
    border: var(--line) solid var(--ink); background: var(--red);
    box-shadow: inset 0 -3px 0 var(--red-d), 0 2px 0 rgba(0,0,0,0.3);
    color: #fff; font-size: 18px; font-weight: 900; line-height: 1;
    display: flex; align-items: center; justify-content: center;
}
.char-team-slot .remove-btn::after { content: ''; position: absolute; inset: -8px; }   /* 터치 영역 확장 */
.char-team-slot .remove-btn:active { transform: scale(0.9); }

/* 빈 슬롯: "+" 추가 */
.char-team-slot.char-add-slot {
    justify-content: center; gap: 4px; padding: 10px 6px;
    border: var(--line) dashed rgba(255,255,255,0.4);
    background: rgba(18,11,51,0.35);
    box-shadow: none;
    color: #fff; font-size: 52px; font-weight: 900; line-height: 1;
    text-shadow: var(--text-shadow);
}
.char-team-slot.char-add-slot:active { transform: scale(0.97); background: rgba(18,11,51,0.5); box-shadow: none; }

/* 채울 캐릭터가 없는 슬롯: 다음 해금 안내 */
.char-team-slot.char-add-slot.slot-locked-hint {
    border-color: var(--yellow-d);
    background: rgba(18,11,51,0.5);
    font-size: inherit;
}
.slot-lock-emoji { font-size: 34px; line-height: 1; filter: drop-shadow(0 3px 0 rgba(0,0,0,0.3)); }
.slot-lock-text {
    margin-top: 6px;
    font-size: var(--fs-sm); font-weight: 900; line-height: 1.35; text-align: center;
    color: var(--yellow); text-shadow: var(--text-shadow);
}

/* 잠긴 캐릭터가 들어온 슬롯 (탭=다음 캐릭터, 자물쇠 배지=해금 카드) */
.char-team-slot.locked-slot { background: linear-gradient(180deg, var(--gray-d) 0%, #2a2360 100%); }
.char-team-slot.locked-slot .slot-icon img { filter: grayscale(0.7) brightness(0.55); }
.char-team-slot.locked-slot .slot-skill { color: var(--text-dim); }
.slot-lock-overlay {
    position: absolute; inset: 0; z-index: 1;
    display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
    padding-top: 26px;
    border-radius: calc(var(--r-md) - 3px);
}
.slot-lock-badge {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    min-width: 64px; min-height: 60px; padding: 4px 8px 6px;
    border: 2px solid var(--ink); border-radius: var(--r-sm);
    background: var(--yellow); box-shadow: inset 0 -4px 0 var(--yellow-d), 0 3px 0 rgba(0,0,0,0.3);
    cursor: pointer;
}
.slot-lock-badge:active { transform: translateY(2px); box-shadow: inset 0 -2px 0 var(--yellow-d); }
.slot-lock-icon { font-size: 22px; line-height: 1; }
.slot-lock-level { font-family: var(--font-display); font-size: var(--fs-sm); font-weight: 900; color: var(--text-on-bright); }

/* ============================================================
   ARENA PICKER — 가로 스크롤 타일
   ============================================================ */
#theme-selector { min-width: 0; }
#theme-buttons {
    gap: 12px;
    margin: 0 calc(-1 * var(--gutter));
    padding: 6px var(--gutter) 12px;
    scroll-padding: 0 var(--gutter);
}
#theme-buttons > :first-child { margin-left: auto; }
#theme-buttons > :last-child { margin-right: auto; }
.theme-btn {
    position: relative; flex: none;
    width: 104px; padding: 0;
    display: grid; grid-template-rows: 32px 32px auto;
    border: var(--line) solid var(--ink); border-radius: var(--r-md);
    background: var(--panel-2);
    box-shadow: 0 5px 0 rgba(0,0,0,0.3);
    overflow: hidden;
    transition: transform 0.08s ease;
}
.theme-btn:active { transform: translateY(3px); }
.theme-btn-top, .theme-btn-bottom { display: block; width: 100%; height: 100%; }
.theme-btn-top { box-shadow: inset 0 3px 0 rgba(255,255,255,0.25); }
.theme-btn-bottom { box-shadow: inset 0 -4px 0 rgba(0,0,0,0.18); }
/* 네트 */
.theme-btn::before {
    content: ''; position: absolute; left: 0; right: 0; top: 30px; height: 4px; z-index: 1;
    background: repeating-linear-gradient(90deg, #fff 0 6px, rgba(255,255,255,0.55) 6px 10px);
    box-shadow: 0 2px 0 rgba(0,0,0,0.2);
}
.theme-btn-label {
    display: block; min-height: 34px; padding: 8px 4px 9px;
    border-top: var(--line) solid var(--ink);
    background: var(--panel-2);
    font-family: var(--font-display); font-size: var(--fs-sm); font-weight: 900; line-height: 1.2;
    color: var(--text-dim);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    pointer-events: none;
}
.theme-btn.active { border-color: var(--yellow); box-shadow: 0 0 0 3px var(--ink), 0 6px 0 3px rgba(0,0,0,0.3); }
.theme-btn.active .theme-btn-label {
    background: var(--yellow); color: var(--text-on-bright); border-top-color: var(--yellow-d);
}
.theme-btn.active::after {
    content: '\2714';
    position: absolute; top: 5px; right: 5px; z-index: 2;
    width: 24px; height: 24px; border-radius: 50%;
    border: 2px solid var(--ink); background: var(--green);
    color: #06331c; font-size: 13px; font-weight: 900; line-height: 20px; text-align: center;
}
.theme-btn.theme-locked { cursor: default; }
.theme-btn.theme-locked:active { transform: none; }
.theme-btn.theme-locked .theme-btn-top,
.theme-btn.theme-locked .theme-btn-bottom { filter: grayscale(0.55) brightness(0.5); }
.theme-btn.theme-locked::before { opacity: 0.4; }
.theme-btn.theme-locked .theme-btn-label { color: var(--yellow); background: var(--ink); }
.theme-lock-icon {
    position: absolute; left: 50%; top: 32px; z-index: 2;
    transform: translate(-50%, -50%);
    font-size: 26px; line-height: 1;
    filter: drop-shadow(0 3px 0 rgba(0,0,0,0.35));
    pointer-events: none;
}

/* ============================================================
   CHARACTER CARDS (공용 그리드 카드 — UI._createCharCard)
   ============================================================ */
.char-card {
    position: relative;
    display: flex; flex-direction: column; align-items: center; gap: 4px;
    width: 100%; min-width: 0; padding: 12px 10px 10px;
    border: var(--line) solid var(--ink); border-radius: var(--r-md);
    background: linear-gradient(180deg, var(--panel-3), var(--panel-2));
    box-shadow: inset 0 2px 0 rgba(255,255,255,0.14), inset 0 -5px 0 rgba(0,0,0,0.22), 0 4px 0 rgba(0,0,0,0.3);
    cursor: pointer; overflow: hidden;
    transition: transform 0.08s ease;
}
.char-card:active { transform: translateY(3px); }
.char-card.selected, .char-card.active { border-color: var(--yellow); box-shadow: 0 0 0 3px var(--ink), 0 6px 0 3px rgba(0,0,0,0.3); }
.char-card.locked { background: linear-gradient(180deg, var(--gray-d), #2a2360); }
.char-icon {
    position: relative; flex: none;
    width: 72px; height: 72px; border-radius: 50%;
    border: var(--line) solid var(--ink);
    display: flex; align-items: center; justify-content: center;
    font-size: 30px; overflow: hidden;
}
.char-icon-inner { width: 60%; height: 60%; border-radius: 50%; }
.char-icon-ears { position: absolute; top: 3px; left: 0; width: 100%; display: flex; justify-content: space-between; padding: 0 9px; }
.char-icon-ear { width: 15px; height: 15px; border-radius: 50% 50% 0 0; }
.char-name {
    max-width: 100%;
    font-family: var(--font-display); font-size: var(--fs-md); font-weight: 900; color: #fff;
    text-shadow: var(--text-shadow); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.char-stats { width: 100%; }
.char-stat-row { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; }
.char-stat-label { min-width: 28px; font-size: var(--fs-xs); font-weight: 900; color: var(--text-dim); text-align: left; }
.char-stat-bar {
    flex: 1; height: 10px; border-radius: var(--r-pill);
    border: 2px solid var(--ink); background: rgba(18,11,51,0.75); overflow: hidden;
}
.char-stat-fill { height: 100%; border-radius: inherit; transition: width 0.3s ease; }
.char-stat-fill.spd, .shop-stat-fill.spd { background: linear-gradient(180deg, rgba(255,255,255,0.45), rgba(255,255,255,0) 55%), var(--blue); }
.char-stat-fill.pow, .shop-stat-fill.pow { background: linear-gradient(180deg, rgba(255,255,255,0.45), rgba(255,255,255,0) 55%), var(--orange); }
.char-skill { min-height: 14px; font-size: var(--fs-xs); font-weight: 800; color: var(--c-player-light); }
.char-passive { min-height: 14px; font-size: var(--fs-xs); font-weight: 800; color: var(--c-accent-soft); text-align: center; }
.char-lock-overlay {
    position: absolute; inset: 0; z-index: 1;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
    background: rgba(18,11,51,0.62);
}
.char-lock-icon { font-size: 30px; line-height: 1; }
.char-lock-level {
    padding: 2px 10px; border: 2px solid var(--ink); border-radius: var(--r-pill);
    background: var(--yellow); color: var(--text-on-bright);
    font-family: var(--font-display); font-size: var(--fs-sm); font-weight: 900;
}

/* ============================================================
   CHARACTER SHOP / 상세 — 바텀 시트 (넓은 화면: 다이얼로그)
   ============================================================ */
#char-shop-overlay { z-index: 720; animation: fadeIn 0.2s ease-out; }
#char-shop-box {
    position: relative;
    width: 100%; max-width: var(--col);
    max-height: calc(100dvh - var(--sa-t) - 24px);
    overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch; touch-action: pan-y;
    padding: 12px var(--gutter) calc(16px + var(--sa-b));
    border: var(--line) solid var(--ink); border-bottom: 0;
    border-radius: var(--r-lg) var(--r-lg) 0 0;
    background:
        linear-gradient(180deg, var(--bg-2) 0, #3a22a0 92px, var(--ink) 92px, var(--ink) 95px, var(--panel) 95px) top / 100% 96px no-repeat,
        var(--panel);
    box-shadow: 0 -8px 40px rgba(0,0,0,0.45);
    text-align: center;
    animation: ui-sheet-up 0.28s var(--ease-out) both;
}
.shop-close-btn {
    position: sticky; top: 0; z-index: 5;
    display: flex; margin: 0 -4px -44px auto;      /* 흐름에서 높이를 차지하지 않게 */
}
.shop-char-icon {
    position: relative;
    width: 128px; height: 128px; border-radius: 50%;
    margin: 18px auto 10px;
    border: 4px solid var(--ink);
    box-shadow: 0 0 0 4px rgba(255,255,255,0.16), 0 6px 0 4px rgba(0,0,0,0.25);
    display: flex; align-items: center; justify-content: center;
    overflow: hidden;
}
.shop-char-icon .shop-icon-inner { width: 60%; height: 60%; border-radius: 50%; }
.shop-char-icon .shop-icon-ears { position: absolute; top: 4px; left: 0; width: 100%; display: flex; justify-content: space-between; padding: 0 16px; }
.shop-char-icon .shop-icon-ear { width: 26px; height: 26px; border-radius: 50% 50% 0 0; }
.shop-char-name {
    margin-bottom: 14px;
    font-family: var(--font-display); font-size: 28px; font-weight: 900; line-height: 1.15;
    color: #fff; text-shadow: var(--text-outline); letter-spacing: 0.5px;
}
.shop-stats {
    width: 100%; margin: 0 0 12px; padding: 12px 14px 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);
}
.shop-stat-row { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.shop-stat-label { min-width: 34px; font-size: var(--fs-sm); font-weight: 900; color: var(--text-dim); text-align: left; }
.shop-stat-bar {
    flex: 1; height: 16px; border-radius: var(--r-pill);
    border: 2px solid var(--ink); background: rgba(18,11,51,0.75); overflow: hidden;
}
.shop-stat-fill { height: 100%; border-radius: inherit; }
.shop-stat-value {
    min-width: 24px; text-align: right;
    font-family: var(--font-display); font-size: var(--fs-md); font-weight: 900; color: #fff;
    font-variant-numeric: tabular-nums;
}
.shop-divider { display: none; }
.shop-skill-section,
.shop-passive-section {
    margin-bottom: 12px; padding: 12px 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);
    text-align: left;
}
.shop-skill-label,
.shop-passive-label {
    display: inline-block; margin-bottom: 8px; padding: 2px 10px;
    border: 2px solid var(--ink); border-radius: var(--r-pill);
    background: var(--purple); color: #fff;
    font-family: var(--font-display); font-size: var(--fs-xs); font-weight: 900; letter-spacing: 1px;
}
.shop-passive-label { background: var(--orange); }
.shop-skill-row { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.shop-skill-icon { display: inline-block; font-size: 30px; line-height: 1; }
.shop-skill-name {
    font-family: var(--font-display); font-size: var(--fs-lg); font-weight: 900;
    color: var(--c-player-light); text-shadow: var(--text-shadow);
}
.shop-skill-category {
    margin-left: auto; padding: 3px 10px;
    border: 2px solid var(--ink); border-radius: var(--r-pill);
    background: var(--yellow); color: var(--text-on-bright);
    font-size: var(--fs-xs); font-weight: 900; white-space: nowrap;
}
.shop-skill-desc {
    margin-top: 10px; padding: 10px 12px;
    border-radius: var(--r-sm); background: rgba(18,11,51,0.5);
    font-size: var(--fs-md); font-weight: 700; line-height: 1.5; color: #fff;
}
.shop-skill-cd { margin-top: 8px; font-size: var(--fs-sm); font-weight: 800; color: var(--text-dim); }
.shop-passive-text {
    font-family: var(--font-display); font-size: var(--fs-md); font-weight: 800; line-height: 1.45;
    color: var(--c-accent-soft);
}
.shop-unlock-info {
    margin: 4px 0 12px;
    font-size: var(--fs-sm); font-weight: 800; line-height: 1.6; color: var(--text-dim);
}
.shop-unlock-info .shop-level-req {
    display: inline-block; margin-right: 4px; padding: 1px 10px;
    border: 2px solid var(--ink); border-radius: var(--r-pill);
    background: var(--yellow); color: var(--text-on-bright); font-weight: 900;
}
.shop-already-unlocked {
    margin: 4px 0; padding: 12px;
    border: var(--line) solid var(--ink); border-radius: var(--r-md);
    background: rgba(62,224,138,0.16);
    font-family: var(--font-display); font-size: var(--fs-lg); font-weight: 900;
    color: var(--green); text-shadow: var(--text-shadow);
}
.shop-buy-btn {
    position: sticky; bottom: 0; z-index: 4;
    font-size: var(--fs-lg);
    /* 스크롤되는 내용이 버튼 주변으로 비치지 않게 패널색 받침 */
    box-shadow: inset 0 calc(-1 * var(--depth)) 0 var(--btn-d), 0 4px 0 rgba(0,0,0,0.3), 0 0 0 10px var(--panel), 0 16px 0 10px var(--panel);
}
.shop-buy-btn:active:not(:disabled) { box-shadow: inset 0 -2px 0 var(--btn-d), 0 1px 0 rgba(0,0,0,0.3), 0 0 0 10px var(--panel), 0 16px 0 10px var(--panel); }
.shop-buy-btn.insufficient {
    --btn: var(--gray); --btn-d: var(--gray-d); --btn-text: #fff;
    text-shadow: var(--text-shadow); font-size: var(--fs-md); cursor: default;
}
.shop-buy-btn.insufficient:active { transform: none; }
/* 해금 축하 */
.shop-unlocked-anim { animation: shopUnlockCelebrate 0.6s var(--ease-bounce) both; }
@keyframes shopUnlockCelebrate {
    0%   { transform: scale(0.5); opacity: 0; }
    60%  { transform: scale(1.12); opacity: 1; }
    100% { transform: scale(1); opacity: 1; }
}

/* ============================================================
   CAMPAIGN MAP
   ============================================================ */
#campaign-content {
    display: flex; flex-direction: column;
    width: 100%; max-width: 720px; min-height: 0;
    padding: var(--sa-t) var(--sa-r) 0 var(--sa-l);
}
.campaign-header {
    flex: none;
    display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px 10px;
    padding: 10px var(--gutter) 12px;
}
.campaign-back-btn { white-space: nowrap; min-height: 44px; }
.campaign-title {
    min-width: 0;
    font-family: var(--font-display); font-size: var(--fs-xl); font-weight: 900; line-height: 1.1;
    color: #fff; text-shadow: var(--text-outline); letter-spacing: 1px;
}
.campaign-star-total {
    display: inline-flex; align-items: center; gap: 4px;
    min-height: 36px; padding: 0 14px 0 10px;
    border: 2px solid var(--ink); border-radius: var(--r-pill);
    background: rgba(18,11,51,0.7);
    font-family: var(--font-display); font-size: var(--fs-md); font-weight: 900; color: #fff;
    font-variant-numeric: tabular-nums; white-space: nowrap;
}
.campaign-star-icon { font-size: 20px; line-height: 1; color: var(--yellow); text-shadow: 0 2px 0 var(--yellow-d); }
.campaign-star-milestone {
    grid-column: 1 / -1;
    padding: 8px 12px;
    border: 2px solid var(--ink); border-radius: var(--r-sm);
    background: rgba(18,11,51,0.5);
    font-size: var(--fs-sm); font-weight: 800; line-height: 1.4; color: var(--text-dim); text-align: center;
}
.campaign-star-milestone b { color: var(--yellow); font-weight: 900; }

/* 존 탭 */
.campaign-zone-tabs {
    flex: none; gap: 8px;
    padding: 2px var(--gutter) 12px;
    scroll-padding: 0 var(--gutter);
}
.campaign-zone-tabs > :first-child { margin-left: auto; }
.campaign-zone-tabs > :last-child { margin-right: auto; }
.campaign-zone-tab {
    flex: none; min-height: 46px; padding: 0 18px 4px;
    border: var(--line) solid var(--ink); border-radius: var(--r-pill);
    background: var(--panel-2);
    box-shadow: inset 0 -4px 0 rgba(0,0,0,0.25), 0 3px 0 rgba(0,0,0,0.25);
    font-family: var(--font-display); font-size: var(--fs-md); font-weight: 900; color: var(--text-dim);
    white-space: nowrap;
}
.campaign-zone-tab:active:not(.locked) { transform: translateY(2px); }
.campaign-zone-tab.active {
    background: var(--yellow); color: var(--text-on-bright);
    box-shadow: inset 0 -4px 0 var(--yellow-d), 0 3px 0 rgba(0,0,0,0.25);
}
.campaign-zone-tab.locked { color: var(--text-faint); background: rgba(18,11,51,0.55); box-shadow: none; cursor: default; }
.campaign-zone-tab.locked::before { content: '\01F512\00A0'; font-size: 0.85em; }

/* 내 팀 행 */
.campaign-team-btn {
    flex: none;
    display: flex; align-items: center; gap: 6px;
    width: calc(100% - 2 * var(--gutter));
    margin: 0 var(--gutter) 12px; min-height: 52px; padding: 6px 8px 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), inset 0 -4px 0 rgba(0,0,0,0.2), 0 4px 0 rgba(0,0,0,0.25);
    font-family: var(--font-display); font-size: var(--fs-md); font-weight: 800; color: #fff;
    text-align: left; white-space: nowrap;
}
.campaign-team-btn:active { transform: translateY(2px); }
.campaign-team-btn b { flex: 1; min-width: 0; color: var(--c-player-light); font-weight: 900; overflow: hidden; text-overflow: ellipsis; }
.campaign-team-edit {
    flex: none; padding: 6px 12px 8px;
    border: 2px solid var(--ink); border-radius: var(--r-sm);
    background: var(--blue); box-shadow: inset 0 -3px 0 var(--blue-d);
    font-size: var(--fs-sm); font-weight: 900; color: #fff;
}

/* 스테이지 그리드 (세로 스크롤 영역) — 폰: 4열 + 보스는 한 줄 전체 */
.campaign-stage-grid {
    flex: 1; min-height: 0;
    display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px 12px;
    align-content: start;
    overflow-y: auto; overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch; touch-action: pan-y;
    padding: 12px var(--gutter) calc(24px + var(--sa-b));
}
.campaign-stage-btn {
    position: relative;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
    width: 100%; aspect-ratio: 1; min-height: 64px; padding: 4px 4px 8px;
    border: var(--line) solid var(--ink); border-radius: var(--r-md);
    background: linear-gradient(180deg, rgba(255,255,255,0.22), rgba(255,255,255,0) 50%), var(--purple);
    box-shadow: inset 0 -6px 0 var(--purple-d), 0 5px 0 rgba(0,0,0,0.3);
    transition: transform 0.08s ease;
}
.campaign-stage-btn:active:not(.locked) { transform: translateY(3px); }
.campaign-stage-num {
    font-family: var(--font-display); font-size: 26px; font-weight: 900; line-height: 1;
    color: #fff; text-shadow: var(--text-outline);
}
.campaign-stage-stars { display: flex; gap: 1px; }
.campaign-star { font-size: 14px; line-height: 1; }
.campaign-star.earned { color: var(--yellow); text-shadow: 0 1px 0 var(--ink), 0 2px 0 var(--yellow-d); }
.campaign-star.empty { color: rgba(18,11,51,0.5); }

.campaign-stage-btn.completed {
    background: linear-gradient(180deg, rgba(255,255,255,0.28), rgba(255,255,255,0) 50%), var(--green);
    box-shadow: inset 0 -6px 0 var(--green-d), 0 5px 0 rgba(0,0,0,0.3);
}
.campaign-stage-btn.current {
    background: linear-gradient(180deg, rgba(255,255,255,0.35), rgba(255,255,255,0) 50%), var(--blue);
    box-shadow: inset 0 -6px 0 var(--blue-d), 0 5px 0 rgba(0,0,0,0.3), 0 0 0 4px rgba(255,203,61,0.9);
    animation: campaignPulse 1.2s ease-in-out infinite;
}
@keyframes campaignPulse {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-5px); }
}
.campaign-stage-btn.boss {
    grid-column: 1 / -1; aspect-ratio: auto; min-height: 76px;
    flex-direction: row; gap: 12px; padding: 6px 16px 12px;
    background:
        repeating-linear-gradient(135deg, rgba(0,0,0,0.1) 0 14px, transparent 14px 28px),
        linear-gradient(180deg, rgba(255,255,255,0.25), rgba(255,255,255,0) 50%), var(--red);
    box-shadow: inset 0 -6px 0 var(--red-d), 0 5px 0 rgba(0,0,0,0.3);
}
.campaign-stage-btn.boss.current { box-shadow: inset 0 -6px 0 var(--red-d), 0 5px 0 rgba(0,0,0,0.3), 0 0 0 4px rgba(255,203,61,0.9); }
.campaign-stage-btn.boss .campaign-stage-num { font-size: 32px; }
.campaign-stage-btn.boss .campaign-star { font-size: 20px; }
.campaign-boss-label {
    order: -1;
    padding: 3px 12px 4px;
    border: 2px solid var(--ink); border-radius: var(--r-pill);
    background: var(--ink); color: var(--yellow);
    font-family: var(--font-display); font-size: var(--fs-md); font-weight: 900; letter-spacing: 1px; white-space: nowrap;
}
.campaign-boss-label::before { content: '\01F451\00A0'; }
.campaign-stage-btn.locked {
    cursor: default; animation: none;
    background: #3b356f;
    box-shadow: inset 0 -6px 0 #2a2556, 0 5px 0 rgba(0,0,0,0.3);
}
.campaign-stage-btn.locked .campaign-stage-num { font-size: 22px; text-shadow: none; opacity: 0.75; }
.campaign-stage-btn.locked .campaign-stage-stars { visibility: hidden; height: 0; }
.campaign-stage-btn.boss.locked .campaign-boss-label { color: var(--text-dim); }

/* ============================================================
   CAMPAIGN STAGE POPUP — 바텀 시트
   ============================================================ */
.campaign-popup-overlay { z-index: 800; animation: fadeIn 0.2s ease-out; }
.campaign-popup-box {
    width: 100%; max-width: var(--col);
    max-height: calc(100dvh - var(--sa-t) - 24px);
    overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch; touch-action: pan-y;
    padding: 18px var(--gutter) 0;
    border: var(--line) solid var(--ink); border-bottom: 0;
    border-radius: var(--r-lg) var(--r-lg) 0 0;
    background: var(--panel);
    box-shadow: 0 -8px 40px rgba(0,0,0,0.45);
    text-align: center;
    animation: ui-sheet-up 0.28s var(--ease-out) both;
}
.campaign-popup-title {
    font-family: var(--font-display); font-size: 30px; font-weight: 900; line-height: 1.15;
    color: #fff; text-shadow: var(--text-outline); letter-spacing: 0.5px;
}
.campaign-popup-title.boss { color: var(--yellow); }
.campaign-popup-title.boss::before { content: '\01F451\00A0'; text-shadow: none; }
.campaign-popup-zone {
    display: inline-block; margin: 8px 0 12px; padding: 3px 14px;
    border: 2px solid var(--ink); border-radius: var(--r-pill);
    background: rgba(18,11,51,0.6);
    font-size: var(--fs-sm); font-weight: 900; color: var(--text-dim); letter-spacing: 0.5px;
}
.campaign-popup-best {
    display: flex; align-items: center; justify-content: center; gap: 2px;
    margin-bottom: 12px;
    font-size: var(--fs-md); font-weight: 800; color: var(--text-dim);
}
.campaign-popup-best .campaign-star { font-size: 26px; }
.campaign-popup-best .campaign-star.empty { color: rgba(255,255,255,0.18); }
.campaign-popup-team,
.campaign-popup-star-conditions {
    margin-bottom: 12px; padding: 12px 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);
    text-align: left;
}
.campaign-popup-label {
    display: inline-block; margin-bottom: 8px; padding: 2px 10px;
    border: 2px solid var(--ink); border-radius: var(--r-pill);
    background: var(--red); color: #fff;
    font-family: var(--font-display); font-size: var(--fs-xs); font-weight: 900; letter-spacing: 1px;
}
.campaign-popup-char {
    display: flex; align-items: center; gap: 8px;
    padding: 4px 0;
    font-size: var(--fs-md); font-weight: 800; color: #fff;
}
.campaign-popup-char::before {
    content: ''; flex: none; width: 10px; height: 10px; border-radius: 50%;
    border: 2px solid var(--ink); background: var(--red);
}
.campaign-popup-match {
    display: flex; flex-wrap: wrap; justify-content: center; gap: 8px;
    margin-bottom: 12px;
}
.campaign-popup-match > div {
    display: inline-flex; align-items: center; min-height: 34px; padding: 0 14px;
    border: 2px solid var(--ink); border-radius: var(--r-pill);
    background: rgba(18,11,51,0.7);
    font-size: var(--fs-sm); font-weight: 900; color: #fff;
}
.campaign-popup-match > .campaign-popup-special { background: var(--yellow); color: var(--text-on-bright); }
.campaign-popup-star-conditions { font-size: var(--fs-sm); font-weight: 800; color: var(--text-dim); line-height: 1.3; }
.campaign-popup-star-conditions > div { display: flex; align-items: center; padding: 4px 0; }
.campaign-popup-star-conditions .campaign-star { flex: none; font-size: 18px; }
.campaign-popup-star-conditions .campaign-star:last-of-type { margin-right: 10px; }
.campaign-popup-star-conditions .campaign-star:first-of-type:last-of-type { margin-right: 46px; }
.campaign-popup-star-conditions .campaign-star:nth-of-type(2):last-of-type { margin-right: 28px; }
.campaign-popup-buttons {
    position: sticky; bottom: 0; z-index: 2;
    display: flex; gap: 10px;
    padding: 12px 0 calc(14px + var(--sa-b));
    background: linear-gradient(180deg, rgba(44,33,117,0) 0, var(--panel) 12px);
}
.campaign-popup-cancel { flex: none; min-height: 64px; border-radius: var(--r-lg); }
.campaign-popup-battle { flex: 1; letter-spacing: 2px; }

/* ============================================================
   ONLINE PvP / 랭크 대전 — #online-box 는 ui-sheet
   ============================================================ */
#online-overlay { z-index: 720; animation: fadeIn 0.2s ease-out; }
#online-box { max-width: 440px; }
.online-body { text-align: center; }
#online-home, #online-room { display: flex; flex-direction: column; gap: 12px; }
#ranked-queue { display: flex; flex-direction: column; align-items: center; gap: 16px; padding: 20px 0 8px; }
#online-home.hidden, #online-room.hidden, #ranked-queue.hidden, #ranked-queue-btn.hidden { display: none; }
#ranked-me-line {
    min-height: 0; font-size: var(--fs-sm); font-weight: 800; line-height: 1.4; color: var(--text-dim);
}
#ranked-me-line:empty { display: none; }
#ranked-me-line b { color: var(--yellow); font-weight: 900; }
.online-or {
    display: flex; align-items: center; gap: 12px;
    font-size: var(--fs-sm); font-weight: 900; color: var(--text-faint);
}
.online-or::before, .online-or::after {
    content: ''; flex: 1; height: 3px; border-radius: 2px; background: var(--panel-line);
}
#online-code-input {
    width: 100%; height: 64px; padding: 0 12px;
    border: var(--line) solid var(--ink); border-radius: var(--r-md);
    background: rgba(18,11,51,0.75);
    box-shadow: inset 0 4px 0 rgba(0,0,0,0.3);
    color: #fff; caret-color: var(--yellow);
    font-family: var(--font-display); font-size: 28px; font-weight: 900;
    text-align: center; letter-spacing: 8px; text-transform: uppercase;
    -webkit-user-select: text; user-select: text; touch-action: manipulation;
    outline: none;
}
#online-code-input:focus { border-color: var(--yellow); }
#online-code-input::placeholder { font-size: var(--fs-lg); letter-spacing: 1px; font-weight: 800; color: var(--text-faint); }
#online-join-btn { min-height: 56px; font-size: var(--fs-lg); }

/* 방 대기 */
.online-room-label { font-size: var(--fs-sm); font-weight: 900; color: var(--text-dim); letter-spacing: 2px; }
#online-room-code {
    padding: 10px 8px 12px 16px;
    border: var(--line) dashed var(--yellow-d); border-radius: var(--r-md);
    background: rgba(18,11,51,0.6);
    font-family: var(--font-display); font-size: 44px; font-weight: 900; line-height: 1.1;
    color: var(--yellow); text-shadow: var(--text-outline); letter-spacing: 8px;
    -webkit-user-select: all; user-select: all;
}
#online-qr { display: flex; flex-direction: column; align-items: center; gap: 8px; }
#online-qr:empty { display: none; }
#online-qr img {
    width: 168px; height: 168px; padding: 8px;
    border: var(--line) solid var(--ink); border-radius: var(--r-md);
    background: #fff; box-shadow: 0 4px 0 rgba(0,0,0,0.3);
    image-rendering: pixelated;
}
.online-qr-hint { font-size: var(--fs-sm); font-weight: 800; color: var(--text-dim); }
#online-room-status,
#ranked-queue-status {
    min-height: 44px; padding: 10px 14px;
    border: 2px solid var(--ink); border-radius: var(--r-md);
    background: rgba(18,11,51,0.55);
    font-size: var(--fs-md); font-weight: 800; line-height: 1.45; color: #fff;
}
#ranked-queue-status { align-self: stretch; }
.ranked-queue-spinner {
    width: 96px; height: 96px; border-radius: 50%;
    border: var(--line) solid var(--ink);
    background: linear-gradient(180deg, rgba(255,255,255,0.28), rgba(255,255,255,0) 50%), var(--red);
    box-shadow: inset 0 -6px 0 var(--red-d), 0 5px 0 rgba(0,0,0,0.3);
    display: flex; align-items: center; justify-content: center;
    font-size: 44px; line-height: 1;
    animation: rankedPulse 1.2s ease-in-out infinite;
}
@keyframes rankedPulse {
    0%, 100% { transform: scale(1) rotate(-6deg); }
    50%      { transform: scale(1.12) rotate(6deg); }
}
#ranked-cancel-btn { min-width: 160px; }

/* 토스트 (온라인 흐름에서 사용, UI.toast) */
.ui-toast {
    position: fixed; left: 50%; bottom: calc(88px + var(--sa-b)); z-index: 900;
    width: max-content; max-width: calc(100vw - 32px);
    transform: translateX(-50%) translateY(12px);
    padding: 12px 20px;
    border: var(--line) solid var(--ink); border-radius: var(--r-pill);
    background: var(--panel-2); box-shadow: var(--shadow-md);
    color: #fff; font-size: var(--fs-md); font-weight: 900; text-align: center;
    opacity: 0; pointer-events: none;
    transition: opacity 0.25s, transform 0.25s var(--ease-bounce);
}
.ui-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* 구 "랭크 대전" 섹션에 있던 결과/랭킹용 조각 — 담당 파일(hud/meta)이 덮어쓸 수 있도록 :where 로 최저 우선순위 */
:where(.result-ranked-verdict) {
    display: inline-block; margin: 10px auto 0; padding: 8px 16px;
    border: 2px solid var(--ink); border-radius: var(--r-pill);
    background: rgba(18,11,51,0.6);
    font-family: var(--font-display); font-size: var(--fs-md); font-weight: 900; color: var(--text-dim);
}
:where(.result-ranked-verdict.up) { color: var(--green); }
:where(.result-ranked-verdict.down) { color: var(--red); }
:where(.ranking-tier) {
    margin-left: 4px; padding: 1px 8px; border-radius: var(--r-pill);
    background: rgba(255,203,61,0.16); color: var(--yellow);
    font-size: var(--fs-xs); font-weight: 900;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
/* 작은 폰 (≤ 380px) */
@media (max-width: 380px) {
    .char-team-slots { gap: 8px; }
    .char-team-slot { min-height: 186px; padding: 12px 6px 6px; }
    .char-team-slot .slot-icon { width: min(100%, 76px); }
    .char-team-slot .slot-name { font-size: var(--fs-sm); }
    .theme-btn { width: 96px; }
    .campaign-stage-grid { gap: 12px 10px; }
    .campaign-stage-num { font-size: 22px; }
    .campaign-star { font-size: 12px; }
    #online-room-code { font-size: 38px; letter-spacing: 6px; }
}
/* 낮은 세로 화면 (360×640 등): 세로 여백 절약 */
@media (max-height: 700px) and (orientation: portrait) {
    .team-setup-body { gap: 16px; }
    .shop-char-icon { width: 104px; height: 104px; margin-top: 22px; }
    .shop-char-name { font-size: var(--fs-xl); margin-bottom: 10px; }
    #online-qr img { width: 132px; height: 132px; }
}

/* 넓은 화면: 다이얼로그 */
@media (min-width: 600px) and (min-height: 560px) {
    #team-setup-overlay {
        align-items: center; padding: 24px;
        background: var(--scrim);
        -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
    }
    #team-setup-box {
        max-width: 620px; max-height: min(680px, calc(100dvh - 48px));
        border: var(--line) solid var(--ink); border-radius: var(--r-lg);
        background: var(--panel);
        box-shadow: var(--shadow-lg);
        overflow: hidden;
        animation: ui-pop 0.25s var(--ease-out) both;
    }
    .team-setup-head {
        padding: 10px 18px;
        background: linear-gradient(180deg, var(--bg-2), #3a22a0);
        border-bottom: var(--line) solid var(--ink);
    }
    .team-setup-body { padding: 22px 24px; gap: 24px; --gutter: 24px; }
    .team-setup-foot { padding: 14px 24px 18px; background: rgba(18,11,51,0.35); border-top: var(--line) solid var(--ink); }
    .char-team-slots { gap: 14px; }
    .char-team-slot { min-height: 226px; }
    .char-team-slot .slot-icon { width: 104px; }

    #char-shop-box,
    .campaign-popup-box {
        border-bottom: var(--line) solid var(--ink); border-radius: var(--r-lg);
        max-height: min(720px, calc(100dvh - 48px));
        box-shadow: var(--shadow-lg);
        animation-name: ui-pop;
    }
    #char-shop-box { padding-bottom: 16px; }

    .campaign-header { padding-top: 18px; }
    .campaign-title { font-size: var(--fs-2xl); }
    /* 5열: 보스가 각 줄의 마지막 칸 */
    .campaign-stage-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 20px 16px; padding-top: 16px; }
    .campaign-stage-num { font-size: 34px; }
    .campaign-star { font-size: 18px; }
    .campaign-stage-btn.boss {
        grid-column: auto; aspect-ratio: 1; flex-direction: column; gap: 4px; padding: 4px 4px 8px;
    }
    .campaign-stage-btn.boss .campaign-stage-num { font-size: 34px; }
    .campaign-stage-btn.boss .campaign-star { font-size: 18px; }
    .campaign-boss-label {
        order: 0; position: absolute; top: -12px; left: 50%; transform: translateX(-50%);
        font-size: var(--fs-sm); padding: 1px 10px 2px;
    }
}

/* ============================================================
   LANDSCAPE (모바일 가로, 높이 ≤ 500px)
   ============================================================ */
@media (max-height: 500px) and (orientation: landscape) {
    /* 팀 편성: 헤더 얇게, 본문 2단(팀 | 아레나), 하단 버튼 */
    #team-setup-box { max-width: 900px; }
    .team-setup-head { padding-top: calc(6px + var(--sa-t)); padding-bottom: 4px; }
    .team-setup-back { min-height: 40px; width: 44px; }
    .team-setup-title { font-size: var(--fs-lg); }
    .team-setup-body {
        display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 16px; align-items: start;
        padding-top: 4px; padding-bottom: 8px;
    }
    .char-selector-label, .theme-selector-label { font-size: var(--fs-md); margin-bottom: 6px; }
    .char-team-slot { min-height: 168px; padding: 10px 6px 6px; gap: 3px; }
    .char-team-slot .slot-icon { width: 60px; }
    .char-team-slot .slot-name { font-size: var(--fs-sm); margin-top: 2px; }
    .char-team-slot .info-btn { min-height: 36px; }
    .slot-lock-overlay { padding-top: 12px; }
    #theme-buttons { flex-wrap: wrap; overflow: visible; margin: 0; padding: 6px 3px 6px; gap: 10px; }
    #theme-buttons > :first-child, #theme-buttons > :last-child { margin-left: 0; margin-right: 0; }
    .theme-btn { width: calc((100% - 20px) / 3); min-width: 84px; grid-template-rows: 22px 22px auto; }
    .theme-btn::before { top: 20px; }
    .theme-lock-icon { top: 22px; font-size: 20px; }
    .theme-btn-label { min-height: 28px; padding: 5px 4px 6px; font-size: var(--fs-xs); }
    .team-setup-foot { padding-top: 6px; padding-bottom: calc(8px + var(--sa-b)); }
    #team-go-btn { min-height: 52px; font-size: var(--fs-lg); border-radius: var(--r-md); --depth: 5px; }

    /* 캠페인: 전체를 한 번에 스크롤, 5열 */
    #campaign-content {
        max-width: 900px; display: block;
        overflow-y: auto; overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch; touch-action: pan-y;
    }
    .campaign-header { grid-template-columns: auto auto 1fr auto; padding: 8px var(--gutter); }
    .campaign-title { font-size: var(--fs-lg); }
    .campaign-star-milestone { grid-column: 3; grid-row: 1; padding: 6px 10px; font-size: var(--fs-xs); }
    .campaign-star-total { grid-column: 4; }
    .campaign-zone-tabs { padding-bottom: 8px; }
    .campaign-zone-tab { min-height: 44px; font-size: var(--fs-sm); }
    .campaign-team-btn { min-height: 46px; margin-bottom: 8px; }
    .campaign-stage-grid {
        grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 18px 12px;
        overflow: visible; padding-top: 14px;
    }
    .campaign-stage-btn { aspect-ratio: auto; height: 78px; }
    .campaign-stage-btn.boss { grid-column: auto; flex-direction: column; gap: 4px; padding: 4px 4px 8px; min-height: 0; }
    .campaign-stage-btn.boss .campaign-stage-num { font-size: 26px; }
    .campaign-stage-btn.boss .campaign-star { font-size: 14px; }
    .campaign-boss-label {
        order: 0; position: absolute; top: -12px; left: 50%; transform: translateX(-50%);
        font-size: var(--fs-xs); padding: 1px 8px 2px;
    }

    /* 시트류: 화면 높이를 거의 다 쓰고, 넓게 */
    #char-shop-box, .campaign-popup-box { max-width: 620px; max-height: calc(100dvh - var(--sa-t) - 8px); }
    .shop-char-icon { width: 88px; height: 88px; margin-top: 14px; }
    .shop-char-name { font-size: var(--fs-xl); margin-bottom: 8px; }
    .campaign-popup-box { padding-top: 12px; }
    .campaign-popup-title { font-size: var(--fs-xl); }
    .campaign-popup-zone { margin: 4px 0 8px; }
    .campaign-popup-cancel, .campaign-popup-battle { min-height: 52px; font-size: var(--fs-lg); border-radius: var(--r-md); }
    #online-box { max-width: 560px; max-height: calc(100dvh - var(--sa-t) - 8px); }
    #online-box .ui-sheet__head { min-height: 50px; padding-top: 3px; padding-bottom: 3px; }
    #online-box .ui-sheet__body { padding-top: 10px; padding-bottom: 10px; }
    #online-home { gap: 8px; }
    #online-box .ui-btn--lg, #online-join-btn { min-height: 50px; font-size: var(--fs-lg); border-radius: var(--r-md); --depth: 5px; }
    #online-room { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 8px 16px; }
    #online-room .online-room-label, #online-room #online-room-code, #online-room #online-room-status, #online-room #online-begin-btn { grid-column: 1; }
    #online-qr { grid-column: 2; grid-row: 1 / span 4; }
    #online-qr img { width: 132px; height: 132px; }
    #online-room-code { font-size: 34px; padding: 6px 8px 8px 16px; }
    #online-code-input { height: 52px; }
}

/* 해금 축하 화면에서는 상단 배너 띠를 숨긴다 */
#char-shop-box:has(.shop-unlocked-anim) { background: var(--panel); }

/* ===== 캠페인 스테이지 팝업: 내 출전 팀 ===== */
.campaign-popup-myteam { position: relative; border-color: var(--blue-d); }
.campaign-popup-myteam .campaign-popup-label { background: var(--blue); margin-right: 84px; }
.campaign-popup-change { position: absolute; top: 8px; right: 8px; }
.campaign-popup-short { margin-top: 6px; font-size: var(--fs-xs); color: var(--yellow); }
