/* Niko Kadi chat — messenger layout, tuned to the app's paper/cream theme.
   Signal: circle ticks, tail-less grouped bubbles, unread badge.  Instagram: story-ring tray, gradient sent bubbles,
   double-tap heart, swipe-to-reply, floating reaction bar.  Every colour comes from the theme tokens in base.css
   (--surface, --accent, --green, --felt …) so all themes and light/dark modes work. */

/* =====================================================================
   Chats list
   ===================================================================== */
.chat-page {
  --ring: conic-gradient(from 210deg, var(--gold), var(--green), var(--accent), var(--gold));
  --tick-cut: var(--bg);
  flex: 1; min-height: 0; position: relative; display: flex; flex-direction: column; color: var(--text);
}

.chat-top { flex: none; display: flex; align-items: center; gap: 4px; padding: calc(var(--safe-t) + 8px) 12px 4px 6px; }
.chat-top .icon-btn { color: var(--ink); width: 42px; height: 42px; border-radius: 50%; }
.chat-top .icon-btn:active { background: #8080801f; }
.chat-top h1 { flex: 1; min-width: 0; font: 700 30px/1.1 var(--sans); letter-spacing: .2px; color: var(--ink); }

.chat-tools { flex: none; padding: 6px 16px 4px; }
.chat-search {
  display: flex; align-items: center; gap: 10px; height: 44px; padding: 0 14px; border-radius: 22px;
  background: var(--surface); border: 1px solid var(--line); color: var(--muted);
}
.chat-search .ic { width: 18px; height: 18px; flex: none; }
.chat-search input {
  flex: 1; min-width: 0; border: 0; background: none; outline: 0; color: var(--text);
  font: 500 16px var(--sans); -webkit-user-select: text; user-select: text;
}
.chat-search input::placeholder { color: var(--muted); }
.chat-search button { width: 24px; height: 24px; color: var(--muted); }
.chat-search:focus-within { border-color: var(--accent); }

.chat-chips { display: flex; gap: 8px; margin-top: 10px; overflow-x: auto; scrollbar-width: none; }
.chat-chips::-webkit-scrollbar { display: none; }
.chat-chips button {
  flex: none; padding: 7px 15px; border-radius: 18px; font: 700 13.5px var(--sans);
  background: var(--surface); color: var(--muted); border: 1px solid var(--line);
}
.chat-chips button.on { background: var(--accent); border-color: var(--accent); color: #fff; }

/* Story-ring friends tray (Instagram) */
.stories { flex: none; display: flex; gap: 14px; overflow-x: auto; padding: 12px 16px 6px; scrollbar-width: none; }
.stories::-webkit-scrollbar { display: none; }
.stories[hidden] { display: none; }
.story { flex: none; width: 62px; display: flex; flex-direction: column; align-items: center; gap: 5px; }
.story:active { transform: scale(.95); }
.story-av { position: relative; width: 62px; height: 62px; border-radius: 50%; display: grid; place-items: center; line-height: 0; }
.story-av.ring { background: var(--line); padding: 3px; }
.story.has-unread .story-av.ring, .story-av.ring:has(.online-dot) { background: var(--ring); }
.story-av .avatar { border-radius: 50%; box-shadow: 0 0 0 2.5px var(--bg); }
.story-new .story-av { border: 2px dashed var(--neutral); color: var(--accent-d); }
.story-new .plus { width: 26px; height: 26px; display: grid; }
.story-new .plus svg { fill: currentColor; }
.story-name { max-width: 62px; font: 600 12px var(--sans); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---- Rows ---- */
.chat-list { flex: 1; min-height: 0; overflow-y: auto; padding: 6px 0 96px; }
.chat-row { display: flex; align-items: center; gap: 12px; width: 100%; padding: 9px 16px; text-align: left; border: 0; transition: background .12s; }
.chat-row:active { background: #8080801c; }
.chat-av { position: relative; flex: none; padding: 3px; border-radius: 50%; line-height: 0; display: inline-block; }
.chat-av .avatar { border-radius: 50%; box-shadow: 0 0 0 2px var(--bg); }
.chat-row.has-unread .chat-av { background: var(--ring); }
.online-dot {
  position: absolute; right: 1px; bottom: 1px; width: 13px; height: 13px; border-radius: 50%;
  background: #2bc46f; border: 2.5px solid var(--bg);
}

.chat-meta { flex: 1; min-width: 0; display: block; }
.chat-meta .top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.chat-meta .name-wrap { display: flex; align-items: center; gap: 5px; min-width: 0; flex: 1; }
.chat-meta .top b { font: 700 16.5px/1.25 var(--sans); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink); }
.verified-ic { flex: none; width: 15px; height: 15px; color: var(--accent); display: inline-flex; }
.verified-ic svg, .muted-ic svg { width: 100%; height: 100%; display: block; }
.muted-ic { flex: none; width: 14px; height: 14px; opacity: .55; display: inline-flex; }
.chat-meta .top time { font: 500 12.5px var(--sans); color: var(--muted); flex: none; }
.chat-row.has-unread .chat-meta .top time { font-weight: 800; color: var(--accent-d); }
body[data-mode="dark"] .chat-row.has-unread .chat-meta .top time { color: var(--accent); }

.chat-meta .bot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 2px; }
.chat-meta .prev { flex: 1; min-width: 0; display: flex; align-items: center; gap: 5px; font: 500 14.5px/1.3 var(--sans); color: var(--muted); }
.chat-meta .prev > span:last-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-row.has-unread .chat-meta .prev { font-weight: 700; color: var(--text); }
.chat-meta .prev.typing { color: var(--green); font-weight: 700; }
.chat-unread {
  flex: none; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px;
  background: var(--accent); color: #fff; font: 800 12px/22px var(--sans); text-align: center;
}

.sig-tick { display: inline-flex; align-items: center; flex: none; opacity: .8; }
.sig-tick svg { width: 19px; height: 13px; display: block; }
.sig-tick.read { opacity: 1; }
.sig-tick.failed { color: var(--danger); font-size: 13px; font-weight: 900; }
.chat-row .sig-tick { color: var(--muted); }
.chat-row .sig-tick.read { color: var(--accent-d); }
body[data-mode="dark"] .chat-row .sig-tick.read { color: var(--accent); }

.chat-fab {
  position: absolute; right: 18px; bottom: calc(18px + var(--safe-b)); z-index: 6;
  width: 58px; height: 58px; border-radius: 18px; color: #fff; display: grid; place-items: center;
  background: linear-gradient(145deg, var(--accent), var(--accent-d));
  box-shadow: 0 5px 0 var(--accent-d), 0 10px 20px var(--shadow);
}
.chat-fab:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--accent-d), 0 4px 10px var(--shadow); }
.chat-fab svg { width: 24px; height: 24px; fill: currentColor; }

