/* Emoji library, picker and chat-bubble editor. Uses the console's existing tokens. */
.ek-icon{display:inline-flex;align-items:center;justify-content:center;vertical-align:-0.22em;line-height:1;flex:none}
.ek-icon img,.ek-icon video{width:100%;height:100%;object-fit:contain;display:block}
.ek-picker{position:relative;display:inline-flex;gap:6px;align-items:center}
.ek-trigger{display:inline-flex;gap:8px;align-items:center;border:1px solid var(--control);background:var(--surface);min-height:40px;padding:6px 12px}
.ek-trigger:hover{border-color:var(--accent)}
.ek-clear{min-height:40px;color:var(--muted);font-size:13px}
.ek-pop{position:absolute;z-index:40;top:calc(100% + 6px);left:0;width:min(340px,86vw);background:var(--surface);border:1px solid var(--border);border-radius:10px;padding:10px;box-shadow:0 12px 32px #17262824}
.ek-pop>input{margin:0 0 8px;min-height:38px}
.ek-hint{font-size:12px;color:var(--muted);margin:6px 2px 10px;line-height:1.6}
.ek-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(42px,1fr));gap:2px;max-height:240px;overflow:auto}
.ek-grid button{min-height:42px;padding:6px;display:flex;flex-direction:column;align-items:center;justify-content:center;border-radius:8px}
.ek-grid button.on{background:#d4e6ea;outline:2px solid var(--accent);outline-offset:-2px}
.ek-grid.big{grid-template-columns:repeat(auto-fill,minmax(68px,1fr));max-height:none;gap:4px}
.ek-grid.big button{min-height:68px;gap:4px}
.ek-grid.big small{font-size:11px;color:var(--muted);max-width:64px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.ek-manual{margin-top:8px;font-size:12px}.ek-manual summary{color:var(--muted);cursor:pointer}
.ek-manual-row{display:grid;grid-template-columns:1fr 70px auto;gap:6px;margin-top:6px}.ek-manual-row input,.ek-manual-row button{min-height:36px;margin:0;padding:6px 8px}
.ek-error{color:var(--negative);font-size:12px;margin-top:4px}

/* rich text: the editing surface looks like the Telegram bubble it produces */
.rt{display:flex;flex-direction:column;gap:8px}
.rt-tools{display:flex;flex-wrap:wrap;gap:2px;align-items:center;padding:4px;border:1px solid var(--border);border-radius:8px;background:var(--raised)}
.rt-tools>button{min-height:36px;min-width:36px;padding:4px 8px;font-size:14px}
.rt-tools .ek-picker{margin-left:auto}.rt-tools .ek-trigger{min-height:36px;border-color:transparent;background:var(--surface)}
.rt-box{min-height:150px;max-height:420px;overflow:auto;white-space:pre-wrap;overflow-wrap:anywhere;line-height:1.75;background:#fff;border:1px solid var(--control);border-radius:4px 14px 14px 14px;padding:12px 14px;font-size:14px;outline:none}
.rt.compact .rt-box{min-height:90px}
.rt-box:focus{border-color:var(--accent);box-shadow:0 0 0 3px #1b6c8022}
.rt-box:empty::before{content:attr(data-placeholder);color:var(--muted)}
.rt-box code,.rt-box pre{font-family:ui-monospace,Consolas,monospace;background:#eef3f3;border-radius:3px;padding:0 3px;font-size:13px}
.rt-box blockquote{display:block;margin:2px 0;border-left:3px solid var(--accent);padding-left:10px;background:#f3f8f9}
.rt-spoiler{background:#cfd8d9;border-radius:3px}
.rt-link{color:var(--accent);text-decoration:underline}
.rt-var{display:inline-block;background:#e1eef1;color:#0f4f5f;border:1px solid #bcd7dd;border-radius:999px;padding:0 8px;margin:0 1px;font-size:12.5px;line-height:1.6;user-select:all;cursor:default}
.rt-emoji{display:inline-block;width:1.35em;height:1.35em;vertical-align:-0.3em;margin:0 1px}
.rt-emoji img{width:100%;height:100%;object-fit:contain}
.rt-fields{display:flex;flex-wrap:wrap;gap:4px;align-items:center;font-size:12px;color:var(--muted)}
.rt-fields button{min-height:30px;padding:2px 10px;border:1px dashed #9fc2ca;border-radius:999px;color:#0f4f5f;font-size:12px}
.rt-raw{font-size:12px}.rt-raw summary{color:var(--muted);cursor:pointer}.rt-raw textarea{min-height:110px;font-family:ui-monospace,Consolas,monospace;font-size:12px;margin-top:6px}

/* library page */
.ek-library{display:flex;flex-direction:column;gap:20px}
.ek-howto{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1.1fr);gap:28px;padding:20px;border-radius:12px;background:var(--raised);border:1px solid var(--border)}
.ek-howto h2{margin-bottom:8px}.ek-howto p{margin:6px 0;color:var(--text);line-height:1.7}.ek-howto label{display:block;font-weight:500}
.ek-howto textarea{min-height:84px;margin-top:6px}
.ek-actions{display:flex;flex-wrap:wrap;gap:8px;margin-top:10px}
.ek-ok{color:var(--positive)}
.ek-lib-body{display:grid;grid-template-columns:minmax(0,1fr) 260px;gap:24px;align-items:start}
.ek-lib-head{display:flex;gap:16px;align-items:center;justify-content:space-between;margin-bottom:8px}.ek-lib-head input{max-width:260px}
.ek-lib-head small,.ek-set h3 small{color:var(--muted);font-weight:400}
.ek-set{margin-top:18px}.ek-set h3{margin-bottom:6px}
.ek-detail{position:sticky;top:16px;display:flex;flex-direction:column;gap:12px;padding:18px;border:1px solid var(--border);border-radius:12px;background:var(--surface)}
.ek-detail .ek-icon{align-self:center}
.ek-detail dl{display:grid;grid-template-columns:auto 1fr;gap:6px 10px;margin:0;font-size:13px}.ek-detail dt{color:var(--muted)}.ek-detail dd{margin:0;display:flex;gap:6px;align-items:center;overflow-wrap:anywhere}
.ek-detail dd button{min-height:30px;padding:2px 8px;font-size:12px}
.ek-detail.empty{color:var(--muted)}
.ek-remove{color:var(--negative)}
@media(max-width:900px){.ek-howto,.ek-lib-body{grid-template-columns:1fr}.ek-detail{position:static}}

/* Telegram-style picker: pack tabs + sections */
.ek-pop.ek-tg{width:min(400px,92vw);padding:10px 10px 8px}
.ek-tabs{display:flex;gap:2px;overflow-x:auto;scrollbar-width:thin;margin:0 -2px 6px;padding:2px;border-bottom:1px solid var(--border)}
.ek-tabs button{flex:0 0 auto;width:38px;height:38px;min-height:38px;padding:0;display:flex;align-items:center;justify-content:center;border:0;border-radius:8px;background:transparent;opacity:.7}
.ek-tabs button:hover{opacity:1;background:var(--surface-2,#eef3f4)}
.ek-tabs button.on{opacity:1;background:#d4e6ea;box-shadow:inset 0 -2px 0 var(--accent)}
.ek-tab-glyph{font-size:20px;line-height:1}
.ek-scroll{max-height:300px;overflow-y:auto;overscroll-behavior:contain;position:relative}
.ek-pack h4{position:sticky;top:0;z-index:1;margin:0;padding:6px 4px 4px;font-size:12px;font-weight:600;color:var(--muted);background:var(--surface)}
.ek-pack h4 small{font-weight:400;margin-left:4px}
.ek-scroll .ek-grid{grid-template-columns:repeat(8,1fr);max-height:none;overflow:visible}
.ek-scroll .ek-grid button{min-height:40px;padding:4px}
@media (max-width:420px){.ek-scroll .ek-grid{grid-template-columns:repeat(6,1fr)}}
:root[data-theme=dark] .ek-tabs button.on,:root[data-theme=dark] .ek-grid button.on{background:#24434a}
.ek-pop.ek-tg.right{left:auto;right:0}.ek-pop.ek-tg.up{top:auto;bottom:calc(100% + 6px)}
.ek-pack h4 small{display:inline;font-size:11px}

/* pinned emoji and order (2026-11-09) */
.ek-grid button.pinned{box-shadow:inset 0 -2px 0 var(--accent,#2f6fed)}
.ek-pinned .ek-grid button{cursor:grab}
.ek-pinned .ek-grid button.dragging{opacity:.4}
.ek-set h3{display:flex;align-items:center;gap:8px}
.ek-set-move{margin-left:auto;display:inline-flex;gap:4px}
.ek-set-move button{min-width:28px;min-height:28px;border:1px solid var(--border,#d0d5dd);border-radius:6px;background:var(--surface,#fff);color:inherit;cursor:pointer}
.ek-set-move button:disabled{opacity:.35;cursor:default}
.ek-pin-row{display:flex;flex-wrap:wrap;gap:6px;margin:4px 0 8px}
.ek-pin-hint{margin:6px 10px 0;font-size:12px;color:var(--muted,#667085)}

/* Emoji that Telegram paints in the text colour: the file itself is white, so draw it in the page's text colour. */
.ek-repaint img,.ek-repaint video{filter:brightness(0) saturate(100%);opacity:.86}
[data-theme="dark"] .ek-repaint img,[data-theme="dark"] .ek-repaint video{filter:brightness(0) invert(1);opacity:.92}
.ve-emoji.has-img.ve-repaint{filter:brightness(0) saturate(100%);opacity:.86}
[data-theme="dark"] .ve-emoji.has-img.ve-repaint{filter:brightness(0) invert(1);opacity:.92}
