/* Chat area: flat wall, hairline-bordered header and composer, 16px bubbles (own = solid blue), flat language strip, flat segmented language switch. */
.chat-pane { grid-area: chat; min-height: 0; min-width: 0; }
.chat-card { height: 100%; background: var(--bg); position: relative; overflow: hidden; display: flex; }

.chat-empty { margin: auto; display: grid; justify-items: center; gap: 10px; text-align: center; padding: 32px; max-width: 380px; color: var(--t2); position: relative; }
.chat-empty h2 { font-size: 18px; font-weight: 600; color: var(--t1); }
.chat-empty p { font-size: 14px; }
.chat-empty .hint-keys { margin-top: 4px; display: flex; gap: 8px; align-items: center; justify-content: center; color: var(--t3); font-size: 13px; }
.eico { width: 56px; height: 56px; border-radius: 18px; background: var(--accent-bg); color: var(--accent-text); display: grid; place-items: center; margin-bottom: 4px; }
.chat-view { display: flex; width: 100%; min-width: 0; min-height: 0; position: relative; overflow: hidden; }
.chat-main { flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; position: relative; z-index: 1; }

/* header: avatar + name + status | pill language switch (centered) | round icon buttons */
.chat-head { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 12px; padding: 8px 20px 7px; min-height: 64px; flex: none; position: relative; z-index: 2; background: var(--panel); border-bottom: 1px solid var(--sep); }
.hd-l { display: flex; align-items: center; gap: 8px; min-width: 0; }
.chat-head .back { display: none; margin-left: -8px; }
.hd-main { min-width: 0; display: flex; align-items: center; gap: 12px; text-align: left; border-radius: 12px; }
.hd-av { --ring-bg: var(--bg); flex: none; }
.hd-text { min-width: 0; display: grid; gap: 1px; line-height: 1.25; }
.hd-name { font-size: 16px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hd-status { min-height: 18px; font-size: 13px; color: var(--t2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hd-status.online, .hd-status.typing { color: var(--accent-text); }
.hd-status.typing { font-weight: 500; }
.hd-pair { display: flex; align-items: center; background: transparent; border: 1px solid var(--field-line); border-radius: var(--r-pill); padding: 3px; gap: 0; font-size: 13px; font-weight: 600; justify-self: center; }
.hd-pair > button { padding: 5px 14px; border-radius: var(--r-pill); color: var(--t2); white-space: nowrap; transition: background-color 160ms, color 160ms; }
.hd-pair > button:hover { color: var(--t1); }
.hd-pair > button.on { background: var(--own); color: #fff; }
.hd-actions { grid-column: 3; display: flex; align-items: center; justify-content: flex-end; gap: 6px; }
.hd-btn { background: transparent; border: 1px solid var(--line); }
.hd-btn:hover:not(:disabled) { background: var(--hover-strong); }
.call-btn:disabled { color: var(--t3); }

/* thread */
.thread-wrap { position: relative; flex: 1; min-height: 0; }
.thread { height: 100%; overflow-y: auto; overflow-x: hidden; scrollbar-gutter: stable both-edges; overflow-anchor: auto; overscroll-behavior: contain; }
.thread-inner { max-width: 796px; margin: 0 auto; padding: 12px 28px 8px; display: flex; flex-direction: column; min-height: 100%; justify-content: flex-end; }
.msgs { display: flex; flex-direction: column; gap: 4px; }
.older { align-self: center; margin-bottom: 12px; }
.sys { align-self: center; font-size: 12px; font-weight: 600; color: var(--t2); }
.sys.day { margin: 8px 0; }
.sys.day span { display: inline-block; padding: 3px 12px; border-radius: var(--r-pill); background: transparent; border: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.sys.xl { display: inline-flex; align-items: center; gap: 8px; min-height: 28px; padding: 4px 12px; border-radius: var(--r-pill); background: transparent; border: 1px solid var(--line); color: var(--t2); font-size: 12.5px; font-weight: 500; text-align: center; margin: 4px 0 6px; }
.unread-div { display: flex; align-items: center; gap: 12px; color: var(--accent-text); font-size: 12px; font-weight: 600; margin: 6px 0; }
.unread-div::before, .unread-div::after { content: ""; flex: 1; height: 1px; background: color-mix(in srgb, var(--ring) 45%, var(--line)); }
.chat-start { align-self: center; display: grid; justify-items: center; gap: 6px; text-align: center; padding: 32px 16px; max-width: 360px; color: var(--t2); }
.chat-start h3 { font-size: 16px; font-weight: 600; color: var(--t1); }
.chat-start p { font-size: 13.5px; }

/* typing: a bubble with three bouncing dots */
.typing-row { align-self: flex-start; margin: 4px 0 6px; padding: 14px 16px; border-radius: 22px; background: var(--card); border: 1px solid var(--line); transform-origin: left center; display: flex; }
.typing-lbl { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.dots { display: inline-flex; gap: 4px; }
.dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--t2); animation: dot 1.2s ease-in-out infinite; }
.dots i:nth-child(2) { animation-delay: .15s; } .dots i:nth-child(3) { animation-delay: .3s; }
@keyframes dot { 0%, 60%, 100% { transform: translateY(0); opacity: .4; } 30% { transform: translateY(-4px); opacity: 1; } }

.down-btn { position: absolute; right: 24px; bottom: 16px; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: var(--panel); border: 1px solid var(--field-line); color: var(--t1); box-shadow: var(--shadow-pop); transition: background-color 140ms, transform 100ms var(--ease); z-index: 3; }
.down-btn:hover { background: var(--hover-strong); } .down-btn:active { transform: scale(.94); }
.down-badge { position: absolute; top: -8px; right: -6px; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--badge); color: #fff; font-size: 12px; font-weight: 600; display: grid; place-items: center; }
.audio-bar { margin: 0 28px 8px; padding: 8px 14px; border-radius: var(--r-12); background: var(--warn-bg); color: var(--warn); font-size: 13px; display: flex; gap: 8px; align-items: center; }

/* ---------- message: row (.msg) = bubble (.bub) + meta line (.msg-meta) */
.msg { position: relative; display: flex; flex-direction: column; width: fit-content; max-width: min(100%, 580px); min-width: 0; scroll-margin: 80px; margin-bottom: 4px; }
.msg.in { align-self: flex-start; align-items: flex-start; }
.msg.mine { align-self: flex-end; align-items: flex-end; }
.msg.is-voice { width: min(100%, 340px); }
.msg:focus-visible { outline: none; }
.msg:focus-visible .bub { outline: 2px solid var(--ring); outline-offset: 2px; }
.bub { position: relative; max-width: 100%; min-width: 0; border-radius: 22px; padding: 11px 16px 12px; background: var(--card); color: var(--t1); border: 1px solid var(--line); }
.is-voice .bub { width: 100%; }
.msg.mine .bub { background: var(--own); color: #fff; border-color: transparent; }
.msg.enter-mine { animation: msg-mine 240ms var(--ease) both; transform-origin: bottom right; }
.msg.enter-in { animation: msg-in 240ms var(--ease) both; transform-origin: bottom left; }
@keyframes msg-mine { from { opacity: 0; transform: translateY(12px) scale(.98); } }
@keyframes msg-in { from { opacity: 0; transform: translateY(8px); } }
.msg.flash .bub::after { content: ""; position: absolute; inset: 0; background: var(--accent); pointer-events: none; animation: flash 1.4s ease-out both; border-radius: inherit; }
@keyframes flash { 0% { opacity: 0; } 15% { opacity: .3; } 100% { opacity: 0; } }
.msg.failed .bub { box-shadow: 0 0 0 2px color-mix(in srgb, var(--danger) 65%, transparent); }
.msg.failed .tx, .msg.failed .vp { opacity: .75; }

/* meta line under the bubble: pin mark, time, ticks, Listen */
.msg-meta { display: flex; align-items: center; gap: 6px; margin: 3px 8px 0; min-height: 16px; font-size: 12px; color: var(--t3); font-variant-numeric: tabular-nums; }
.msg.has-react .msg-meta { margin-top: 15px; }
.msg-time { white-space: nowrap; }
.pinmark { display: none; color: var(--accent-text); border-radius: 6px; position: relative; }
.pinmark::after { content: ""; position: absolute; inset: -8px; }
.pinmark:hover { color: var(--danger); }
.msg.pinned .pinmark { display: inline-flex; }
.msg-listen:empty { display: none; }
.msg-listen:not(:empty)::before { content: "·"; margin-right: 6px; }
.lbtn { position: relative; display: inline-flex; align-items: center; gap: 4px; color: var(--accent-text); font-size: 12px; font-weight: 600; border-radius: 6px; }
.lbtn::after { content: ""; position: absolute; inset: -8px -6px; }
.lbtn:hover { text-decoration: underline; text-underline-offset: 2px; }
.ci { display: inline-grid; }
.ci .spin { width: 12px; height: 12px; border-width: 2px; }
.ticks { display: inline-grid; width: 20px; height: 16px; color: var(--t3); margin-left: -2px; }
.ticks > span { grid-area: 1 / 1; display: grid; place-items: center; opacity: 0; transform: scale(.6); transition: opacity 150ms var(--ease), transform 150ms var(--ease), color 200ms linear; }
.ticks[data-s="sending"] .tk-clock, .ticks[data-s="sent"] .tk-one, .ticks[data-s="delivered"] .tk-two, .ticks[data-s="read"] .tk-two, .ticks[data-s="failed"] .tk-fail { opacity: 1; transform: none; }
.ticks[data-s="read"] .tk-two { color: var(--accent-text); }
.ticks[data-s="failed"] { color: var(--danger); }
.ticks .tk-two { transform: translateX(-4px); }
.ticks[data-s="delivered"] .tk-two, .ticks[data-s="read"] .tk-two { transform: none; }

.msg-replywrap:empty, .msg-strip:empty, .msg-note-wrap:empty, .msg-reacts:empty, .msg-listen:empty { display: none; }
.quote { display: grid; gap: 1px; width: 100%; text-align: left; padding: 5px 10px; margin-bottom: 7px; border-radius: 12px; background: var(--strip-bg); border-left: 2px solid var(--accent-text); transition: background-color 140ms; }
.quote:hover { background: var(--strip-on); }
.q-name { font-size: 12.5px; font-weight: 600; color: var(--accent-text); }
.q-text { font-size: 13px; color: var(--t2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg.mine .quote { background: rgba(255, 255, 255, .14); border-left-color: rgba(255, 255, 255, .8); }
.msg.mine .quote:hover { background: rgba(255, 255, 255, .26); }
.msg.mine .q-name, .msg.mine .q-text { color: #fff; }

.tx { font-size: 16px; line-height: 23px; white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-word; }
.tx.reveal { animation: reveal 220ms var(--ease) both; }
@keyframes reveal { from { opacity: 0; transform: translateY(4px); } }
.tx-pending { display: grid; gap: 8px; padding: 4px 0; min-width: 200px; }
.tx-pending .skel { height: 13px; }
.tx-label { display: flex; gap: 8px; align-items: center; font-size: 12.5px; color: var(--t2); margin-top: 6px; }
.tx-label .spin { width: 12px; height: 12px; border-width: 2px; }
.msg-deleted { display: flex; align-items: center; gap: 8px; color: var(--t2); font-style: italic; font-size: 14.5px; font-weight: 500; }
.msg.deleted .bub { padding: 9px 16px; background: transparent; border: 1.5px dashed var(--t3); color: var(--t2); }
.msg.mine .tx-label { color: #fff; }
.msg.mine .skel { background: rgba(255, 255, 255, .3); }

/* language strip inside the bubble: toggles translated / original (or what you wrote / what they read) */
.lstrip { display: inline-flex; background: transparent; padding: 2px; gap: 2px; border: 1px solid var(--field-line); border-radius: var(--r-pill); margin-top: 8px; font-size: 12px; font-weight: 600; width: max-content; max-width: 100%; overflow: hidden; }
.sg { position: relative; display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 10px; border-radius: var(--r-pill); color: var(--t2); white-space: nowrap; transition: background-color 140ms, color 140ms; }
.sg b { font-weight: 700; }
.sg::after { content: ""; position: absolute; inset: -10px -1px; }
.sg:hover { color: var(--t1); }
.sg.on { background: var(--strip-on); color: var(--t1); }
.msg.mine .lstrip { background: transparent; border-color: rgba(255, 255, 255, .45); }
.msg.mine .sg { color: #fff; } 
.msg.mine .sg.on { background: #fff; color: var(--own); }
.numhint { font-size: 12px; font-weight: 700; letter-spacing: .04em; color: var(--warn); background: var(--warn-bg); border-radius: 5px; padding: 0 4px; margin-left: 2px; }

.msg-note-wrap { display: grid; gap: 6px; margin-top: 8px; }
.note { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 8px 10px; border-radius: 10px; font-size: 13px; line-height: 18px; }
.note.warn { background: var(--warn-bg); color: var(--warn); } .note.bad { background: var(--danger-bg); color: var(--danger); }
.lnk { font-weight: 600; text-decoration: underline; text-underline-offset: 2px; color: inherit; border-radius: 4px; }
.msg-timing { margin-top: 8px; font-size: 12px; color: var(--t2); }
.msg.mine .msg-timing { color: #fff; }

/* reaction chip overlaps the bubble's bottom-right edge */
.msg-reacts { position: absolute; right: 12px; bottom: -12px; display: flex; gap: 4px; z-index: 2; }
.rchip { display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 8px; border-radius: var(--r-pill); border: 1px solid var(--field-line); background: var(--panel); color: var(--t1); font-size: 13px; font-variant-numeric: tabular-nums; transition: background-color 140ms, border-color 140ms, transform 100ms var(--ease); }
.rchip:hover { background: var(--hover-strong); } .rchip:active { transform: scale(.95); }
.rchip.mine { background: var(--accent-bg); border-color: color-mix(in srgb, var(--ring) 55%, var(--line)); }
.rchip .rct { font-size: 12px; font-weight: 600; color: var(--t2); }
.rchip.mine .rct { color: var(--accent-text); }
.rchip.bump { animation: rpop 220ms var(--ease) both; }
@keyframes rpop { 0% { transform: scale(.6); opacity: 0; } 60% { transform: scale(1.15); opacity: 1; } 100% { transform: scale(1); } }

/* hover tools sit beside the bubble (outside it), so they never cover the text */
.msg-tools { position: absolute; top: 50%; display: flex; gap: 0; padding: 2px; border-radius: var(--r-pill); background: var(--popover); -webkit-backdrop-filter: blur(24px); backdrop-filter: blur(24px); box-shadow: var(--shadow-pop); opacity: 0; transform: translateY(-50%); pointer-events: none; transition: opacity 140ms ease-out; z-index: 3; margin-top: -8px; }
.msg.in .msg-tools { left: calc(100% + 8px); } .msg.mine .msg-tools { right: calc(100% + 8px); }
.msg-tools::before { content: ""; position: absolute; top: 0; bottom: 0; width: 10px; }
.msg.in .msg-tools::before { right: 100%; } .msg.mine .msg-tools::before { left: 100%; }
.msg-tools .ibtn { width: 28px; height: 28px; } .msg-tools .ibtn::after { inset: -4px; }
@media (hover: hover) and (min-width: 900px) { .msg { max-width: min(calc(100% - 108px), 580px); } }   /* room for the side tools */
@media (hover: hover) { .msg:hover .msg-tools, .msg.line-hover .msg-tools, .msg:focus-within .msg-tools { opacity: 1; transform: translateY(-50%); pointer-events: auto; } }
.msg:focus-visible .msg-tools { opacity: 1; transform: translateY(-50%); pointer-events: auto; }

/* ---------- voice message: round 42px play button + waveform + duration, transcript below */
.vwrap { display: grid; gap: 8px; }
.vwrap .lstrip { margin-top: 0; justify-self: start; }
.vp { display: flex; align-items: center; gap: 10px; min-width: 0; }
.vp-play { width: 42px; height: 42px; border-radius: 50%; flex: none; background: var(--own); color: #fff; display: grid; place-items: center; transition: transform 120ms var(--ease), background-color 140ms; }
.vp-play:hover { filter: brightness(1.1); } .vp-play:active { transform: scale(.96); }
.vp-play.sw .i { animation: icon-in 120ms var(--ease) both; }
@keyframes icon-in { from { opacity: 0; transform: scale(.8); } }
.vp.disabled .vp-play { background: var(--hover-strong); color: var(--t3); cursor: default; }
.vp.disabled .vp-bars { opacity: .5; }
.vp-wave { position: relative; flex: 1; min-width: 80px; height: 32px; cursor: pointer; touch-action: none; border-radius: 6px; overflow: hidden; }
.vp.disabled .vp-wave { cursor: default; }
.vp-bars { position: absolute; inset: 0; display: flex; align-items: center; justify-content: space-between; }
.vp-bars i { display: block; width: 3px; border-radius: 2px; background: var(--wave-off); flex: none; }
.vp-bars.on i { background: var(--accent-text); }
.vp-fillclip { position: absolute; inset: 0; overflow: hidden; transform: translateX(calc((var(--p, 0) - 1) * 100%)); will-change: transform; }
.vp-fillin { position: absolute; inset: 0; transform: translateX(calc((1 - var(--p, 0)) * 100%)); will-change: transform; }
.vp-wave.drag::after { content: ""; position: absolute; top: 4px; bottom: 4px; left: calc(var(--p, 0) * 100% - 5px); width: 10px; border-radius: 5px; background: var(--accent); opacity: .9; }
.vp-time { font-size: 12.5px; color: var(--t2); min-width: 40px; text-align: right; white-space: nowrap; }
.vp.error .vp-time { color: var(--danger); }
.vp-speed { height: 22px; min-width: 32px; padding: 0 8px; border-radius: var(--r-pill); border: 1px solid var(--line); color: var(--t2); font-size: 12px; font-weight: 600; transition: background-color 140ms, transform 100ms var(--ease); flex: none; }
.vp-speed:hover { background: var(--strip-on); } .vp-speed:active { transform: scale(.96); }
.vtxt:empty { display: none; }
.msg.mine .vp-play { background: #fff; color: var(--own); }
.msg.mine .vp-play:hover { background: #eef3ff; filter: none; }
.msg.mine .vp-bars i { background: rgba(255, 255, 255, .42); } .msg.mine .vp-bars.on i { background: #fff; }
.msg.mine .vp-time { color: #fff; }
.msg.mine .vp-speed { background: transparent; border-color: rgba(255, 255, 255, .45); color: #fff; }
.msg.mine .vp-wave.drag::after { background: #fff; }

/* ---------- composer: round pill (language pair, attach, text, emoji) + 52px round gradient mic/send button */
.composer-bar { flex: none; background: var(--panel); border-top: 1px solid var(--sep); padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right); }
.composer-wrap { width: 100%; max-width: 796px; margin: 0 auto; padding: 10px 28px 14px; flex: none; }
.cbanner { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; padding: 8px 8px 8px 12px; border-radius: 14px; background: var(--card); border: 1px solid var(--line); position: relative; }
.cb-ico { color: var(--accent-text); display: grid; }
.cb-text { flex: 1; min-width: 0; display: grid; gap: 1px; }
.cb-name { font-size: 12.5px; font-weight: 600; color: var(--accent-text); }
.cb-msg { font-size: 13px; color: var(--t2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cbar { display: flex; align-items: flex-end; gap: 10px; }
.pill { flex: 1; min-width: 0; display: grid; border-radius: 26px; border: 1px solid var(--field-line); background: var(--input); padding: 0 8px 0 10px; min-height: 52px; align-content: center; transition: border-color 140ms; }
.pill:focus-within { outline: 2px solid var(--ring); outline-offset: 2px; }
.pill-row, .rec-row { grid-area: 1 / 1; display: flex; align-items: flex-end; gap: 4px; min-width: 0; transition: opacity 160ms var(--ease); }
.pill-row { align-items: center; }
.rec-row { align-items: center; gap: 12px; padding-left: 4px; min-height: 50px; opacity: 0; pointer-events: none; visibility: hidden; transition: opacity 160ms var(--ease), visibility 0s linear 160ms; }
.pill.recording .pill-row { opacity: 0; pointer-events: none; }
.pill.recording .rec-row { opacity: 1; pointer-events: auto; visibility: visible; transition: opacity 160ms var(--ease), visibility 0s; }
.pair { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; margin: 0 4px 0 2px; border-radius: var(--r-pill); border: 1px solid var(--line); background: transparent; color: var(--t2); font-size: 12px; flex: none; }
.pair b { font-weight: 700; letter-spacing: .02em; }
.ta-wrap { flex: 1; min-width: 0; position: relative; align-self: stretch; display: flex; align-items: center; }
.cta { width: 100%; resize: none; border: 0; background: transparent; padding: 14px 8px; font-size: 15.5px; line-height: 22px; max-height: 134px; color: var(--t1); outline: none; display: block; overflow-y: auto; }
.cta::placeholder { color: var(--t3); }
.counter { position: absolute; right: 4px; bottom: -2px; font-size: 12px; color: var(--t3); background: var(--input); padding: 0 4px; border-radius: 6px; }
.counter.full { color: var(--danger); font-weight: 600; }
.msbtn { position: relative; width: 52px; height: 52px; border-radius: 50%; flex: none; background: var(--own); color: #fff; touch-action: none; transition: filter 160ms, transform 100ms var(--ease), box-shadow 160ms; }
.msbtn:hover:not(:disabled) { filter: brightness(1.1); }
.msbtn:active:not(:disabled) { transform: scale(.94); }
.msbtn:disabled { opacity: .45; }
.msbtn .ms-ico { position: absolute; inset: 0; display: grid; place-items: center; transition: opacity 160ms var(--ease), transform 160ms var(--ease); }
.msbtn .ms-send { opacity: 0; transform: scale(.8); }
.msbtn.has-text .ms-mic, .cbar.recording .msbtn .ms-mic { opacity: 0; transform: scale(.8); }
.msbtn.has-text .ms-send, .cbar.recording .msbtn .ms-send { opacity: 1; transform: none; }
.msbtn.blocked { box-shadow: 0 0 0 3px var(--danger); }
.rec-trash { color: var(--danger); }
.rec-trash:hover:not(:disabled) { background: var(--danger-bg); color: var(--danger); }
.rec-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--danger); flex: none; }
.pill.recording .rec-dot { animation: recpulse 1.2s ease-in-out infinite; }   /* only while recording */
@keyframes recpulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: .35; transform: scale(.8); } }
.rec-time { font-size: 15px; font-weight: 600; min-width: 38px; }
.rec-time.warn { color: var(--danger); }
.rec-bars { flex: 1; min-width: 0; height: 32px; display: flex; align-items: center; gap: 3px; justify-content: center; overflow: hidden; }
.rec-bars i { display: block; flex: 1; max-width: 4px; height: 28px; border-radius: 2px; background: var(--accent-text); transform: scaleY(.12); transform-origin: center; }
.rec-hint { font-size: 12.5px; color: var(--t2); white-space: nowrap; }
.pill.will-cancel .rec-hint { color: var(--danger); }
.chints { line-height: 18px; display: flex; justify-content: center; gap: 16px; margin-top: 8px; font-size: 12px; color: var(--t3); }
.emoji-pop { padding: 8px; }
.emoji-grid { display: grid; grid-template-columns: repeat(8, 36px); gap: 2px; }
.emo { width: 36px; height: 36px; border-radius: 8px; font-size: 20px; line-height: 1; transition: background-color 120ms, transform 100ms var(--ease); }
.emo:hover { background: var(--hover-strong); } .emo:active { transform: scale(.9); }

/* ---------- responsive */
@media (max-width: 1100px) { .thread-inner { padding-left: 20px; padding-right: 20px; } .composer-wrap { padding-left: 20px; padding-right: 20px; } .chat-head { padding-left: 16px; padding-right: 16px; } }
@media (max-width: 899px) {
  .chat-pane { position: fixed; inset: 0; z-index: 90; transform: translateX(100%); visibility: hidden; transition: transform 280ms cubic-bezier(.32, .72, 0, 1), visibility 0s linear 280ms; background: var(--bg); }
  .app[data-view="chat"] .chat-pane { transform: none; visibility: visible; transition: transform 280ms cubic-bezier(.32, .72, 0, 1), visibility 0s; }
  .chat-card { height: 100dvh; }
  .chat-head { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "l a" "p p"; padding: calc(6px + env(safe-area-inset-top)) 8px 6px 4px; gap: 4px 4px; min-height: 60px; }
  .hd-l { grid-area: l; } .hd-actions { grid-area: a; } .hd-pair { grid-area: p; margin-bottom: 2px; }
  .chat-head .back { display: inline-grid; margin-left: 0; }
  .hd-main { gap: 10px; }
  .hd-actions .hd-btn:first-child { display: none; }   /* people search lives in the list pane, which is out of view here */
  .thread-inner { padding: 10px 12px 8px; }
  .msg { max-width: 92%; }
  .msg.is-voice { width: min(92%, 340px); }
  .bub { padding: 10px 14px 11px; }
  .composer-wrap { padding: 6px 10px calc(8px + env(safe-area-inset-bottom)); }
  .audio-bar { margin: 0 10px 8px; }
  .cta { font-size: 16px; }
  .chints { display: none; }
  .pair { padding: 0 8px; margin-left: 0; gap: 4px; }
  .pill-row .attach-btn { display: none; }   /* placeholder button (attachments are not built): saves room for the text */
  #toasts { bottom: calc(88px + env(safe-area-inset-bottom)); }
  .down-btn { right: 14px; }
  .rec-hint { display: none; }
  .emoji-grid { grid-template-columns: repeat(7, 38px); }
}
@media (hover: none) { .msg-tools { display: none; } }
@media (max-width: 899px) {   /* single-pane layout only: on desktop the chat pane is always visible */
  html[data-motion="reduce"] .chat-pane { transform: none !important; opacity: 0; transition: opacity .12s, visibility 0s linear .12s !important; }
  html[data-motion="reduce"] .app[data-view="chat"] .chat-pane { opacity: 1; transition: opacity .12s, visibility 0s !important; }
}
html[data-motion="reduce"] .ticks > span, html[data-motion="reduce"] .ticks .tk-two { transform: none !important; }
html[data-motion="reduce"] .msg-tools { transform: translateY(-50%) !important; }

.hd-line { display: flex; align-items: center; gap: 8px; min-width: 0; }

.hd-pair > button { display: inline-flex; align-items: center; gap: 6px; }
.sg .flag.sm { margin-right: -1px; }
.pair { gap: 4px; }

/* ---------- switching chats: the chrome stays still; only the message list and the header text fade (opacity only) */
@keyframes swap-in { from { opacity: .6; } }
.thread-inner.swap-in { animation: swap-in 180ms cubic-bezier(.2, .7, .3, 1) both; }
.hd-text.swap-in-s { animation: swap-in 120ms ease-out both; }
.thread-inner.swap-in .vp-play .i { animation: none; }   /* no second fade of the play icons */
@media (max-width: 899px) {   /* phones: the list -> chat slide is the transition (transform only, about 300 ms) */
  .chat-pane { transition: transform 300ms cubic-bezier(.32, .72, 0, 1), visibility 0s linear 300ms; }
  .app[data-view="chat"] .chat-pane { transition: transform 300ms cubic-bezier(.32, .72, 0, 1), visibility 0s; }
  .sb-head, .rail, .list-pane { transition: transform 300ms cubic-bezier(.32, .72, 0, 1), opacity 300ms cubic-bezier(.32, .72, 0, 1); }
}
html[data-motion="reduce"] .thread-inner.swap-in, html[data-motion="reduce"] .hd-text.swap-in-s { animation: none; }
.hd-pair > button { min-width: 100px; justify-content: center; }   /* the switch keeps one width for every language pair, so the header actions never move on a switch */
