.ra0-er {
    --er-accent: var(--accent-color, #d3db96);
    --er-fg: var(--content-font-color, #4e5058);       /* 글자·아이콘 */
    --er-bg: var(--card-bg-color, #fff);               /* 선택창·탭 배경 */
    --er-line: var(--card-border-color, #bdbdbd);      /* 버튼 테두리 */
    --er-hover: color-mix(in srgb, var(--er-fg) 12%, var(--er-bg));
    position: relative;
    display: block;
    box-sizing: border-box;
    float: none;
    clear: both;
    width: 100%;
    flex: 0 0 100%;          /* 부모가 flex 일 때 */
    grid-column: 1 / -1;     /* 부모가 grid 일 때 */
}
.ra0-er-list {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
    margin: 0;
    padding: 0;
    list-style: none;
}
.ra0-er-list > li {
    display: flex;
    align-items: center;
    margin: 0;
    padding: 0;
}

.ra0-er-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    height: 30px;
    min-height: 30px;
    line-height: 30px;
    margin: 0;
    padding: 0 6px;
    border: 1px solid var(--er-line);
    border-radius: 5px;
    background: color-mix(in srgb, var(--er-fg) 8%, transparent);
    color: color-mix(in srgb, var(--er-fg) 60%, transparent);
    font-family: inherit;
    font-size: 11px;
    font-weight: bold;
    vertical-align: middle;
    cursor: pointer;
    transition: none;
}
.ra0-er-chip:hover, .ra0-er-chip.on {
    border: 1px solid var(--er-accent);
    color: var(--er-accent);
    background: color-mix(in srgb, var(--er-accent) 20%, transparent);
}
.ra0-er-chip img.ra0-er-img {
    display: block;
    width: auto;
    height: 16px !important;
    max-width: 32px;
    margin: 0;
    pointer-events: none;
    object-fit: contain;
}
.ra0-er-cnt {
    display: inline-block;
    padding-left: 4px;
    padding-right: 0;
    line-height: 1;
}

.ra0-er-add {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    height: 30px;
    min-height: 30px;
    margin: 0;
    padding: 0 6px;
    border: none;
    background: transparent;
    color: #4e5058;
    cursor: pointer;
}
.ra0-er-add .material-icons { font-size: 20px; }

/* 선택창 */
.ra0-er-pop {
    position: absolute;
    z-index: 99;
    left: 0;
    top: 100%;
    width: 250px;
    margin-top: 4px;
    padding: 6px 0 8px;
    border-radius: 8px;
    background: var(--er-bg);
    color: var(--er-fg);
    font-size: 12px;
    box-shadow: 0 0 2px rgba(0,0,0,.4), 0 1px 15px rgba(0,0,0,.4);
}
.ra0-er-pop.up { top: auto; bottom: 100%; margin: 0 0 4px; }
.ra0-er-tabs {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
}
.ra0-er-tabs::-webkit-scrollbar { display: none; }
.ra0-er-tab {
    flex: 1 0 auto;
    white-space: nowrap;
    display: inline-block;
    margin: 0;
    padding: 0 8px;
    border: none;
    border-radius: 5px;
    position: relative;
    background: var(--er-bg);
    color: var(--er-fg);
    font-family: inherit;
    font-size: 12px !important;
    font-weight: normal !important;
    line-height: 24px !important;
    cursor: pointer;
}
.ra0-er-tab:hover { background: var(--er-hover); }
/* 선택 밑줄은 모서리와 상관없이 곧은 선으로 그린다 */
.ra0-er-tab.on::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: currentColor; }
.ra0-er-grid {
    height: fit-content;
    max-height: 200px;
    overflow-y: auto;
    padding: 8px;
    margin: 0;
    list-style: none;
}
.ra0-er-pick {
    display: inline-block;
    margin: 2px;
    padding: 2px;
    border: none;
    border-radius: 5px;
    background: transparent;
    line-height: 0;
    cursor: pointer;
}
.ra0-er-pick:hover { background: var(--er-hover); }
.ra0-er-pick.on { background: color-mix(in srgb, var(--er-accent) 30%, transparent); }
.ra0-er-pick img.ra0-er-img { display: block; width: auto; height: 24px !important; max-width: 48px; margin: 0; object-fit: contain; }
.ra0-er-empty { padding: 20px 0; text-align: center; opacity: .6; }

/* 말풍선 */
.ra0-er-tip {
    position: absolute;
    z-index: 100;
    transform: translate(-50%, -100%);
    padding: 4px 8px;
    border-radius: 4px;
    background: #111;
    color: #eee;
    font-size: 12px;
    white-space: nowrap;
    pointer-events: none;
}
.ra0-er-tip::before {
    content: '';
    position: absolute;
    left: calc(50% - 6px);
    bottom: -11px;
    border: 6px solid transparent;
    border-top-color: #111;
}

/* 트위모지에 아직 없는 새 이모지는 글자로 보여주되, 이미지와 같은 높이로 맞춘다 */
.ra0-er-txt { display: block; font-style: normal; font-weight: normal; pointer-events: none; }
.ra0-er-chip .ra0-er-txt { font-size: 14px; line-height: 16px; height: 16px; }
.ra0-er-pick .ra0-er-txt { font-size: 20px; line-height: 24px; height: 24px; }

/* 탭 줄 + 넘칠 때 나오는 오른쪽 화살표 */
.ra0-er-tabbar { display: flex; align-items: stretch; }
.ra0-er-tabbar .ra0-er-tabs { flex: 1; min-width: 0; }
.ra0-er-tabnext {
    flex: none;
    display: inline-flex;
    align-items: center;
    margin: 0;
    padding: 0 2px;
    border: none;
    border-radius: 5px;
    background: var(--er-bg);
    color: var(--er-fg);
    cursor: pointer;
}
.ra0-er-tabnext[hidden] { display: none; }
.ra0-er-tabnext:hover { background: var(--er-hover); }
.ra0-er-tabnext .material-icons { font-size: 18px; }
.ra0-er-fixedtabs { flex: none; display: flex; }
.ra0-er-tabnext:disabled { opacity: .3; cursor: default; background: var(--er-bg); }
