:root {
  --bg: #eef2f6;
  --panel: #ffffff;
  --panel-2: #f6f8fa;
  --line: #e2e8f0;
  --text: #1a202c;
  --muted: #718096;
  --accent: #2b6cb0;
  --accent-soft: #e6f0fa;
  --accent-text: #ffffff;
  --mine: #dcebfb;
  --theirs: #ffffff;
  --danger: #c53030;
  --online: #38a169;
  --tick-read: #2b6cb0;
  --chat-bg: #e7edf3;
  --shadow: 0 8px 30px rgba(15, 23, 42, 0.12);
  --radius: 14px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f141a;
    --panel: #171d25;
    --panel-2: #1d2530;
    --line: #2a3441;
    --text: #e6edf3;
    --muted: #8b98a8;
    --accent: #5a9be0;
    --accent-soft: #1f3247;
    --accent-text: #0b1520;
    --mine: #23476b;
    --theirs: #1f2731;
    --danger: #f07171;
    --online: #48bb78;
    --tick-read: #7cc4ff;
    --chat-bg: #0c1117;
    --shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f141a; --panel: #171d25; --panel-2: #1d2530; --line: #2a3441; --text: #e6edf3;
  --muted: #8b98a8; --accent: #5a9be0; --accent-soft: #1f3247; --accent-text: #0b1520;
  --mine: #23476b; --theirs: #1f2731; --danger: #f07171; --online: #48bb78; --tick-read: #7cc4ff; --chat-bg: #0c1117;
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.5); color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button { font: inherit; color: inherit; }
input, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }
.muted { color: var(--muted); }

svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 16px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--panel); cursor: pointer; text-decoration: none; color: var(--text);
}
.btn:hover { background: var(--panel-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); font-weight: 600; }
.btn.primary:hover { filter: brightness(1.07); }
.btn.danger { color: var(--danger); }
.btn.small { padding: 5px 10px; font-size: 13px; }
.btn:disabled { opacity: 0.55; cursor: default; }

.icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px; flex: none;
  border: 0; border-radius: 50%; background: transparent; cursor: pointer; color: var(--muted);
}
.icon-btn:hover { background: var(--panel-2); color: var(--text); }

/* ---------- auth ---------- */
.auth { min-height: 100%; display: grid; place-items: center; padding: 24px 16px; }
.auth-card {
  width: 100%; max-width: 380px; background: var(--panel); border-radius: 18px;
  padding: 28px 24px; box-shadow: var(--shadow);
}
.brand { display: flex; gap: 14px; align-items: center; margin-bottom: 22px; }
.brand h1 { margin: 0; font-size: 24px; }
.brand p { margin: 2px 0 0; font-size: 14px; }

.tabs { display: flex; background: var(--panel-2); border-radius: 10px; padding: 3px; margin-bottom: 18px; }
.tab { flex: 1; border: 0; background: none; padding: 8px; border-radius: 8px; cursor: pointer; color: var(--muted); }
.tab.active { background: var(--panel); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.12); font-weight: 600; }

.form { display: grid; gap: 12px; }
.form label { display: grid; gap: 5px; font-size: 13px; color: var(--muted); }
.form input, .field {
  width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--panel-2); color: var(--text); font-size: 15px;
}
.form input:focus, .field:focus, .search:focus, #msg-input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.form .btn { margin-top: 4px; padding: 11px; }
.form-error { margin: 0; color: var(--danger); font-size: 14px; }
.invite-hint { margin: -4px 0 0; font-size: 13px; }
.invite-hint.ok { color: #2f855a; }
.invite-hint.bad { color: var(--danger); }

/* ---------- layout ---------- */
.app { display: grid; grid-template-columns: 340px 1fr; height: 100%; height: 100dvh; }

.sidebar { display: flex; flex-direction: column; min-height: 0; background: var(--panel); border-right: 1px solid var(--line); }
.side-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 8px 6px 12px; gap: 8px; }
.me { display: flex; align-items: center; gap: 10px; border: 0; background: none; cursor: pointer; min-width: 0; padding: 4px; border-radius: 10px; }
.me:hover { background: var(--panel-2); }
.me-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-actions { display: flex; }

.search-wrap { padding: 4px 12px 8px; }
.search { width: 100%; padding: 9px 12px; border-radius: 20px; border: 0; background: var(--panel-2); }

