/* The website's emoji (assets/js/sb_emoji.js): emoji drawn as Noto pictures
   in text, the picker, and the : list. Colours from sb_theme.css, so dark
   mode follows. */

/* An emoji in text: as tall as the letters around it. !important because
   pages style every img in a row (avatars: 48px, round, shadowed), and an
   emoji in the same row must not take that on. A bigger emoji is set the
   same way (e.g. message/css/chat.css, .is-jumbo). */
img.sb-emoji {
    display: inline-block !important;
    width: 1.25em !important;
    height: 1.25em !important;
    min-width: 0 !important;
    max-width: none !important;
    margin: 0 .05em;
    padding: 0 !important;
    vertical-align: -.25em;
    object-fit: contain !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    background: none !important;
    position: static !important;
    float: none !important;
}
img.sb-emoji-custom { width: 1.4em !important; height: 1.4em !important; vertical-align: -.32em; }

/* ---- the picker ---- */
.sbe-picker {
    position: absolute;
    z-index: 11000;
    width: 352px;
    height: 420px;
    display: flex;
    flex-direction: column;
    background: var(--sb-surface, #fff);
    color: var(--sb-text, #050505);
    border: 1px solid var(--sb-border, #e4e6eb);
    border-radius: 14px;
    box-shadow: 0 12px 28px rgba(0, 0, 0, .18), 0 2px 4px rgba(0, 0, 0, .08);
    overflow: hidden;
    font-size: 14px;
}
.sbe-picker[hidden] { display: none; }
.sbe-top { display: flex; align-items: center; gap: 8px; padding: 10px 10px 6px; }
.sbe-search {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 6px;
    height: 36px;
    margin: 0;
    padding: 0 12px;
    border-radius: 999px;
    background: var(--sb-surface-2, #f0f2f5);
    color: var(--sb-text-muted, #65676b);
    font-weight: 400;
    cursor: text;
}
.sbe-search input {
    flex: 1;
    min-width: 0;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--sb-text, #050505);
    font-size: 14px;
    -webkit-appearance: none;
    appearance: none;
}
/* The site's focus ring would draw a second box inside the pill. */
.sbe-search input, .sbe-search input:focus, .sbe-search input:focus-visible { outline: none !important; box-shadow: none !important; border: 0 !important; background: transparent !important; color: var(--sb-text, #050505) !important; padding: 0 !important; height: auto !important; }
.sbe-search:focus-within { box-shadow: 0 0 0 2px rgba(8, 102, 255, .35); }
.sbe-tone, .sbe-tone-opt, .sbe-tab, .sbe-fav, .sbe-var-fav {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    background: transparent;
    color: var(--sb-text-muted, #65676b);
    cursor: pointer;
    padding: 0;
}
.sbe-tone { width: 36px; height: 36px; border-radius: 50%; }
.sbe-tone:hover, .sbe-tone[aria-expanded="true"] { background: var(--sb-hover, #f2f3f5); }
.sbe-tone img { width: 24px; height: 24px; }
.sbe-tones { display: flex; justify-content: flex-end; gap: 2px; padding: 0 10px 6px; }
.sbe-tones[hidden] { display: none; }
.sbe-tone-opt { width: 34px; height: 34px; border-radius: 8px; }
.sbe-tone-opt img { width: 24px; height: 24px; }
.sbe-tone-opt:hover { background: var(--sb-hover, #f2f3f5); }
.sbe-tone-opt[aria-checked="true"] { background: rgba(8, 102, 255, .12); box-shadow: inset 0 0 0 2px #0866ff; }
.sbe-tabs {
    display: flex;
    gap: 2px;
    padding: 0 6px;
    border-bottom: 1px solid var(--sb-border, #e4e6eb);
    overflow-x: auto;
    scrollbar-width: none;
}
.sbe-tabs::-webkit-scrollbar { display: none; }
.sbe-tab { flex: 1 0 28px; max-width: 40px; height: 34px; border-bottom: 2px solid transparent; border-radius: 0; font-size: 16px; }
.sbe-tab img { width: 20px; height: 20px; filter: grayscale(.6); opacity: .8; }
.sbe-tab:hover img, .sbe-tab.is-on img { filter: none; opacity: 1; }
.sbe-tab.is-on { border-bottom-color: #0866ff; color: #0866ff; }
.sbe-body { flex: 1; overflow-y: auto; padding: 0 6px 6px; position: relative; overscroll-behavior: contain; }
.sbe-sec h6 {
    position: sticky;
    top: 0;
    z-index: 1;
    margin: 0;
    padding: 8px 4px 4px;
    background: var(--sb-surface, #fff);
    color: var(--sb-text-muted, #65676b);
    font-size: 12px;
    font-weight: 600;
    text-transform: none;
}
.sbe-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(38px, 1fr)); }
.sbe-e {
    width: 100%;
    aspect-ratio: 1;
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 8px;
    background: transparent;
    cursor: pointer;
    padding: 0;
}
.sbe-e img { width: 28px; height: 28px; pointer-events: none; transition: transform .08s ease; }
.sbe-e:hover, .sbe-e:focus-visible { background: var(--sb-hover, #f2f3f5); outline: none; }
.sbe-e:hover img { transform: scale(1.12); }
.sbe-none { margin: 40px 0; text-align: center; color: var(--sb-text-muted, #65676b); }
.sbe-foot {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    padding: 6px 12px;
    border-top: 1px solid var(--sb-border, #e4e6eb);
}
.sbe-prev img { width: 28px; height: 28px; display: block; }
.sbe-prev-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.sbe-prev-name small { font-weight: 400; color: var(--sb-text-muted, #65676b); }
.sbe-fav { width: 32px; height: 32px; border-radius: 50%; font-size: 17px; }
.sbe-fav[hidden] { display: none; }
.sbe-fav:hover { background: var(--sb-hover, #f2f3f5); }
.sbe-fav.is-on, .sbe-var-fav .is-on { color: #f5a623; }
.sbe-fav.is-on i:before, .sbe-var-fav .is-on:before { text-shadow: 0 0 0 #f5a623; }
/* The other tones of one emoji (long press / right-click). */
.sbe-var {
    position: absolute;
    z-index: 5;
    display: flex;
    gap: 2px;
    padding: 4px;
    background: var(--sb-surface, #fff);
    border: 1px solid var(--sb-border, #e4e6eb);
    border-radius: 12px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, .18);
}
.sbe-var .sbe-e { width: 38px; height: 38px; min-height: 0; }
.sbe-var-fav { width: 38px; height: 38px; border-radius: 8px; font-size: 17px; }
.sbe-var-fav:hover { background: var(--sb-hover, #f2f3f5); }

/* Phones: a sheet from the bottom. */
.sbe-backdrop { position: fixed; inset: 0; z-index: 10999; background: rgba(0, 0, 0, .35); }
.sbe-picker.is-sheet {
    position: fixed;
    left: 0 !important;
    right: 0;
    bottom: 0;
    top: auto !important;
    width: auto;
    height: min(60vh, 460px);
    border-radius: 16px 16px 0 0;
    border-bottom: 0;
    padding-bottom: env(safe-area-inset-bottom, 0);
}
.sbe-picker.is-sheet .sbe-grid { grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); }
.sbe-picker.is-sheet .sbe-e img { width: 30px; height: 30px; }

/* ---- the : list ---- */
.sbe-ac {
    position: absolute;
    z-index: 11001;
    min-width: 220px;
    max-width: 320px;
    padding: 4px;
    background: var(--sb-surface, #fff);
    color: var(--sb-text, #050505);
    border: 1px solid var(--sb-border, #e4e6eb);
    border-radius: 10px;
    box-shadow: 0 8px 22px rgba(0, 0, 0, .16);
    font-size: 14px;
}
.sbe-ac[hidden] { display: none; }
.sbe-ac-opt { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 8px; cursor: pointer; white-space: nowrap; }
.sbe-ac-opt img { width: 22px; height: 22px; flex: 0 0 auto; }
.sbe-ac-opt span { font-weight: 600; }
.sbe-ac-opt small { overflow: hidden; text-overflow: ellipsis; color: var(--sb-text-muted, #65676b); }
.sbe-ac-opt.is-on, .sbe-ac-opt:hover { background: var(--sb-hover, #f2f3f5); }

/* A quick row (data-sb-emoji-set): emoji buttons, then the smiley. Specific
   enough to beat a form's own "button" rules around it. */
.sbe-quick { display: inline-flex; align-items: center; gap: 0; margin-right: auto; flex-wrap: wrap; }
.sbe-quick > button[data-i], .sbe-quick > button.sbe-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    box-shadow: none;
    color: var(--sb-text-muted, #65676b);
    font-size: 20px;
    font-weight: 400;
    line-height: 1;
    cursor: pointer;
    transition: transform .12s ease, background .12s ease;
}
.sbe-quick > button[data-i]:hover { background: var(--sb-hover, #f2f3f5); transform: translateY(-2px) scale(1.12); }
.sbe-quick > button.sbe-btn:hover { background: var(--sb-hover, #f2f3f5); color: #0866ff; }

/* A smiley button next to a text box (data-sb-emoji). */
.sbe-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--sb-text-muted, #65676b);
    cursor: pointer;
    font-size: 20px;
    padding: 0;
}
.sbe-btn:hover, .sbe-btn[aria-expanded="true"] { background: var(--sb-hover, #f2f3f5); color: #0866ff; }
