/* Zibll Mini Emoji Panel - Bilibili style */

.dropup.smilie > .dropdown-menu {
    z-index: 9999 !important;
    min-width: 0 !important;
    padding: 0 !important;
    margin-bottom: 10px !important;
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
}

.dropup.smilie > .dropdown-menu::before {
    display: none !important;
}

.dropup.smilie .dropdown-smilie {
    display: none !important;
}

.zme-panel,
.zme-panel *,
.zme-panel *::before,
.zme-panel *::after {
    box-sizing: border-box;
}

.zme-panel {
    position: fixed;
    left: 0;
    top: 0;
    z-index: 100000;
    display: none;
    width: 360px;
    max-width: calc(100vw - 24px);
    height: 260px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: #fff;
    border: 1px solid #e3e5e7;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, .08);
    color: #18191c;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
    font-size: 12px;
    text-align: left;
}

.zme-head {
    flex: 0 0 auto;
    padding: 8px 13px 3px;
}

.zme-title {
    margin: 0;
    font-size: 12px;
    font-weight: 400;
    line-height: 1.5;
    color: #61666d;
}

.zme-grid-wrap {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding: 4px 9px 6px;
    scrollbar-width: thin;
    scrollbar-color: #e3e5e7 transparent;
}

.zme-grid-wrap::-webkit-scrollbar {
    width: 6px;
}

.zme-grid-wrap::-webkit-scrollbar-thumb {
    background: #e3e5e7;
    border-radius: 6px;
}

.zme-grid-wrap::-webkit-scrollbar-thumb:hover {
    background: #00aeec;
}

.zme-grid-wrap::-webkit-scrollbar-track {
    background: transparent;
}

.zme-grid {
    display: grid;
    grid-template-columns: repeat(10, 1fr);
    gap: 2px 0;
    justify-items: center;
}

/* 大图表情：一行 5 个 */
.zme-grid.is-large {
    grid-template-columns: repeat(5, 1fr);
    gap: 4px 0;
}

/* 颜文字：一行 3 个 */
.zme-grid.is-text {
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
    justify-items: stretch;
}

.zme-item {
    width: 30px;
    height: 30px;
    padding: 2px;
    border: 0;
    border-radius: 4px;
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .15s ease;
}

.zme-item:hover {
    background: #f1f2f3;
}

.zme-item img {
    width: 26px;
    height: 26px;
    object-fit: contain;
    display: block;
}

.is-large .zme-item {
    width: 60px;
    height: 60px;
    padding: 3px;
}

.is-large .zme-item img {
    width: 54px;
    height: 54px;
}

.is-text .zme-item {
    width: auto;
    height: 34px;
    padding: 2px 4px;
    font-size: 12px;
    line-height: 1;
    color: #61666d;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.zme-tabs {
    flex: 0 0 36px;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 0 8px 0 0;
    border-top: 0;
    background: #f1f2f3;
}

.zme-tab-strip {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 0;
    padding: 0;
    overflow-x: auto;
    scroll-behavior: smooth;
    scrollbar-width: none;
}

.zme-tab-strip::-webkit-scrollbar {
    display: none;
}

.zme-tab {
    flex: 0 0 auto;
    width: 54px;
    height: 36px;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .15s ease;
}

.zme-tab:hover {
    background: rgba(255, 255, 255, .6);
}

.zme-tab.is-active {
    background: #fff;
}

.zme-tab img {
    width: 26px;
    height: 26px;
    object-fit: contain;
}

.zme-tab-text-icon {
    width: 26px;
    height: 26px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    color: #61666d;
}

.zme-tab-nav {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 0;
}

.zme-arrow {
    flex: 0 0 24px;
    width: 24px;
    height: 32px;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: #61666d;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    transition: background .15s ease;
}

.zme-arrow:hover {
    background: rgba(255, 255, 255, .6);
    color: #00aeec;
}

/* 评论中的表情：底边与文字底边对齐，常规略小、大表情约 2 倍文字 */
.zme-emote {
    display: inline-block;
    width: 1.5em !important;
    height: 1.5em !important;
    vertical-align: text-bottom;
    margin: 0 1px;
}

.zme-emote-lg {
    width: 2em !important;
    height: 2em !important;
}

@media (max-width: 400px) {
    .zme-panel {
        width: calc(100vw - 24px);
        height: min(260px, calc(100vh - 120px));
    }

    .zme-grid {
        grid-template-columns: repeat(8, 1fr);
    }

    .zme-grid.is-large {
        grid-template-columns: repeat(4, 1fr);
    }

    .zme-grid.is-text {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 300px) {
    .zme-grid {
        grid-template-columns: repeat(6, 1fr);
        gap: 2px 0;
    }

    .zme-grid.is-large {
        grid-template-columns: repeat(3, 1fr);
    }
}