.chat-list { list-style: none; margin: 0; padding: 0 6px 8px; overflow-y: auto; flex: 1; }
.chat-item {
  display: flex; gap: 12px; align-items: center; padding: 9px 10px; border-radius: 12px; cursor: pointer;
}
.chat-item:hover { background: var(--panel-2); }
.chat-item.active { background: var(--accent); color: var(--accent-text); }
.chat-item.active .muted, .chat-item.active .ci-time { color: inherit; opacity: .8; }
.ci-body { flex: 1; min-width: 0; }
.ci-top, .ci-bottom { display: flex; align-items: baseline; gap: 8px; }
.ci-title { flex: 1; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ci-time { font-size: 12px; color: var(--muted); flex: none; }
.ci-preview { flex: 1; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge {
  flex: none; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px;
  background: var(--accent); color: var(--accent-text); font-size: 12px; font-weight: 700;
  display: grid; place-items: center;
}
.chat-item.active .badge { background: var(--accent-text); color: var(--accent); }
.empty-side { padding: 24px; text-align: center; color: var(--muted); }

.side-foot {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 12px calc(8px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line);
}
.version {
  order: -1; margin-right: auto; border: 0; background: none; color: var(--muted); font-size: 12px; cursor: pointer;
  padding: 2px 6px; border-radius: 6px;
}
.install-btn {
  border: 1px solid var(--line); border-radius: 8px; padding: 4px 10px; font-size: 13px; cursor: pointer;
  background: var(--panel-2); color: var(--text);
}
.install-btn:hover { border-color: var(--accent); }
.push-box { border-top: 1px solid var(--line); padding-top: 12px; display: grid; gap: 8px; }
.push-title { font-weight: 600; }
.steps { margin: 0; padding-left: 20px; display: grid; gap: 6px; }
.version:hover { background: var(--panel-2); color: var(--text); }
.update-btn {
  border: 0; border-radius: 8px; padding: 5px 10px; font-size: 13px; font-weight: 600; cursor: pointer;
  background: var(--accent); color: var(--accent-text);
}
.changes h3 { margin: 0 0 4px; font-size: 15px; }
.changes ul { margin: 0; padding-left: 20px; }
.changes li { margin: 2px 0; }

.avatar {
  flex: none; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center;
  color: #fff; font-weight: 700; font-size: 16px; background: var(--accent); user-select: none;
}
.avatar.sm { width: 36px; height: 36px; font-size: 14px; }
.avatar.xs { width: 30px; height: 30px; font-size: 12px; }
.avatar.xl { width: 96px; height: 96px; font-size: 34px; }
.avatar { overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }

.av-wrap { position: relative; display: inline-grid; flex: none; }
.av-wrap .dot {
  position: absolute; right: 0; bottom: 0; width: 13px; height: 13px; border-radius: 50%;
  background: var(--online); border: 2px solid var(--panel);
}
.chat-item:hover .dot { border-color: var(--panel-2); }
.chat-item.active .dot { border-color: var(--accent); }

.profile-photo { display: flex; align-items: center; gap: 16px; }

.crop-frame {
  position: relative; width: 280px; height: 280px; margin: 0 auto; overflow: hidden;
  border-radius: 12px; background: #000; touch-action: none; cursor: grab; user-select: none;
}
.crop-frame:active { cursor: grabbing; }
.crop-frame img { position: absolute; left: 0; top: 0; max-width: none; transform-origin: 0 0; pointer-events: none; }
/* Everything outside the circle is dimmed: that part won't be in the avatar. */
.crop-frame::after {
  content: ''; position: absolute; inset: 0; border-radius: 50%; pointer-events: none;
  box-shadow: 0 0 0 200px rgba(0, 0, 0, .55); outline: 2px solid rgba(255, 255, 255, .85); outline-offset: -2px;
}
.crop-zoom { display: flex; align-items: center; gap: 10px; width: 280px; margin: 0 auto; font-size: 18px; }
.crop-zoom input { flex: 1; accent-color: var(--accent); }
.profile-photo .row-actions { flex-direction: column; align-items: flex-start; }

.chat-sub.typing, .chat-sub.online { color: var(--accent); }
.ci-preview.typing { color: var(--accent); }
.chat-item.active .ci-preview.typing { color: inherit; }

/* ---------- chat ---------- */
.chat { position: relative; min-width: 0; min-height: 0; background: var(--chat-bg); }
.chat-placeholder { height: 100%; display: grid; place-content: center; justify-items: center; gap: 8px; color: var(--muted); opacity: .9; }
.chat-view { display: flex; flex-direction: column; height: 100%; }

.chat-head {
  display: flex; align-items: center; gap: 10px; padding: 8px 12px; background: var(--panel);
  border-bottom: 1px solid var(--line); min-height: 60px;
}
.chat-head .back { display: none; }
.chat-title-btn { display: grid; text-align: left; border: 0; background: none; cursor: pointer; min-width: 0; padding: 2px 4px; }
.chat-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-sub { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.messages { flex: 1; overflow-y: auto; padding: 12px 16px 6px; overscroll-behavior: contain; }
#message-list { max-width: 820px; margin: 0 auto; display: flex; flex-direction: column; }
.load-more { text-align: center; font-size: 13px; padding: 6px; }

.day-sep { align-self: center; margin: 12px 0 8px; padding: 3px 12px; border-radius: 12px; font-size: 13px; background: var(--panel); color: var(--muted); }

.msg-row { display: flex; gap: 8px; align-items: flex-end; margin-top: 2px; }
.msg-row.first { margin-top: 10px; }
.msg-row.mine { flex-direction: row-reverse; }
.msg-row .avatar-slot { width: 30px; flex: none; }

.bubble {
  position: relative; max-width: min(520px, 78%); padding: 7px 10px 6px; border-radius: 14px;
  background: var(--theirs); box-shadow: 0 1px 1px rgba(0,0,0,.06); overflow-wrap: anywhere;
}
.mine .bubble { background: var(--mine); }
.bubble .sender { font-size: 13px; font-weight: 600; margin-bottom: 2px; }
.bubble .text { white-space: pre-wrap; }
.bubble .meta { float: right; margin: 6px 0 -2px 10px; font-size: 11px; color: var(--muted); display: flex; gap: 6px; align-items: center; }
.tick { display: inline-flex; align-items: center; }
.tick svg { width: 17px; height: 15px; stroke-width: 2.2; }
.tick.pending svg { width: 13px; height: 13px; stroke-width: 2; }
.tick.read { color: var(--tick-read); }
.ci-time { display: inline-flex; align-items: center; gap: 2px; }
.chat-item.active .tick.read { color: inherit; }
.bubble .act {
  border: 0; background: none; padding: 0; cursor: pointer; color: var(--muted); font-size: 11px; visibility: hidden;
}
.bubble:hover .act, .bubble:focus-within .act, .msg-row.show-actions .act { visibility: visible; }
.bubble .act:hover { color: var(--accent); }
.bubble .act.del:hover { color: var(--danger); }
.bubble .edited { font-style: italic; }

.edit-bar {
  display: flex; align-items: center; gap: 10px; padding: 6px 8px 6px 16px;
  background: var(--panel); border-top: 1px solid var(--line); color: var(--accent);
}
.edit-bar > svg { width: 20px; height: 20px; flex: none; }
.edit-info { flex: 1; min-width: 0; border-left: 2px solid var(--accent); padding-left: 8px; }
.edit-title { font-size: 13px; font-weight: 600; }
.edit-text { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.bubble.media { padding: 3px; }
.bubble.media .text, .bubble.media .sender { padding: 4px 7px 0; }
.bubble.media .meta { margin-right: 7px; }
.media-img {
  display: block; max-width: 100%; max-height: 420px; min-width: 120px; min-height: 80px;
  border-radius: 11px; cursor: zoom-in; background: var(--panel-2); object-fit: cover;
}
.media-audio { display: block; width: 280px; max-width: 100%; margin: 4px 0; }

.doc {
  display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; padding: 4px 2px; min-width: 220px;
}
.doc-icon {
  flex: none; width: 44px; height: 44px; border-radius: 10px; background: var(--accent); color: var(--accent-text);
  display: grid; place-items: center; font-size: 11px; font-weight: 800; letter-spacing: .3px; text-transform: uppercase;
}
.doc-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.doc-size { font-size: 13px; color: var(--muted); }
.doc:hover .doc-name { text-decoration: underline; }

/* pending upload */
.upload-card { min-width: 240px; }
.upload-card .doc-icon { background: var(--muted); }
.progress { height: 4px; border-radius: 2px; background: var(--line); margin-top: 6px; overflow: hidden; }
.progress > i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .15s; }
.upload-card .row { display: flex; align-items: center; gap: 10px; }
.upload-card .err { color: var(--danger); font-size: 13px; margin-top: 4px; }

/* staged files */
.staged {
  display: flex; gap: 8px; padding: 8px 12px; background: var(--panel); border-top: 1px solid var(--line);
  overflow-x: auto;
}
.stage-item {
  position: relative; flex: none; width: 84px; height: 84px; border-radius: 10px; overflow: hidden;
  background: var(--panel-2); display: grid; place-items: center; text-align: center; font-size: 11px;
}
.stage-item img, .stage-item video { width: 100%; height: 100%; object-fit: cover; }
.stage-item.previewable { cursor: zoom-in; }
.stage-item.previewable:hover { outline: 2px solid var(--accent); outline-offset: -2px; }
.stage-item .stage-doc { padding: 6px; overflow: hidden; word-break: break-all; max-height: 100%; }
.stage-item .stage-doc b { display: block; font-size: 13px; color: var(--accent); }
.stage-item .rm {
  position: absolute; top: 3px; right: 3px; width: 22px; height: 22px; border-radius: 50%; border: 0;
  background: rgba(0,0,0,.6); color: #fff; cursor: pointer; font-size: 14px; line-height: 1; display: grid; place-items: center;
}
.stage-item .vid-tag { position: absolute; left: 4px; bottom: 4px; background: rgba(0,0,0,.6); color: #fff; border-radius: 4px; padding: 0 4px; font-size: 10px; }

.composer {
  display: flex; align-items: flex-end; gap: 6px; padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
  background: var(--panel); border-top: 1px solid var(--line);
}
#msg-input {
  flex: 1; resize: none; border: 0; border-radius: 20px; padding: 9px 14px; background: var(--panel-2);
  max-height: 180px; min-height: 40px; line-height: 22px;
}
.send { color: var(--accent); }
.send:hover { color: var(--accent); background: var(--accent-soft); }

.drop-overlay {
  position: absolute; inset: 0; background: color-mix(in srgb, var(--accent) 18%, transparent);
  border: 3px dashed var(--accent); display: grid; place-items: center; font-size: 18px; font-weight: 600;
  color: var(--accent); pointer-events: none; z-index: 5;
}
.drop-overlay div { background: var(--panel); padding: 14px 22px; border-radius: 14px; box-shadow: var(--shadow); }

/* ---------- emoji ---------- */
.emoji, .emoji-tab, .bubble.jumbo .text { font-family: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif; }
.emoji-toggle.active { color: var(--accent); }

.emoji-panel {
  position: absolute; right: 12px; z-index: 6; width: 360px; max-width: calc(100% - 24px); height: 340px;
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow);
}
.emoji-tabs { display: flex; gap: 2px; padding: 6px; border-bottom: 1px solid var(--line); overflow-x: auto; flex: none; }
.emoji-tab {
  flex: none; width: 36px; height: 32px; border: 0; border-radius: 8px; background: none;
  font-size: 19px; cursor: pointer; opacity: .55;
}
.emoji-tab:hover, .emoji-tab.active { background: var(--panel-2); opacity: 1; }
.emoji-grid { position: relative; flex: 1; overflow-y: auto; padding: 0 8px 8px; overscroll-behavior: contain; }
.emoji-title {
  position: sticky; top: 0; z-index: 1; padding: 8px 4px 4px;
  background: var(--panel); color: var(--muted); font-size: 12px;
}
.emoji-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(38px, 1fr)); }
.emoji { height: 40px; padding: 0; border: 0; border-radius: 8px; background: none; font-size: 24px; line-height: 1; cursor: pointer; }
.emoji:hover { background: var(--panel-2); }

