/* ============================================================
   댓글 이모티콘 선택창 (2026-11-02, emo_picker.js)
   옛 venobox iframe(화면 맨 위 회색 제목줄 + 800×500 흰 액자)을 대신한다
   PC = 이모티콘 버튼 아래 붙는 작은 창 / 휴대폰(640px 이하) = 아래에서 올라오는 시트
   body 에 붙으므로 .comment-area 의 --cv-* 변수는 못 쓴다 — 여기서 따로 정의
   ============================================================ */

.emo-pk {
    --ep-bg: #fff;
    --ep-line: #e6e8eb;
    --ep-text: #222;
    --ep-sub: #5f6875;
    --ep-hover: #f3f4f6;
    --ep-accent: #2DAAB8;
    --ep-tab-on-bg: #e8f6f8;
    --ep-tile: transparent;
    position: fixed;
    z-index: 10050;
    display: flex;
    flex-direction: column;
    width: 380px;
    max-width: calc(100vw - 16px);
    background: var(--ep-bg);
    color: var(--ep-text);
    border: 1px solid var(--ep-line);
    border-radius: 14px;
    box-shadow: 0 12px 32px rgba(15, 23, 42, .16), 0 2px 6px rgba(15, 23, 42, .08);
    overflow: hidden;
    font-size: 14px;
    line-height: 1.4;
    opacity: 0;
    transform: translateY(-4px);
    transition: opacity .14s ease, transform .14s ease;
}
.emo-pk.is-open { opacity: 1; transform: none; }
.emo-pk.is-up { transform: translateY(4px); }
.emo-pk.is-up.is-open { transform: none; }

.dark-mode .emo-pk {
    --ep-bg: #161b22;
    --ep-line: #30363d;
    --ep-text: #d4dae4;
    --ep-sub: #9aa6b5;
    --ep-hover: #1f2630;
    --ep-tab-on-bg: rgba(45, 170, 184, .18);
    /* 토끼 이모티콘 대부분이 흰 바탕 GIF 라 어두운 바탕에서 흰 네모로 보인다 → 칸을 밝게 깐다 */
    --ep-tile: #eef1f4;
    box-shadow: 0 12px 32px rgba(0, 0, 0, .5);
}

.emo-pk-head {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 10px 8px 12px;
    border-bottom: 1px solid var(--ep-line);
}
.emo-pk-grip { display: none; }
.emo-pk-tabs {
    display: flex;
    gap: 6px;
    flex: 1 1 auto;
    min-width: 0;
    overflow-x: auto;
    scrollbar-width: none;
}
.emo-pk-tabs::-webkit-scrollbar { display: none; }
.emo-pk .emo-pk-tab {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    flex: 0 0 auto;
    height: 32px;
    padding: 0 12px 0 6px;
    border: 1px solid var(--ep-line);
    border-radius: 999px;
    background: transparent;
    color: var(--ep-sub);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
}
.emo-pk .emo-pk-tab img { width: 22px; height: 22px; object-fit: contain; border-radius: 50%; background: var(--ep-tile); }
.emo-pk .emo-pk-tab.is-recent { padding-left: 10px; }
.emo-pk .emo-pk-tab:hover { background: var(--ep-hover); }
.emo-pk .emo-pk-tab[aria-selected="true"] {
    border-color: var(--ep-accent);
    background: var(--ep-tab-on-bg);
    color: var(--ep-accent);
    font-weight: 700;
}
.emo-pk .emo-pk-close {
    flex: 0 0 auto;
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--ep-sub);
    font-size: 22px;
    line-height: 32px;
    padding: 0;
    cursor: pointer;
}
.emo-pk .emo-pk-close:hover { background: var(--ep-hover); color: var(--ep-text); }

.emo-pk-body {
    height: 276px;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    padding: 8px;
}
.emo-pk-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(56px, 1fr));
    gap: 4px;
}
.emo-pk .emo-pk-item {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 60px;
    padding: 0;
    border: 0;
    border-radius: 10px;
    background: var(--ep-tile);
    cursor: pointer;
    transition: background .1s ease, transform .1s ease;
}
.emo-pk .emo-pk-item img { width: 48px; height: 48px; object-fit: contain; pointer-events: none; }
.emo-pk .emo-pk-item:hover,
.emo-pk .emo-pk-item:focus-visible { background: var(--ep-hover); outline: none; box-shadow: inset 0 0 0 2px var(--ep-accent); }
.emo-pk .emo-pk-item:active { transform: scale(.92); }
.emo-pk-msg { padding: 40px 0; text-align: center; color: var(--ep-sub); font-size: 13px; }

.emo-pk-dim { display: none; }

/* 휴대폰: 아래 시트 */
@media (max-width: 640px) {
    .emo-pk-dim {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 10049;
        background: rgba(0, 0, 0, .32);
        touch-action: none; /* 막을 끌어도 뒤 페이지가 스크롤되지 않게 */
        opacity: 0;
        transition: opacity .18s ease;
    }
    .emo-pk-dim.is-open { opacity: 1; }
    .emo-pk {
        left: 0 !important;
        right: 0;
        bottom: 0;
        top: auto !important;
        width: auto;
        max-width: none;
        border-radius: 18px 18px 0 0;
        border-width: 1px 0 0;
        transform: translateY(100%);
        transition: transform .22s cubic-bezier(.2, .8, .2, 1);
        opacity: 1;
        padding-bottom: env(safe-area-inset-bottom);
    }
    .emo-pk.is-up { transform: translateY(100%); }
    .emo-pk.is-open, .emo-pk.is-up.is-open { transform: none; }
    .emo-pk-head { position: relative; padding: 18px 8px 8px 12px; }
    .emo-pk-grip {
        display: block;
        position: absolute;
        top: 7px;
        left: 50%;
        width: 36px;
        height: 4px;
        margin-left: -18px;
        border-radius: 2px;
        background: var(--ep-line);
    }
    .emo-pk-body { height: min(46vh, 340px); }
    .emo-pk-grid { grid-template-columns: repeat(auto-fill, minmax(60px, 1fr)); }
    .emo-pk .emo-pk-item { height: 64px; }
    .emo-pk .emo-pk-item img { width: 52px; height: 52px; }
}
