/* Hols — layout, chat list, chat view, messages, composer */
#app { height: 100%; display: flex; flex-direction: column; padding: 12px; gap: 12px; }

/* ---------- top bar ---------- */
.topbar { height: 62px; border-radius: 22px; display: flex; align-items: center; justify-content: space-between; padding: 0 12px 0 14px; flex: none; z-index: 5; }
.tb-left, .tb-right { display: flex; align-items: center; gap: 10px; min-width: 0; }
.tb-me { display: flex; align-items: center; gap: 10px; padding: 4px 10px 4px 4px; border-radius: 999px; transition: background .2s; min-width: 0; }
.tb-me:hover { background: var(--hover); }
.tb-me .tb-name { font-weight: 700; font-size: .95rem; line-height: 1.1; text-align: left; }
.tb-me .tb-user { color: var(--text-2); font-size: .8rem; text-align: left; }
.tb-balance { white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel-2); font-weight: 600; font-size: .88rem; transition: background .2s; }
.tb-balance:hover { background: var(--hover); }
.icon-btn .nbadge { position: absolute; top: 4px; right: 4px; min-width: 16px; height: 16px; border-radius: 8px; background: var(--danger); color: #fff; font-size: .62rem; font-weight: 700; display: grid; place-items: center; padding: 0 4px; }
.icon-btn { position: relative; }

/* ---------- main grid ---------- */
.main { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(300px, 380px) 1fr; gap: 12px; }
.sidebar, .chatview { border-radius: 24px; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }

/* ---------- sidebar ---------- */
.sb-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 16px 10px 22px; }
.sb-head h1 { font-size: 1.45rem; margin: 0; font-weight: 800; letter-spacing: -.01em; }
.sb-search { padding: 0 14px 8px; position: relative; }
.sb-search .input { height: 40px; border-radius: 999px; padding-left: 40px; background: var(--panel-2); }
.sb-search .i-search { position: absolute; left: 28px; top: 10px; color: var(--text-3); pointer-events: none; }
.sb-search .clear { position: absolute; right: 20px; top: 4px; }
.folder-tabs { display: flex; gap: 6px; padding: 2px 14px 8px; overflow-x: auto; scrollbar-width: none; flex: none; }
.folder-tabs::-webkit-scrollbar { display: none; }
.ftab { height: 30px; padding: 0 12px; border-radius: 999px; font-size: .84rem; font-weight: 600; color: var(--text-2); white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; transition: background .2s, color .2s; }
.ftab:hover { background: var(--hover); color: var(--text); }
.ftab.active { background: var(--accent-soft); color: var(--accent); }
.ftab .badge-count { height: 18px; min-width: 18px; font-size: .66rem; }