.bubble.jumbo { background: transparent; box-shadow: none; padding: 0 2px; }
.bubble.jumbo .text { font-size: 42px; line-height: 1.15; }
.bubble.jumbo .meta { margin-top: 22px; }

/* ---------- modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 20; background: rgba(10, 15, 25, .5);
  display: grid; place-items: center; padding: 16px;
}
.modal {
  width: 100%; max-width: 460px; max-height: calc(100dvh - 32px); display: flex; flex-direction: column;
  background: var(--panel); border-radius: 16px; box-shadow: var(--shadow);
}
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 10px 4px 20px; }
.modal-head h2 { margin: 0; font-size: 18px; }
.modal-body { padding: 8px 20px 20px; overflow-y: auto; display: grid; gap: 12px; }
.modal-body p { margin: 0; }

.user-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; max-height: 340px; overflow-y: auto; }
.user-item { display: flex; gap: 10px; align-items: center; padding: 7px 8px; border-radius: 10px; cursor: pointer; }
.user-item:hover { background: var(--panel-2); }
.user-item .u-body { flex: 1; min-width: 0; }
.user-item .u-name { font-weight: 600; }
.user-item .u-sub { font-size: 13px; color: var(--muted); }
.user-item input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--accent); }

.invite-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.invite-item { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; display: grid; gap: 6px; }
.invite-code { font: 600 16px/1.2 ui-monospace, "Cascadia Code", Consolas, monospace; letter-spacing: 1px; }
.invite-item .row { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.invite-item .status { font-size: 13px; color: var(--muted); flex: 1; }
.invite-item.used, .invite-item.expired { opacity: .65; }

.row-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.switch-row { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
.switch-row input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--accent); flex: none; }
.switch-row small { display: block; font-size: 12px; margin-top: 2px; }
.seg { display: flex; background: var(--panel-2); border-radius: 10px; padding: 3px; }

/* ---------- media viewer ---------- */
.viewer {
  position: fixed; inset: 0; z-index: 30; display: grid; grid-template-rows: auto 1fr auto;
  background: rgba(0, 0, 0, .94); color: #fff;
}
.viewer-top {
  display: flex; align-items: center; gap: 6px; z-index: 2;
  padding: calc(8px + env(safe-area-inset-top)) 8px 8px 16px;
}
.viewer-who { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.viewer-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.viewer-date { font-size: 13px; opacity: .65; }
.viewer-count { font-size: 14px; opacity: .75; margin-right: 6px; white-space: nowrap; }
.viewer .icon-btn { color: #fff; }
.viewer .icon-btn:hover { background: rgba(255, 255, 255, .12); color: #fff; }

.viewer-stage { position: relative; min-height: 0; overflow: hidden; display: grid; place-items: center; touch-action: none; user-select: none; }
.viewer-media {
  max-width: 100%; max-height: 100%; object-fit: contain;
  transform-origin: center; transition: transform .18s ease-out;
}
.viewer.dragging .viewer-media { transition: none; }
img.viewer-media { cursor: zoom-in; -webkit-user-drag: none; }
.viewer.zoomed img.viewer-media { cursor: grab; }
.viewer.dragging.zoomed img.viewer-media { cursor: grabbing; }
video.viewer-media { background: #000; }

.viewer-nav {
  position: absolute; top: 50%; translate: 0 -50%; z-index: 2; width: 64px; height: 120px;
  border: 0; background: none; color: #fff; opacity: .55; cursor: pointer;
}
.viewer-nav:hover { opacity: 1; }
.viewer-nav svg { width: 40px; height: 40px; }
.viewer-nav.prev { left: 4px; }
.viewer-nav.next { right: 4px; }
.viewer-caption {
  z-index: 2; max-height: 30vh; overflow-y: auto; white-space: pre-wrap; overflow-wrap: anywhere; text-align: center;
  padding: 10px 16px calc(14px + env(safe-area-inset-bottom));
}
@media (hover: none) { .viewer-nav { display: none; } }

/* video in a chat: still frame + play button; it plays in the viewer */
.video-thumb { position: relative; cursor: pointer; }
.video-thumb video { display: block; width: 100%; max-height: 440px; border-radius: 11px; background: #000; pointer-events: none; }
.play-btn {
  position: absolute; inset: 0; margin: auto; width: 56px; height: 56px; border-radius: 50%;
  display: grid; place-items: center; background: rgba(0, 0, 0, .55); color: #fff;
}
.play-btn svg { width: 26px; height: 26px; fill: currentColor; stroke: none; margin-left: 3px; }
.video-thumb:hover .play-btn { background: rgba(0, 0, 0, .7); }
.media-badge {
  position: absolute; left: 8px; top: 8px; padding: 1px 7px; border-radius: 9px;
  background: rgba(0, 0, 0, .55); color: #fff; font-size: 12px;
}

.toast {
  position: fixed; left: 50%; bottom: 24px; translate: -50% 0; z-index: 40; background: var(--text); color: var(--panel);
  padding: 10px 16px; border-radius: 10px; box-shadow: var(--shadow); max-width: calc(100% - 32px);
}

/* ---------- mobile ---------- */
@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; }
  .chat { display: none; }
  .app.show-chat .sidebar { display: none; }
  .app.show-chat .chat { display: block; }
  .chat-head .back { display: inline-grid; }
  .messages { padding: 10px 8px 6px; }
  .bubble { max-width: 86%; }
  .msg-row .avatar-slot { display: none; }
  .emoji-panel { left: 8px; right: 8px; width: auto; max-width: none; height: 300px; }
}