/* =====================================================================
   Thread
   ===================================================================== */
.chat-thread {
  /* default wallpaper = parlour paper with a faint card-suit doodle */
  --doodle: var(--doodle-ink);
  --t-fg: var(--text); --t-mute: var(--muted);
  --t-bar: color-mix(in srgb, var(--surface) 94%, transparent); --t-bar-line: var(--line);
  --t-chip-bg: color-mix(in srgb, var(--surface) 86%, transparent); --t-chip-fg: var(--muted);
  --in-bg: var(--surface); --in-fg: var(--text);
  --out-a: var(--accent); --out-b: var(--accent-d); --out-fg: #fff;
  --accent-t: var(--accent-d);
  --tick-cut: color-mix(in srgb, var(--out-a) 45%, var(--out-b));
  --doodle-ink: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='150' height='150' fill='%2332281e' fill-opacity='.075' font-family='Georgia,serif'%3E%3Ctext x='14' y='34' font-size='22'%3E%E2%99%A0%3C/text%3E%3Ctext x='86' y='26' font-size='17' transform='rotate(14 86 26)'%3E%E2%99%A5%3C/text%3E%3Ctext x='112' y='84' font-size='24' font-weight='700' transform='rotate(-12 112 84)'%3EA%3C/text%3E%3Ctext x='24' y='100' font-size='19' transform='rotate(-10 24 100)'%3E%E2%99%A6%3C/text%3E%3Ctext x='70' y='132' font-size='22'%3E%E2%99%A3%3C/text%3E%3Ctext x='62' y='72' font-size='13' font-weight='700' transform='rotate(8 62 72)'%3EK%3C/text%3E%3Ccircle cx='128' cy='24' r='2.2'/%3E%3Ccircle cx='8' cy='140' r='2.2'/%3E%3Ccircle cx='140' cy='132' r='1.8'/%3E%3C/svg%3E");
  --doodle-light: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='150' height='150' fill='%23ffffff' fill-opacity='.07' font-family='Georgia,serif'%3E%3Ctext x='14' y='34' font-size='22'%3E%E2%99%A0%3C/text%3E%3Ctext x='86' y='26' font-size='17' transform='rotate(14 86 26)'%3E%E2%99%A5%3C/text%3E%3Ctext x='112' y='84' font-size='24' font-weight='700' transform='rotate(-12 112 84)'%3EA%3C/text%3E%3Ctext x='24' y='100' font-size='19' transform='rotate(-10 24 100)'%3E%E2%99%A6%3C/text%3E%3Ctext x='70' y='132' font-size='22'%3E%E2%99%A3%3C/text%3E%3Ctext x='62' y='72' font-size='13' font-weight='700' transform='rotate(8 62 72)'%3EK%3C/text%3E%3Ccircle cx='128' cy='24' r='2.2'/%3E%3Ccircle cx='8' cy='140' r='2.2'/%3E%3Ccircle cx='140' cy='132' r='1.8'/%3E%3C/svg%3E");
  flex: 1; min-height: 0; position: relative; display: flex; flex-direction: column; color: var(--t-fg);
  background-color: color-mix(in srgb, var(--bg) 55%, var(--tint));
}
body[data-mode="dark"] .chat-thread { --doodle: none; --accent-t: var(--accent); background-color: var(--bg); }
body[data-mode="dark"] .chat-fab { box-shadow: none; }
body[data-mode="dark"] .chat-fab:active { box-shadow: none; }
body[data-mode="dark"] .send-btn, body[data-mode="dark"] .send-btn:active { box-shadow: none; }