.sb-scroll { flex: 1; overflow-y: auto; overflow-x: hidden; padding-bottom: 12px; }
.stories-bar { display: flex; gap: 14px; padding: 6px 16px 12px; overflow-x: auto; scrollbar-width: none; border-bottom: 1px solid var(--line); }
.stories-bar::-webkit-scrollbar { display: none; }
.story-chip { display: flex; flex-direction: column; align-items: center; gap: 6px; width: 64px; flex: none; transition: transform .2s var(--ease); }
.story-chip:hover { transform: translateY(-2px); }
.story-ring { padding: 2.5px; border-radius: 50%; background: conic-gradient(from 200deg, #2f80ff, #8b5cf6, #ec4899, #f59e0b, #2f80ff); position: relative; }
.story-ring.seen { background: var(--line-2); }
.story-ring.none { background: transparent; }
.story-ring .ava { border: 2.5px solid var(--panel-solid); }
.story-ring .plus { position: absolute; right: -1px; bottom: -1px; width: 20px; height: 20px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; border: 2px solid var(--panel-solid); }
.story-name { font-size: .72rem; font-weight: 600; max-width: 64px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.cl-label { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); padding: 12px 22px 6px; display: flex; align-items: center; gap: 6px; }
.cl-item { display: flex; align-items: center; gap: 12px; padding: 9px 14px 9px 16px; margin: 1px 8px; border-radius: 16px; cursor: pointer; position: relative; transition: background .18s; animation: listIn .35s var(--ease) both; }
@keyframes listIn { from { opacity: 0; transform: translateY(6px); } }
.cl-item:hover { background: var(--hover); }
.cl-item.active { background: var(--accent-soft); }
.cl-item.active .cl-preview { color: var(--text); opacity: .8; }
.cl-item .ava { --s: 50px; }
.cl-body { flex: 1; min-width: 0; }
.cl-top, .cl-bottom { display: flex; align-items: center; gap: 6px; min-width: 0; }
.cl-title { font-weight: 600; font-size: .98rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.cl-time { margin-left: auto; font-size: .75rem; color: var(--text-3); flex: none; padding-left: 6px; }
.cl-preview { color: var(--text-2); font-size: .88rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; min-width: 0; }
.cl-preview b { color: var(--text); font-weight: 500; }
.cl-preview .typing { color: var(--accent); }
.cl-pin { color: var(--text-3); margin-left: auto; flex: none; }
.cl-bottom .badge-count { margin-left: auto; }
.cl-item.blocked .cl-preview { color: var(--danger); }
.cl-sub { margin-left: 28px; border-left: 2px solid var(--line); padding-left: 0; }
.cl-sub .cl-item { padding-top: 6px; padding-bottom: 6px; }
.cl-sub .cl-item .ava { --s: 38px; }
.cm-stack { position: relative; width: 50px; height: 50px; flex: none; }
.cm-stack .ava { --s: 34px; position: absolute; border: 2px solid var(--panel-solid); }
.cm-stack .ava:nth-child(1) { left: 0; top: 0; z-index: 2; }
.cm-stack .ava:nth-child(2) { right: 0; bottom: 0; z-index: 1; }
.cm-chev { transition: transform .3s var(--ease); color: var(--text-3); }
.cm-open .cm-chev { transform: rotate(180deg); }
.cm-tag { font-size: .62rem; font-weight: 700; padding: 1px 6px; border-radius: 6px; background: var(--accent-soft); color: var(--accent); }
.search-section { padding: 4px 0; }
.search-hit-msg .cl-preview mark { background: color-mix(in srgb, var(--accent) 30%, transparent); color: inherit; border-radius: 3px; }

/* ---------- chat view ---------- */
.chatview { position: relative; }
.cv-empty { flex: 1; display: grid; place-items: center; text-align: center; color: var(--text-2); padding: 30px; background: var(--pattern) repeat; background-size: 320px; }
.cv-empty .logo { width: 86px; height: 86px; margin: 0 auto 14px; display: block; filter: drop-shadow(0 10px 30px color-mix(in srgb, var(--accent) 50%, transparent)); animation: floaty 4s ease-in-out infinite; }
@keyframes floaty { 50% { transform: translateY(-8px); } }
.cv-empty h2 { margin: 0 0 6px; color: var(--text); }
.cv { flex: 1; display: flex; flex-direction: column; min-height: 0; position: relative; animation: cvIn .38s var(--ease); }
@keyframes cvIn { from { opacity: 0; transform: translateX(14px); } }
.cv-bg { position: absolute; inset: 0; z-index: 0; pointer-events: none; background: var(--pattern) repeat; background-size: 320px; }
html.no-pattern .cv-bg, html.no-pattern .cv-empty { background-image: none; }
.cv-head { position: relative; z-index: 3; margin: 10px 10px 0; height: 60px; border-radius: 20px; display: flex; align-items: center; gap: 12px; padding: 0 8px 0 10px; flex: none; }
.cv-head .ava { --s: 40px; cursor: pointer; }
.cv-titlebox { flex: 1; min-width: 0; cursor: pointer; }
.cv-title { font-weight: 700; font-size: .98rem; display: flex; align-items: center; gap: 5px; min-width: 0; }
.cv-title span.t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cv-sub { font-size: .78rem; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cv-actions { display: flex; gap: 2px; }
.cv-back { display: none; }
.cm-strip { position: relative; z-index: 3; display: flex; gap: 6px; padding: 8px 12px 0; overflow-x: auto; scrollbar-width: none; flex: none; }
.cm-strip::-webkit-scrollbar { display: none; }
.cm-strip .cm-title { font-size: .72rem; font-weight: 700; color: var(--text-3); text-transform: uppercase; letter-spacing: .06em; align-self: center; padding: 0 6px 0 4px; white-space: nowrap; }
.cm-tab { display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 12px 0 4px; border-radius: 999px; font-size: .84rem; font-weight: 600; white-space: nowrap; transition: background .2s; background: var(--panel); border: 1px solid var(--line); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); }
.cm-tab .ava { --s: 26px; }
.cm-tab:hover { background: var(--hover); }
.cm-tab.active { background: var(--accent); color: #fff; border-color: transparent; }
.pinned-bar { position: relative; z-index: 3; margin: 8px 10px 0; height: 46px; border-radius: 16px; display: flex; align-items: center; gap: 10px; padding: 0 8px 0 14px; cursor: pointer; flex: none; animation: cvIn .3s var(--ease); }
.pinned-bar .pb-line { width: 3px; align-self: stretch; margin: 8px 0; border-radius: 2px; background: var(--accent); }
.pinned-bar .pb-t { font-size: .74rem; color: var(--accent); font-weight: 700; }
.pinned-bar .pb-x { font-size: .86rem; color: var(--text-2); }
.select-bar { position: absolute; z-index: 6; left: 10px; right: 10px; top: 10px; height: 60px; border-radius: 20px; display: flex; align-items: center; gap: 10px; padding: 0 10px 0 16px; animation: cvIn .25s var(--ease); }

.msgs { position: relative; z-index: 1; flex: 1; overflow-y: auto; overflow-x: hidden; padding: 14px 18px 8px; display: flex; flex-direction: column; gap: 3px; overscroll-behavior: contain; }
.msgs-inner { display: flex; flex-direction: column; gap: 3px; margin-top: auto; max-width: 880px; width: 100%; margin-left: auto; margin-right: auto; }
.date-sep, .sys-pill { align-self: center; margin: 10px 0 6px; padding: 4px 11px; border-radius: 999px; font-size: .78rem; font-weight: 600; background: color-mix(in srgb, var(--panel-solid) 70%, transparent); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); color: var(--text); position: relative; z-index: 2; }
.sys-pill { position: static; font-weight: 500; color: var(--text-2); }

.mrow { display: flex; align-items: flex-end; gap: 8px; position: relative; animation: msgIn .38s var(--ease) both; }
.mrow.out { flex-direction: row-reverse; }
.mrow.cont .bubble { border-top-left-radius: 8px; }
.mrow.out.cont .bubble { border-top-right-radius: 8px; border-top-left-radius: 20px; }
.mrow .m-ava { --s: 34px; cursor: pointer; }
.mrow .m-ava-space { width: 34px; flex: none; }
.mrow.selectable { cursor: pointer; padding-left: 34px; }
.mrow.selectable::before { content: ''; position: absolute; left: 4px; bottom: 10px; width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--text-3); transition: background .2s, border-color .2s; }
.mrow.selected::before { background: var(--accent) url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="white" stroke-width="3" stroke-linecap="round"><path d="M6 12l4 4 8-8"/></svg>') center/14px no-repeat; border-color: var(--accent); }
.mrow.selected .bubble { box-shadow: 0 0 0 2px var(--accent); }
@keyframes msgIn { from { opacity: 0; transform: translateY(10px) scale(.97); } }
.mrow.flash .bubble { animation: flash 1.2s ease; }
@keyframes flash { 30% { box-shadow: 0 0 0 3px var(--accent); } }
.mcol { display: flex; flex-direction: column; max-width: min(76%, 560px); min-width: 0; }
.mrow.out .mcol { align-items: flex-end; }
.mrow.channel .mcol { max-width: min(92%, 600px); }

.bubble {
  position: relative; padding: 7px 12px 7px; border-radius: 20px; background: var(--bubble-in); color: var(--text);
  box-shadow: 0 1px 1px rgba(0, 0, 0, .12), var(--shadow-sm); min-width: 60px; max-width: 100%;
  word-wrap: break-word; overflow-wrap: anywhere; user-select: none; transition: transform .15s var(--ease);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
}
.mrow.out .bubble { background: linear-gradient(135deg, var(--bubble-out-1), var(--bubble-out-2)); color: var(--bubble-out-text); }
.mrow.out .bubble a { color: #fff; text-decoration: underline; text-decoration-color: rgba(255, 255, 255, .5); }
.mrow.out .bubble .b-meta { color: rgba(255, 255, 255, .78); }
.bubble:active { transform: scale(.99); }
.b-name { font-weight: 700; font-size: .84rem; margin-bottom: 2px; cursor: pointer; display: flex; align-items: center; gap: 4px; }
.b-name .admin-tag { font-weight: 500; color: var(--text-3); font-size: .74rem; margin-left: 4px; }
.b-text { font-size: .97rem; line-height: 1.42; white-space: normal; }
.b-text .mention, .b-text a { cursor: pointer; }
.b-meta { float: right; display: inline-flex; align-items: center; gap: 4px; font-size: .7rem; color: var(--text-3); margin: 8px -2px -3px 10px; position: relative; top: 2px; white-space: nowrap; user-select: none; }
.b-meta .i { opacity: .9; }
.b-meta .fx-replay { cursor: pointer; display: inline-flex; }
.b-meta .fx-replay:hover { color: var(--text); }
.b-reply { display: block; padding: 4px 10px; margin: 2px 0 6px; border-radius: 10px; border-left: 3px solid var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); font-size: .84rem; cursor: pointer; max-width: 100%; }
.mrow.out .b-reply { border-left-color: #fff; background: rgba(255, 255, 255, .16); }
.b-reply b { display: block; font-size: .78rem; color: var(--accent); }
.mrow.out .b-reply b { color: #fff; }
.b-reply span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; opacity: .85; }
.b-fwd { font-size: .8rem; color: var(--accent); margin-bottom: 3px; cursor: pointer; }
.mrow.out .b-fwd { color: rgba(255, 255, 255, .9); }
.b-via { font-size: .74rem; color: var(--text-3); margin-bottom: 2px; }
.ephemeral { font-size: .72rem; color: var(--text-3); display: flex; align-items: center; gap: 6px; margin-top: 4px; }
.ephemeral button { color: var(--accent); font-size: .72rem; font-weight: 600; }

/* rich text */
.rich h3 { font-size: 1.12rem; margin: 4px 0 6px; }
.rich ul, .rich ol { margin: 4px 0; padding-left: 22px; }
.rich blockquote { margin: 6px 0; padding: 4px 12px; border-left: 3px solid var(--accent); background: color-mix(in srgb, var(--accent) 10%, transparent); border-radius: 0 10px 10px 0; }
.rich pre { margin: 6px 0; padding: 10px 12px; border-radius: 12px; background: rgba(0, 0, 0, .35); font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .84rem; white-space: pre-wrap; overflow-x: auto; }
html[data-theme="light"] .rich pre { background: rgba(15, 23, 42, .07); }
.rich code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .86em; }
.rich img.rt-img { display: block; max-width: 100%; border-radius: 12px; margin: 8px 0; cursor: zoom-in; }

/* reactions */
.reactions { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 5px; }
.mrow.out .reactions { justify-content: flex-end; }
.rx { height: 28px; padding: 0 9px 0 7px; border-radius: 999px; display: inline-flex; align-items: center; gap: 5px; font-size: .82rem; font-weight: 600; background: var(--bubble-in); border: 1px solid var(--line); transition: transform .2s var(--spring), background .2s, border-color .2s; -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
.rx .e { font-size: 1rem; line-height: 1; }
.rx:hover { transform: scale(1.06); }
.rx.mine { background: var(--accent); color: #fff; border-color: transparent; }
.rx.pop { animation: rxPop .45s var(--spring); }
@keyframes rxPop { 40% { transform: scale(1.3); } }

/* inline keyboard */
.inline-kb { display: flex; flex-direction: column; gap: 4px; margin-top: 4px; width: 100%; }
.kb-row { display: flex; gap: 4px; }
.kb-btn { flex: 1; min-height: 38px; padding: 6px 10px; border-radius: 12px; font-size: .86rem; font-weight: 600; background: color-mix(in srgb, var(--panel-solid) 55%, transparent); border: 1px solid var(--line); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); color: var(--text); transition: background .2s, transform .15s; }
.kb-btn:hover { background: var(--active); }
.kb-btn:active { transform: scale(.97); }
.kb-btn.done { color: var(--accent); }

/* sticker / emoji-only */
.b-sticker { width: 170px; height: 170px; cursor: pointer; animation: stickerPop .55s var(--spring) both; filter: drop-shadow(0 8px 18px rgba(0, 0, 0, .3)); user-select: none; }
.b-sticker img { width: 100%; height: 100%; pointer-events: none; }
@keyframes stickerPop { 0% { transform: scale(.3) rotate(-10deg); opacity: 0; } 100% { transform: none; opacity: 1; } }
.b-emoji { font-size: 64px; line-height: 1.1; cursor: pointer; animation: stickerPop .55s var(--spring) both; user-select: none; filter: drop-shadow(0 6px 14px rgba(0, 0, 0, .25)); }
.b-emoji.many { font-size: 42px; }
.loose-meta { font-size: .7rem; color: var(--text-2); padding: 2px 8px; border-radius: 999px; background: color-mix(in srgb, var(--panel-solid) 70%, transparent); align-self: flex-end; display: inline-flex; gap: 4px; align-items: center; margin-top: 2px; }
.mrow:not(.out) .loose-meta { align-self: flex-start; }

/* media */
.b-media { margin: -3px -8px 4px; border-radius: 16px; overflow: hidden; position: relative; cursor: zoom-in; background: var(--panel-3); min-height: 120px; }
.b-media img, .b-media video { display: block; width: 100%; max-height: 420px; object-fit: cover; }
.b-media.solo { margin: -3px -8px -3px; }
.b-disappear { width: 260px; max-width: 100%; height: 200px; margin: -3px -8px 4px; border-radius: 16px; overflow: hidden; position: relative; cursor: pointer; display: grid; place-items: center; background: linear-gradient(135deg, #1e1b4b, #7c3aed 60%, #ec4899); }
.b-disappear .blurimg { position: absolute; inset: -20px; background-size: cover; background-position: center; filter: blur(26px) saturate(1.4) brightness(.8); transform: scale(1.1); }
.b-disappear .dz-inner { position: relative; text-align: center; color: #fff; display: grid; gap: 6px; justify-items: center; }
.b-disappear .dz-ico { width: 54px; height: 54px; border-radius: 50%; display: grid; place-items: center; background: rgba(0, 0, 0, .35); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.b-disappear.gone { background: var(--panel-3); cursor: default; }
.b-disappear.gone .dz-inner { color: var(--text-2); }

/* voice */
.b-voice { display: flex; align-items: center; gap: 10px; min-width: 240px; padding: 2px 0; }
.vplay { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: #fff; flex: none; transition: transform .2s var(--spring); }
.mrow.out .vplay { background: #fff; color: var(--accent); }
.vplay:active { transform: scale(.9); }
.vbody { flex: 1; min-width: 0; }
.wave { display: flex; align-items: center; gap: 2px; height: 30px; cursor: pointer; position: relative; touch-action: none; }
.wave .bar { flex: 1; min-width: 2px; border-radius: 2px; background: color-mix(in srgb, currentColor 35%, transparent); transition: background .15s; }
.wave .bar.on { background: var(--accent); }
.mrow.out .wave .bar { background: rgba(255, 255, 255, .4); }
.mrow.out .wave .bar.on { background: #fff; }
.vtime { font-size: .74rem; opacity: .75; margin-top: 2px; font-variant-numeric: tabular-nums; }

/* poll */
.b-poll { min-width: 260px; }
.b-poll .pq { font-weight: 700; margin-bottom: 2px; }
.b-poll .pinfo { font-size: .78rem; opacity: .7; margin-bottom: 8px; }
.popt { position: relative; display: block; width: 100%; text-align: left; padding: 9px 12px; margin: 5px 0; border-radius: 12px; border: 1px solid var(--line); overflow: hidden; font-size: .92rem; transition: border-color .2s; }
.popt:hover { border-color: var(--accent); }
.popt .pfill { position: absolute; left: 0; top: 0; bottom: 0; background: color-mix(in srgb, var(--accent) 20%, transparent); transition: width .6s var(--ease); z-index: 0; }
.popt.mine .pfill { background: color-mix(in srgb, var(--accent) 38%, transparent); }
.popt span { position: relative; z-index: 1; display: flex; justify-content: space-between; gap: 10px; }
.popt span b { font-weight: 700; }
.poll-locked { padding: 10px; border-radius: 12px; background: var(--panel-2); font-size: .85rem; color: var(--text-2); display: flex; gap: 8px; align-items: center; }

/* gift message */
.b-gift { width: 240px; text-align: center; padding: 14px 10px 6px; }
.b-gift .ge { font-size: 64px; line-height: 1; animation: giftFloat 3s ease-in-out infinite; display: inline-block; filter: drop-shadow(0 8px 16px rgba(0, 0, 0, .35)); }
@keyframes giftFloat { 50% { transform: translateY(-6px) rotate(4deg); } }
.b-gift .gt { font-weight: 700; margin-top: 8px; }
.b-gift .gs { font-size: .82rem; opacity: .8; }
.b-comments { display: flex; align-items: center; gap: 8px; margin: 8px -12px -7px; padding: 9px 12px; border-top: 1px solid var(--line); font-size: .86rem; font-weight: 600; color: var(--accent); cursor: pointer; border-radius: 0 0 20px 20px; transition: background .2s; }
.b-comments:hover { background: var(--hover); }
.views-tag { display: inline-flex; align-items: center; gap: 3px; }

/* ---------- composer ---------- */
.cv-foot { position: relative; z-index: 4; padding: 6px 12px 12px; flex: none; max-width: 904px; width: 100%; margin: 0 auto; }
.composer { border-radius: 24px; padding: 6px; }
.comp-row { display: flex; align-items: flex-end; gap: 4px; }
.ce { flex: 1; min-height: 40px; max-height: 220px; overflow-y: auto; padding: 9px 8px; outline: none; font-size: .98rem; line-height: 1.4; word-break: break-word; }
.ce:empty::before { content: attr(data-ph); color: var(--text-3); pointer-events: none; }
.ce.rich-mode { max-height: 340px; }
.ce img.rt-img { max-width: 220px; border-radius: 10px; display: block; margin: 6px 0; }
.send-btn { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; color: #fff; background: linear-gradient(135deg, var(--accent), var(--accent-2)); flex: none; transition: transform .25s var(--spring), box-shadow .2s; box-shadow: 0 6px 18px color-mix(in srgb, var(--accent) 40%, transparent); }
.send-btn:hover { transform: scale(1.06); }
.send-btn:active { transform: scale(.9); }
.send-btn.rec { background: var(--danger); animation: recPulse 1.2s infinite; }
@keyframes recPulse { 50% { box-shadow: 0 0 0 10px color-mix(in srgb, var(--danger) 20%, transparent); } }
.comp-extra { display: flex; align-items: center; gap: 10px; padding: 6px 10px 8px; border-bottom: 1px solid var(--line); margin-bottom: 4px; animation: cvIn .25s var(--ease); }
.comp-extra .ce-line { width: 3px; align-self: stretch; border-radius: 2px; background: var(--accent); }
.comp-extra .ce-t { font-size: .78rem; color: var(--accent); font-weight: 700; }
.comp-extra .ce-x { font-size: .85rem; color: var(--text-2); }
.rt-toolbar { display: flex; gap: 2px; padding: 2px 4px 6px; border-bottom: 1px solid var(--line); margin-bottom: 4px; flex-wrap: wrap; align-items: center; }
.rt-toolbar .icon-btn { width: 34px; height: 34px; }
.rt-toolbar .counter { margin-left: auto; font-size: .74rem; color: var(--text-3); padding-right: 8px; }
.rt-toolbar .counter.over { color: var(--danger); }
.cv-bigbtn { width: 100%; height: 50px; border-radius: 999px; font-weight: 700; font-size: .95rem; display: flex; align-items: center; justify-content: center; gap: 8px; transition: background .2s, transform .15s; }
.cv-bigbtn:hover { background: var(--hover); }
.cv-bigbtn:active { transform: scale(.99); }
.cv-bigbtn.primary { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; }
.rec-bar { display: flex; align-items: center; gap: 12px; padding: 4px 6px 4px 14px; min-height: 48px; }
.rec-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--danger); animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: .2; } }
.rec-wave { flex: 1; display: flex; align-items: center; gap: 2px; height: 32px; overflow: hidden; }
.rec-wave i { width: 3px; border-radius: 2px; background: var(--accent); flex: none; animation: barIn .2s var(--ease); }
@keyframes barIn { from { transform: scaleY(0); } }
.trim { position: relative; flex: 1; height: 40px; }
.trim .wave { height: 40px; }
.trim .handle { position: absolute; top: -2px; bottom: -2px; width: 12px; border-radius: 6px; background: var(--accent); cursor: ew-resize; touch-action: none; box-shadow: 0 2px 8px rgba(0, 0, 0, .3); }
.trim .handle::after { content: ''; position: absolute; left: 5px; top: 12px; bottom: 12px; width: 2px; background: rgba(255, 255, 255, .7); border-radius: 1px; }
.trim .shade { position: absolute; top: 0; bottom: 0; background: color-mix(in srgb, var(--panel-solid) 70%, transparent); pointer-events: none; }
.typing-dots { display: inline-flex; gap: 3px; vertical-align: middle; margin-left: 2px; }
.typing-dots i { width: 4px; height: 4px; border-radius: 50%; background: currentColor; animation: tdot 1.2s infinite; }
.typing-dots i:nth-child(2) { animation-delay: .15s; } .typing-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes tdot { 0%, 60%, 100% { opacity: .3; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }
.scroll-down { position: absolute; right: 22px; bottom: 86px; z-index: 5; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; transition: transform .25s var(--spring), opacity .2s; }
.scroll-down.hide { transform: scale(.6); opacity: 0; pointer-events: none; }
.scroll-down .badge-count { position: absolute; top: -6px; right: -4px; }

/* blocked overlays inside chat */
.chat-lock { flex: 1; display: grid; place-items: center; text-align: center; padding: 30px; position: relative; z-index: 2; }
.chat-lock .lock-card { padding: 30px 28px; border-radius: 26px; max-width: 360px; animation: pop .4s var(--spring); }
.chat-lock h2 { color: var(--danger); margin: 10px 0 6px; }

/* ---------- responsive ---------- */
@media (max-width: 860px) {
  #app { padding: 0; gap: 0; }
  .topbar { border-radius: 0; border-left: 0; border-right: 0; border-top: 0; height: 56px; }
  .tb-balance span.lbl, .tb-me .tb-user { display: none; }
  .main { grid-template-columns: 1fr; gap: 0; position: relative; overflow: hidden; }
  .sidebar, .chatview { border-radius: 0; border: 0; }
  .chatview { position: absolute; inset: 0; transform: translateX(100%); transition: transform .38s var(--ease); z-index: 4; background: var(--bg); }
  .app.chat-open .chatview { transform: none; }
  .cv-back { display: inline-grid; }
  .msgs { padding: 10px 10px 6px; }
  .mcol { max-width: 86%; }
  .cv-foot { padding: 6px 8px 10px; }
  .b-sticker { width: 140px; height: 140px; }
}
@media (max-width: 420px) {
  .tb-balance { padding: 0 9px; }
  .cl-item { margin: 1px 4px; }
}
