/* Shared emote picker + inline thumbnails, used by the Encounter Editor and the
   cutscene editor. Uses the semantic --sg-* tokens so it tracks both themes and
   looks consistent across the two dev tools. */

.emote-thumb {
    display: inline-block;
    object-fit: contain;
    image-rendering: pixelated;
    vertical-align: middle;
}

.emote-thumb-fallback {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.05rem 0.3rem;
    border-radius: var(--sg-radius-sm, 4px);
    background: var(--sg-neutral-soft, rgba(148, 163, 184, 0.18));
    color: var(--sg-ink, #e2e8f0);
    font-family: var(--sg-font-mono, monospace);
    font-size: 0.68rem;
    font-weight: 700;
    line-height: 1.2;
    white-space: nowrap;
}

/* --- Picker widget --------------------------------------------------------- */

.emote-picker {
    position: relative;
    display: inline-block;
    width: 100%;
}

.emote-picker-trigger {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    min-height: 2.1rem;
    padding: 0.25rem 0.5rem;
    border: 1px solid var(--sg-edge, #334155);
    border-radius: var(--sg-radius-md, 6px);
    background: var(--sg-surface, #0f172a);
    color: var(--sg-ink, #e2e8f0);
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.emote-picker-trigger:hover {
    border-color: var(--sg-accent, #38bdf8);
}

.emote-picker-preview {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}

.emote-picker-none {
    color: var(--sg-ink-faint, #64748b);
}

.emote-picker-caption {
    font-size: 0.82rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* --- Popover --------------------------------------------------------------- */

.emote-picker-pop {
    position: absolute;
    z-index: 50;
    top: calc(100% + 4px);
    left: 0;
    width: min(340px, 86vw);
    max-height: 340px;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.6rem;
    border: 1px solid var(--sg-edge, #334155);
    border-radius: var(--sg-radius-lg, 10px);
    background: var(--sg-surface-raised, #111c30);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45);
}

.emote-picker-searchrow {
    display: flex;
}

.emote-picker-search {
    width: 100%;
}

.emote-picker-note {
    margin: 0;
    font-size: 0.72rem;
    color: var(--sg-ink-faint, #64748b);
}

.emote-picker-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(58px, 1fr));
    gap: 0.35rem;
    overflow-y: auto;
    padding-right: 0.15rem;
}

.emote-picker-cell {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.15rem;
    padding: 0.35rem 0.2rem;
    border: 1px solid transparent;
    border-radius: var(--sg-radius-md, 6px);
    background: transparent;
    color: var(--sg-ink-muted, #94a3b8);
    cursor: pointer;
    font: inherit;
    min-height: 54px;
    justify-content: center;
}

.emote-picker-cell:hover {
    background: var(--sg-surface-hover, rgba(148, 163, 184, 0.12));
}

.emote-picker-cell.is-selected {
    border-color: var(--sg-accent, #38bdf8);
    background: var(--sg-accent-soft, rgba(56, 189, 248, 0.15));
    color: var(--sg-ink-strong, #f1f5f9);
}

.emote-picker-cell.is-none {
    min-height: 54px;
}

.emote-picker-cell-label {
    font-family: var(--sg-font-mono, monospace);
    font-size: 0.58rem;
    line-height: 1.1;
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    white-space: nowrap;
}
