*{box-sizing:border-box}
:root{
  font-family:Pretendard,"Noto Sans KR",-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
  color:#17191d;background:#f6f7f9;
}
body{margin:0;background:#f6f7f9}
button{font:inherit}
button{-webkit-tap-highlight-color:transparent}
.wrap{width:min(1180px,calc(100% - 56px));margin:28px auto 80px}

.header{display:flex;align-items:flex-start;justify-content:space-between;gap:16px;margin-bottom:22px}
.header h1{margin:0 0 7px;font-size:30px;letter-spacing:-.7px}
.header p{margin:0;color:#747b88;font-size:15px}
.ghost{border:1px solid #d8dee8;background:#fff;border-radius:12px;padding:10px 16px;cursor:pointer;color:#3c4350}

.selector-panel{
  background:#fff;border:1px solid #e2e6ed;border-radius:18px;
  padding:24px 28px 30px;
}
.section-title{display:flex;align-items:flex-start;justify-content:space-between;gap:16px}
.section-title h2{margin:0;font-size:20px}
.section-title .sub{margin:5px 0 0;color:#8a909a;font-size:13px}
#selectedText{color:#6950c7;font-size:13px;font-weight:700;max-width:50%;text-align:right;line-height:1.55}

.tier-section{margin-top:22px}
.group-heading{display:flex;align-items:center;gap:11px;margin:0 0 12px}
.group-pill{
  display:inline-flex;align-items:center;justify-content:center;
  min-width:66px;height:38px;padding:0 16px;border-radius:999px;
  color:#fff;font-size:14px;font-weight:800;
}
.tier0-pill{background:#704be3;box-shadow:0 5px 12px rgba(112,75,227,.17)}
.tier1-pill{background:#4f7fd8;box-shadow:0 5px 12px rgba(79,127,216,.16)}
.group-title{font-size:17px;font-weight:800;color:#444b56}
.other-heading{margin-top:4px}
.other-count{font-size:12px;color:#969ca6}

.character-grid{
  display:grid;
  grid-template-columns:repeat(auto-fill,94px);
  justify-content:start;
  gap:11px;
}
.character-card{
  position:relative;width:94px;padding:6px 5px 8px;
  background:#fff;border:1px solid #d9e0eb;border-radius:12px;
  cursor:pointer;transition:.14s ease;
}
.character-card:hover{
  transform:translateY(-2px);
  border-color:#b9a9ed;
  box-shadow:0 6px 14px rgba(40,49,68,.08);
}
.character-card.active{
  border:2px solid #7650d9;padding:5px 4px 6px;
  background:#f8f5ff;box-shadow:0 0 0 3px rgba(118,80,217,.08);
}
.selected-check{
  display:none;position:absolute;right:4px;top:4px;width:19px;height:19px;
  border-radius:50%;background:#7650d9;color:#fff;font-size:12px;font-weight:900;
  align-items:center;justify-content:center;
}
.character-card.active .selected-check{display:flex}
.character-portrait{
  position:relative;overflow:hidden;width:82px;height:112px;
  margin:0 auto;border-radius:9px;background:#f2f3f5;
}
.character-portrait img{width:100%;height:100%;object-fit:cover;display:block}
.portrait-fallback{
  position:absolute;inset:0;display:none;align-items:center;justify-content:center;
  padding:6px;text-align:center;color:#777f8b;background:#f0f2f5;
  font-size:10px;font-weight:700;line-height:1.25;
}
.portrait-fallback.show{display:flex}
.character-name{
  display:block;margin-top:5px;text-align:center;font-size:10.5px;font-weight:700;color:#242832;
  white-space:nowrap;overflow:hidden;text-overflow:ellipsis;
}

.other-section{padding-top:16px;border-top:1px solid #f0f1f4;margin-top:26px}

.other-toggle{
  width:100%;
  display:flex;
  align-items:center;
  justify-content:flex-start;
  gap:9px;
  border:0;
  background:transparent;
  padding:2px 0 12px;
  cursor:pointer;
  color:inherit;
  text-align:left;
}
.other-toggle-left{
  display:flex;
  align-items:center;
  gap:9px;
}
.other-toggle-text{
  margin-left:auto;
  color:#7650d9;
  font-size:13px;
  font-weight:800;
}
.other-toggle-arrow{
  color:#7650d9;
  font-size:11px;
  width:16px;
  text-align:center;
}

.other-grid-wrap{
  display:grid;
  grid-template-rows:1fr;
  opacity:1;
  transition:grid-template-rows .2s ease, opacity .16s ease;
}
.other-grid-wrap > .character-grid{
  min-height:0;
  overflow:hidden;
}
.other-grid-wrap.collapsed{
  grid-template-rows:0fr;
  opacity:0;
}

.toolbar{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:14px;
  margin:27px 3px 14px
}
.toolbar strong{font-size:17px}
.condition-text{color:#7c8490;font-size:13px}

.sort-buttons{
  display:flex;
  align-items:center;
  gap:9px;
  flex-wrap:wrap;
  justify-content:flex-end;
}
.sort-pill{
  border:1px solid #d9e0eb;
  background:#fff;
  color:#555d69;
  border-radius:999px;
  min-height:38px;
  padding:0 16px;
  font-size:13px;
  font-weight:800;
  cursor:pointer;
  transition:.14s ease;
}
.sort-pill:hover{
  border-color:#baaaf0;
  color:#6948d3;
  transform:translateY(-1px);
}
.sort-pill.active{
  background:#704be3;
  border-color:#704be3;
  color:#fff;
  box-shadow:0 5px 12px rgba(112,75,227,.16);
}

.account-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:15px}
.account-card{background:#fff;border:1px solid #e1e5eb;border-radius:16px;padding:17px;min-width:0}
.account-head{display:flex;align-items:center;justify-content:space-between;gap:12px;padding-bottom:13px;border-bottom:1px solid #eef0f3}
.account-label{font-size:10px;font-weight:800;letter-spacing:1.1px;color:#a0a6b0}
.account-id{font-size:19px;font-weight:850;margin-top:2px}
.count-badge{padding:6px 9px;border-radius:999px;background:#f1effa;color:#6950c7;font-size:12px;font-weight:800}
.account-characters{display:flex;flex-wrap:wrap;gap:8px;margin-top:14px}
.mini-character{width:60px;min-width:60px}
.mini-portrait{position:relative;width:60px;height:66px;overflow:hidden;border:1px solid #dce1e8;border-radius:9px;background:#f3f4f6}
.mini-portrait img{width:100%;height:100%;display:block;object-fit:contain}
.mini-character>span{display:block;margin-top:4px;text-align:center;font-size:10px;font-weight:700;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}

.empty{
  grid-column:1/-1;display:flex;flex-direction:column;gap:7px;align-items:center;justify-content:center;
  min-height:160px;background:#fff;border:1px dashed #d6dbe3;border-radius:16px;color:#777f8b;text-align:center;padding:35px 20px;
}
.empty strong{color:#444b56}

@media(max-width:800px){
  .wrap{width:min(100% - 30px,1180px)}
  .account-grid{grid-template-columns:1fr}
  .character-grid{grid-template-columns:repeat(auto-fill,86px);gap:9px}
  .character-card{width:86px}
  .character-portrait{width:74px;height:102px}
}
@media(max-width:560px){
  .wrap{width:calc(100% - 20px);margin-top:18px}
  .header h1{font-size:25px}
  .selector-panel{padding:18px 14px 22px}
  .section-title{display:block}
  #selectedText{display:block;max-width:none;text-align:left;margin-top:8px}
  .character-grid{grid-template-columns:repeat(4,minmax(0,1fr));gap:7px}
  .character-card{width:100%;padding:5px 4px 6px}
  .character-card.active{padding:4px 3px 5px}
  .character-portrait{width:100%;height:auto;aspect-ratio:224/316}
  .character-name{font-size:9.5px}
  .condition-text{display:none}
  .toolbar{align-items:flex-end;gap:10px}
  .sort-buttons{gap:6px}
  .sort-pill{min-height:34px;padding:0 11px;font-size:11px}
}

/* ===== 계정 가격 표시 ===== */
.account-head-right{
  display:flex;
  align-items:center;
  gap:10px;
  flex-shrink:0;
}

.account-price{
  font-size:18px;
  font-weight:850;
  white-space:nowrap;
  color:#272b33;
}

@media(max-width:560px){
  .account-head-right{
    gap:7px;
  }

  .account-price{
    font-size:16px;
  }
}