/* Table-inspired wallpapers: felt, wood, night. Cream bubbles and composer stay readable on all of them. */
.chat-thread[data-wall="felt"], .chat-thread[data-wall="wood"], .chat-thread[data-wall="night"] {
  --doodle: var(--doodle-light);
  --t-fg: #fff; --t-mute: #ffffffb8;
  --t-bar: #07110d80; --t-bar-line: #ffffff1a;
  --t-chip-bg: #07110d73; --t-chip-fg: #f1ebd9;
  --accent-t: var(--accent);
}
.chat-thread[data-wall="felt"] { background: radial-gradient(ellipse at 50% 30%, var(--felt) 0%, var(--felt-d) 100%); }
.chat-thread[data-wall="wood"] { background: linear-gradient(#00000030, #00000066), url("../img/wood.webp") center / cover; }
.chat-thread[data-wall="night"] { background: linear-gradient(160deg, #1f2b44 0%, #0d1420 100%); }
.chat-thread > * { position: relative; z-index: 1; }

/* ---- Header ---- */
.thread-top {
  flex: none; display: flex; align-items: center; gap: 4px; padding: calc(var(--safe-t) + 6px) 6px 6px 2px;
  background: var(--t-bar); border-bottom: 1px solid var(--t-bar-line);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
}
.thread-top .icon-btn { color: inherit; width: 40px; height: 40px; border-radius: 50%; }
.thread-top .icon-btn:active { background: #8080802a; }
.chat-peer { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; text-align: left; }
.chat-peer .chat-av { padding: 2.5px; }
.chat-peer .chat-av .avatar { box-shadow: 0 0 0 2px transparent; }
.chat-peer .chat-av.live { background: var(--ring, conic-gradient(from 210deg, var(--gold), var(--green), var(--accent), var(--gold))); }
.chat-peer .chat-av.live .avatar { box-shadow: 0 0 0 2px var(--surface); }
.chat-peer .nm { display: block; min-width: 0; flex: 1; }
.chat-peer .nm-row { display: flex; align-items: center; gap: 5px; }
.chat-peer b { display: block; font: 700 16.5px/1.2 var(--sans); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-peer small { display: block; font: 500 12.5px/1.25 var(--sans); color: var(--t-mute); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-peer small.online { color: #2bc46f; }
.chat-peer small.typing { color: var(--accent-t); font-weight: 700; }
.chat-thread[data-wall="felt"] .chat-peer small.typing, .chat-thread[data-wall="wood"] .chat-peer small.typing,
.chat-thread[data-wall="night"] .chat-peer small.typing { color: #bfe0ff; }

/* ---- Messages ---- */
.thread-canvas { flex: 1; min-height: 0; position: relative; display: flex; flex-direction: column; }
.chat-wall {
  flex: 1; min-height: 0; overflow-y: auto; padding: 8px 12px 14px; display: flex; flex-direction: column;
  background-image: var(--doodle); background-size: 150px 150px; background-attachment: local;
}
.chat-day {
  align-self: center; margin: 14px 0 8px; padding: 4px 12px; border-radius: 12px;
  background: var(--t-chip-bg); color: var(--t-chip-fg); font: 700 12px/1.3 var(--sans);
}
.chat-sys {
  align-self: center; max-width: 86%; margin: 8px 0; padding: 5px 12px; border-radius: 12px;
  background: var(--t-chip-bg); color: var(--t-chip-fg); font: 500 12.5px/1.4 var(--sans); text-align: center;
}
.chat-wall .empty-note { margin: auto; padding: 12px 18px; border-radius: 14px; background: var(--t-chip-bg); color: var(--t-chip-fg); text-align: center; }

.msg-row { display: flex; flex-direction: column; max-width: 82%; position: relative; margin-top: 2px; touch-action: pan-y; }
.msg-row.in { align-self: flex-start; align-items: flex-start; }
.msg-row.out { align-self: flex-end; align-items: flex-end; }
.msg-row.g-single, .msg-row.g-start { margin-top: 10px; }

.bubble-wrapper { position: relative; transform: translateX(var(--sx, 0)); transition: transform .18s ease-out; }
.msg-row.swiping .bubble-wrapper { transition: none; }
.swipe-ic {
  position: absolute; left: -38px; top: 50%; width: 28px; height: 28px; margin-top: -14px; border-radius: 50%;
  display: grid; place-items: center; background: var(--t-chip-bg); color: var(--t-chip-fg);
  opacity: var(--sp, 0); transform: scale(calc(.5 + var(--sp, 0) * .5)); pointer-events: none;
}
.swipe-ic svg { width: 16px; height: 16px; fill: currentColor; }

.bubble {
  position: relative; padding: 8px 13px 7px; border-radius: 21px; cursor: pointer; word-break: break-word;
  -webkit-user-select: text; user-select: text;
}
.msg-row.in .bubble { background: var(--in-bg); color: var(--in-fg); --tick-cut: var(--in-bg); box-shadow: 0 1px 2px var(--shadow); }
/* Sent bubbles: theme accent with a soft gradient (Instagram) */
.msg-row.out .bubble { background: linear-gradient(135deg, var(--out-a) 0%, var(--out-b) 100%); color: var(--out-fg); box-shadow: 0 1px 2px var(--shadow); }

/* Signal-style grouped corners: no tails */
.msg-row.out.g-start .bubble { border-bottom-right-radius: 6px; }
.msg-row.out.g-mid .bubble { border-top-right-radius: 6px; border-bottom-right-radius: 6px; }
.msg-row.out.g-end .bubble { border-top-right-radius: 6px; }
.msg-row.in.g-start .bubble { border-bottom-left-radius: 6px; }
.msg-row.in.g-mid .bubble { border-top-left-radius: 6px; border-bottom-left-radius: 6px; }
.msg-row.in.g-end .bubble { border-top-left-radius: 6px; }

/* Emoji-only messages float without a bubble */
.bubble.big { background: none !important; box-shadow: none !important; padding: 0 2px; color: var(--t-fg); }
.bubble.big .msg-text { font-size: 44px; line-height: 1.15; }
.bubble.big .msg-foot { color: var(--t-mute); }
.bubble.big .sig-tick { color: var(--t-mute); }

.reply-box {
  margin: -2px -5px 6px; padding: 6px 10px; border-radius: 12px; border-left: 4px solid var(--green);
  background: #0000000f; font-size: 13px; cursor: pointer;
}
.msg-row.out .reply-box { border-left-color: #ffffffd0; background: #ffffff26; }
.reply-box b { display: block; font: 700 12.5px var(--sans); }
.reply-box span { display: block; opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 210px; }

.msg-line { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 4px 8px; }
.msg-text { font: 400 16px/1.35 var(--sans); white-space: pre-wrap; }
.msg-text.del { font-style: italic; opacity: .7; }
.msg-foot { margin-left: auto; display: inline-flex; align-items: center; gap: 4px; font: 500 11px/1 var(--sans); opacity: .78; padding-bottom: 1px; }
.msg-row.in .msg-foot { color: var(--muted); opacity: 1; }
.bubble .sig-tick { opacity: .92; color: inherit; }

.bubble.flash { animation: flashb 1.2s ease-out; }
@keyframes flashb { 0%, 35% { outline: 3px solid var(--gold); outline-offset: 2px; } 100% { outline: 3px solid transparent; outline-offset: 2px; } }

/* Reactions: small pill hugging the bubble's lower edge, cut out against the wallpaper */
.reacts {
  display: inline-flex; gap: 3px; margin-top: -9px; margin-bottom: 4px; z-index: 2; padding: 2px 8px; border-radius: 13px;
  background: var(--surface); color: var(--text); border: 2px solid var(--bg); font-size: 13px; box-shadow: 0 1px 4px var(--shadow);
}
.msg-row.out .reacts { margin-right: 10px; }
.msg-row.in .reacts { margin-left: 10px; }
.reacts.pop { animation: heartpop .4s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes heartpop { 0% { transform: scale(.3); } 100% { transform: scale(1); } }

/* Voice notes */
.voice { display: flex; align-items: center; gap: 8px; min-width: 200px; padding: 2px 0 6px; }
.v-play { flex: none; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: #00000024; color: inherit; }
.msg-row.in .v-play { background: color-mix(in srgb, var(--accent) 20%, transparent); color: var(--accent-d); }
body[data-mode="dark"] .msg-row.in .v-play { color: var(--accent); }
.v-play svg { width: 20px; height: 20px; fill: currentColor; }
.voice .wave { flex: 1; display: flex; align-items: center; gap: 2px; height: 28px; }
.voice .wave i { width: 3px; border-radius: 2px; background: currentColor; opacity: .38; transition: opacity .1s; }
.voice .wave i.done { opacity: 1; }
.v-dur { font: 600 11.5px var(--sans); opacity: .8; min-width: 28px; text-align: right; }

/* Game invite: a little felt table card */
.invite-card {
  margin: 2px 0 5px; padding: 11px 12px; border-radius: 15px; min-width: 214px; color: #fff;
  background: radial-gradient(ellipse at 30% 0%, var(--felt) 0%, var(--felt-d) 100%);
  border: 1px solid #ffffff2b; box-shadow: inset 0 0 0 3px #0000001f;
}
.invite-card .itop { display: flex; align-items: center; gap: 10px; }
.invite-card .ic { font-size: 28px; color: var(--gold); }
.invite-card b { display: block; font: 700 15px var(--sans); }
.invite-card small { display: block; font-size: 12px; opacity: .85; }
.invite-card .join-btn {
  margin-top: 9px; width: 100%; height: 36px; border-radius: 18px; background: var(--cream); color: var(--felt-d); font: 800 14px var(--sans);
}
.invite-card .join-btn:active { opacity: .85; }

.typing-dots { display: inline-flex; gap: 4px; padding: 6px 3px; align-items: center; }
.typing-dots i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: .45; animation: tdot 1.1s infinite ease-in-out; }
.typing-dots i:nth-child(2) { animation-delay: .18s; }
.typing-dots i:nth-child(3) { animation-delay: .36s; }
@keyframes tdot { 0%, 60%, 100% { transform: translateY(0); opacity: .4; } 30% { transform: translateY(-4px); opacity: 1; } }

.to-bottom {
  position: absolute; right: 14px; bottom: 12px; width: 40px; height: 40px; border-radius: 50%; z-index: 4;
  background: var(--surface); color: var(--text); display: grid; place-items: center; box-shadow: 0 3px 10px var(--shadow); border: 1px solid var(--line);
}
.to-bottom[hidden] { display: none; }
.to-bottom svg { width: 22px; height: 22px; }

/* ---- Composer ---- */
.reply-bar {
  flex: none; display: flex; align-items: center; gap: 8px; margin: 0 10px; padding: 8px 8px 8px 12px; border-radius: 16px 16px 0 0;
  background: var(--surface); color: var(--text); border: 1px solid var(--line); border-bottom: 0;
}
.reply-bar[hidden] { display: none; }
.reply-bar .rline { flex: 1; min-width: 0; border-left: 4px solid var(--green); padding-left: 9px; }
.reply-bar b { display: block; font: 700 12.5px var(--sans); color: var(--green-d); }
.reply-bar span { display: block; font-size: 13.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.reply-bar button { width: 30px; height: 30px; display: grid; place-items: center; opacity: .7; }
.reply-bar button svg { width: 16px; height: 16px; }

.emoji-tray { flex: none; padding: 10px 12px; background: var(--t-bar); color: var(--t-fg); border-top: 1px solid var(--t-bar-line); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.emoji-tray[hidden] { display: none; }
.emoji-grid { display: flex; flex-wrap: wrap; gap: 4px; }
.emoji-grid button { font-size: 22px; width: 38px; height: 36px; border-radius: 10px; }
.emoji-grid button:active { background: #80808033; }
.quick-row { display: flex; gap: 6px; overflow-x: auto; margin-top: 8px; padding-bottom: 2px; scrollbar-width: none; }
.quick-row button { flex: none; padding: 6px 12px; border-radius: 15px; background: var(--surface); color: var(--text); border: 1px solid var(--line); font: 700 12.5px var(--sans); }

.chat-comp { flex: none; display: flex; align-items: flex-end; gap: 8px; padding: 8px 10px calc(10px + var(--safe-b)); }
.chat-box {
  flex: 1; min-width: 0; position: relative; display: flex; align-items: flex-end; gap: 2px; padding: 3px 6px;
  background: var(--surface); color: var(--text); border: 1px solid var(--line); border-radius: 24px; transition: border-color .15s;
}
.chat-box:focus-within { border-color: var(--accent); }
.reply-bar:not([hidden]) + .emoji-tray + .chat-comp .chat-box, .reply-bar:not([hidden]) + .chat-comp .chat-box { border-top-left-radius: 0; border-top-right-radius: 0; }
.chat-box > button { width: 38px; height: 38px; flex: none; display: grid; place-items: center; color: var(--muted); font-size: 22px; border-radius: 50%; }
.chat-box > button:active { background: #80808022; }
.chat-box > button svg { width: 24px; height: 24px; }
.chat-box textarea {
  flex: 1; min-width: 0; max-height: 100px; border: 0; background: none; resize: none; outline: 0; color: inherit;
  font: 400 16px/1.35 var(--sans); padding: 9px 2px; -webkit-user-select: text; user-select: text;
}
.chat-box textarea::placeholder { color: var(--muted); }

/* Send / mic button: mic while empty (voice note), arrow once there is text */
.send-btn {
  width: 46px; height: 46px; flex: none; border-radius: 50%; color: #fff; display: grid; place-items: center;
  background: linear-gradient(145deg, var(--accent), var(--accent-d)); box-shadow: 0 3px 0 var(--accent-d);
}
.send-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--accent-d); }
.send-btn span { grid-area: 1 / 1; display: grid; }
.send-btn svg { width: 22px; height: 22px; fill: currentColor; }
.send-btn .i-send { display: none; }
.chat-comp.typed .send-btn .i-send { display: grid; }
.chat-comp.typed .send-btn .i-mic { display: none; }
.chat-comp.recording .send-btn { background: linear-gradient(145deg, var(--danger), var(--danger-d)); box-shadow: 0 3px 0 var(--danger-d); animation: recpulse 1.1s infinite; }
.chat-comp.recording .send-btn .i-send { display: grid; }
.chat-comp.recording .send-btn .i-mic { display: none; }
@keyframes recpulse { 50% { filter: brightness(1.12); } }

/* Recording state replaces the text field */
.rec-ui { position: absolute; inset: 0; display: flex; align-items: center; gap: 10px; padding: 0 14px 0 6px; border-radius: 24px; background: var(--surface); font: 700 15px var(--sans); }
.rec-ui[hidden] { display: none; }
.rec-ui button { width: 38px; height: 38px; display: grid; place-items: center; color: var(--danger); border-radius: 50%; }
.rec-ui button svg { width: 22px; height: 22px; }
.rec-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--danger); animation: recblink 1s infinite; }
@keyframes recblink { 50% { opacity: .25; } }
.rec-hint { margin-left: auto; font-weight: 600; font-size: 13px; color: var(--muted); }

/* =====================================================================
   Sheets (reaction bar + wallpaper picker)
   ===================================================================== */
.react-bar { display: flex; justify-content: space-between; gap: 4px; padding: 6px 8px; background: var(--surface2); border-radius: 30px; margin-bottom: 10px; box-shadow: inset 0 0 0 1px var(--line); }
.react-bar button { font-size: 26px; width: 44px; height: 44px; border-radius: 50%; transition: transform .12s; }
.react-bar button:active { transform: scale(1.25); background: #80808022; }

.walls { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 8px; }
.walls button { display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 5px; border-radius: 12px; background: var(--surface2); font: 700 11.5px var(--sans); }
.walls button.on { box-shadow: inset 0 0 0 2.5px var(--accent); }
.walls i { width: 100%; height: 42px; border-radius: 8px; display: block; border: 1px solid #0002; }

/* Emoji-only messages have no bubble behind them: draw the read ticks as plain rings */
.bubble.big .sig-tick.read circle { fill: none !important; stroke: currentColor; stroke-width: 1.3; opacity: 1; }
.bubble.big .sig-tick.read path { stroke: currentColor !important; }
