/* Chats: the list, the talk, and what opens over it. The colours are those of
   the mail; only the paper and the bubbles have their own. */

:root {
  --bubble: #ffffff;
  --bubble-own: #d8f0e9;
  --bubble-own-text: #3f857b;
  --paper: linear-gradient(160deg, #d5e4df, #c9dcd9 45%, #dfe5d8);
  --paper-ink: #0f6e66;
  --paper-force: 0.13;
  --pill: rgb(30 62 58 / 0.42);
  --shade: 0 1px 2px rgb(16 40 37 / 0.14);
}
:root[data-theme='dark'], :root[data-theme='system'] {
  --bubble: #1b2423;
  --bubble-own: #1c4a44;
  --bubble-own-text: #86c9bd;
  --paper: linear-gradient(160deg, #0a1110, #0c1615 45%, #0b1212);
  --paper-ink: #43c0ae;
  --paper-force: 0.09;
  --pill: rgb(20 34 32 / 0.82);
  --shade: 0 1px 2px rgb(0 0 0 / 0.3);
}
@media (prefers-color-scheme: light) {
  :root[data-theme='system'] {
    --bubble: #ffffff;
    --bubble-own: #d8f0e9;
    --bubble-own-text: #3f857b;
    --paper: linear-gradient(160deg, #d5e4df, #c9dcd9 45%, #dfe5d8);
    --paper-ink: #0f6e66;
    --paper-force: 0.13;
    --pill: rgb(30 62 58 / 0.42);
    --shade: 0 1px 2px rgb(16 40 37 / 0.14);
  }
}

/* --- The window -------------------------------------------------------- */

#chats.composer { padding: 0; inset: auto 0; top: var(--from, 0); height: var(--high, 100dvh); }
/* Safari's keyboard and buttons are half transparent, and its bars take the colour of what is
   fixed beneath them: neither the mail nor its shade must show through. */
#chats.composer { background: var(--surface); }
#chats.composer::after { content: ''; position: absolute; inset: 100% 0 auto; height: 100vh; background: var(--surface); }
.composer-card.chats-card {
  width: 100%;
  height: 100%;
  max-height: none;
  border-radius: 0;
  padding-bottom: 0;
  background: var(--surface);
}
.chats-card .pane-head { flex: none; }
.chats-gate {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  width: min(26rem, 100%);
  margin: auto;
  padding: 1.5rem;
  text-align: center;
  color: var(--text-secondary);
}
.chats-gate p { margin: 0; }
.chats-gate form, .chats-gate form > div { display: flex; flex-direction: column; gap: 0.6rem; }
.chats-gate input, .start-fields input, .talk-invite input {
  width: 100%;
  padding: 0.7rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.chats-gate input:focus, .start-fields input:focus, .talk-invite input:focus { border-color: var(--accent); }
.chats-gate button { min-height: 2.75rem; }

.ci {
  display: block;
  width: 1.5rem;
  height: 1.5rem;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.ci.dots { fill: currentColor; stroke: none; }
.chat-icon { display: block; width: 1.5rem; height: 1.5rem; fill: currentColor; }
.round {
  position: relative;
  flex: none;
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  border-radius: 50%;
  color: var(--text-secondary);
  -webkit-tap-highlight-color: transparent;
}
.round.danger { color: var(--danger); }
@media (hover: hover) { .round:hover { background: var(--surface-subtle); } }
.pill {
  padding: 0.15rem 0.7rem;
  border-radius: 1rem;
  background: var(--pill);
  color: #fff;
  font-size: 0.89rem;
  font-weight: 500;
}

/* --- The list ---------------------------------------------------------- */

.chats-panes {
  position: relative;
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: clamp(19rem, 27vw, 25rem) minmax(0, 1fr);
}
.chats-side {
  position: relative;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
  background: var(--surface);
}
.side-head { flex: none; display: flex; align-items: center; gap: 0.3rem; min-height: 3.5rem; padding: 0.35rem 0.5rem; }
.side-head h3 { flex: 1; margin: 0 0.5rem; font-size: 1.12rem; font-weight: 600; }
.side-find {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  height: 2.6rem;
  padding: 0 0.8rem;
  border: 2px solid transparent;
  border-radius: 1.3rem;
  background: var(--surface-subtle);
  color: var(--text-tertiary);
}
.side-find:focus-within { border-color: var(--accent); background: var(--surface); color: var(--accent); }
.side-find .ci { width: 1.2rem; height: 1.2rem; }
.side-find input {
  flex: 1;
  min-width: 0;
  padding: 0;
  border: 0;
  background: none;
  color: var(--text);
  font-size: 1rem;
  -webkit-appearance: none;
  appearance: none;
}
.chats-tabs {
  flex: none;
  display: flex;
  gap: 0.3rem;
  padding: 0 0.6rem;
  overflow-x: auto;
  scrollbar-width: none;
  border-bottom: 1px solid var(--border);
}
.chats-tabs button, .more-tabs button {
  position: relative;
  flex: none;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 2.75rem;
  padding: 0 0.7rem;
  border-radius: 0;
  font-size: 0.98rem;
  font-weight: 500;
  color: var(--text-secondary);
}
.chats-tabs .on, .more-tabs .on { color: var(--accent); }
.chats-tabs .on::after, .more-tabs .on::after {
  content: '';
  position: absolute;
  inset: auto 0.5rem 0;
  height: 3px;
  border-radius: 3px 3px 0 0;
  background: var(--accent);
}
.tab-count {
  min-width: 1.25rem;
  padding: 0 0.3rem;
  border-radius: 1rem;
  background: var(--accent);
  color: var(--on-accent);
  font-size: 0.82rem;
  line-height: 1.25rem;
  text-align: center;
}
.side-scroll { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding-bottom: 5.5rem; }
.ring-banner {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0.5rem;
  padding: 0.5rem 0.3rem 0.5rem 0.9rem;
  border-radius: var(--radius);
  background: var(--selection);
  cursor: pointer;
}
.ring-words { flex: 1; min-width: 0; }
.ring-words b, .ring-words small { display: block; line-height: 1.35; }
.ring-words b { font-size: 1rem; color: var(--accent); }
.ring-words small { color: var(--text-secondary); }
.ring-banner .icon { min-width: 2.75rem; min-height: 2.75rem; font-size: 0.96rem; }

.chats-list { padding: 0.3rem 0.4rem; }
.chats-list:empty { display: none; }
.list-title { display: block; padding: 0.5rem 0.7rem 0.3rem; font-size: 0.94rem; font-weight: 600; color: var(--accent); }
.chat-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  min-height: 4.5rem;
  padding: 0.5rem 0.6rem;
  border-radius: 12px;
  text-align: left;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.chat-row.person { min-height: 3.6rem; }
div.chat-row { -webkit-user-select: text; user-select: text; }
@media (hover: hover) { button.chat-row:hover { background: var(--surface-subtle); } }
.chat-row-words { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.1rem; }
.chat-row-words > span, .chat-row-words > b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-row-words b { font-weight: 600; }
.chat-row-words > span:not(.chat-row-head, .chat-row-foot) { font-size: 0.96rem; color: var(--text-secondary); }
.chat-row-head { display: flex; align-items: center; gap: 0.3rem; }
.chat-row-head b { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-row-head time {
  display: flex;
  align-items: center;
  gap: 0.2rem;
  flex: none;
  margin-left: auto;
  font-size: 0.85rem;
  color: var(--text-tertiary);
}
.chat-row-head .icon-mute { width: 0.95rem; height: 0.95rem; color: var(--text-tertiary); }
.chat-row-foot { display: flex; align-items: center; gap: 0.5rem; min-height: 1.5rem; }
.chat-row-under {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 1rem;
  color: var(--text-secondary);
}
.chat-row-under i { font-style: normal; }
.chat-row-under .who { color: var(--text); }
.chat-row-under .draft { color: var(--danger); }
.chat-row-under img {
  width: 1.2rem;
  height: 1.2rem;
  margin-right: 0.3rem;
  border-radius: 4px;
  object-fit: cover;
  vertical-align: -0.2rem;
}
.chat-row .live { color: var(--accent) !important; }
.chat-row-foot .icon-pin { width: 1.1rem; height: 1.1rem; color: var(--text-tertiary); transform: rotate(35deg); }
.chat-count {
  flex: none;
  min-width: 1.5rem;
  padding: 0 0.4rem;
  border-radius: 1rem;
  background: var(--accent);
  color: var(--on-accent);
  font-size: 0.89rem;
  font-weight: 600;
  line-height: 1.5rem;
  text-align: center;
}
.chat-count.muted { background: var(--text-tertiary); color: var(--surface); }
.chat-row[aria-current='true'], button.chat-row[aria-current='true']:hover {
  --text: var(--on-accent);
  --text-secondary: color-mix(in srgb, var(--on-accent) 85%, transparent);
  --text-tertiary: color-mix(in srgb, var(--on-accent) 75%, transparent);
  --danger: var(--on-accent);
  background: var(--accent);
  color: var(--on-accent);
}
.chat-row[aria-current='true'] :is(.live, .ticks) { color: var(--on-accent) !important; }
.chat-row[aria-current='true'] .chat-count { background: var(--on-accent); color: var(--accent); }
.chat-face {
  position: relative;
  flex: none;
  display: grid;
  place-items: center;
  width: 3.4rem;
  height: 3.4rem;
  border-radius: 50%;
  background: linear-gradient(180deg, hsl(var(--hue) 58% 60%), hsl(var(--hue) 52% 45%));
  color: #fff;
  font-size: 1.2rem;
  font-weight: 600;
  line-height: 1;
}
.chat-face.to-self { background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 75%, #fff), var(--accent)); color: var(--on-accent); }
.chat-face.to-self .ci { width: 1.4em; height: 1.4em; }
.chat-face.tiho-mark { background: linear-gradient(#0f6e66, #0b4f49); font-weight: 500; padding-bottom: 0.08em; }
.chat-face.large { width: 7rem; height: 7rem; font-size: 2.6rem; }
.person .chat-face { width: 2.75rem; height: 2.75rem; font-size: 1rem; }
.sheet-row .chat-face { width: 2.6rem; height: 2.6rem; font-size: 0.95rem; }
.chat-face.online::after {
  content: '';
  position: absolute;
  right: 0.1rem;
  bottom: 0.1rem;
  width: 0.85rem;
  height: 0.85rem;
  border: 2px solid var(--surface);
  border-radius: 50%;
  background: #2fb36a;
}
.person-call { flex: none; padding: 0.2rem 0.7rem; border: 1px solid var(--border); border-radius: 1rem; font-size: 0.89rem; color: var(--accent); }
.ticks { width: 1.05rem; height: 1.05rem; stroke-width: 2; }
.chat-row .ticks { color: var(--accent); }

.fab {
  position: absolute;
  right: 1rem;
  bottom: calc(1rem + env(safe-area-inset-bottom));
  z-index: 2;
  display: grid;
  place-items: center;
  width: 3.5rem;
  height: 3.5rem;
  padding: 0;
  border-radius: 50%;
  background: var(--accent);
  color: var(--on-accent);
  box-shadow: 0 3px 12px rgb(0 0 0 / 0.25);
}
.fab:hover { background: var(--accent-pressed); }

.chats-start {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  flex-direction: column;
  background: var(--surface);
}
.start-fields { flex: none; display: flex; flex-direction: column; gap: 0.6rem; padding: 0.2rem 0.8rem 0.6rem; }
.start-fields .settings-note { margin: 0; }
.start-chosen { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.start-chosen:empty, .start-kinds:empty { display: none; }
.start-chip {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0 0.8rem 0 0;
  border-radius: 1rem;
  background: var(--selection);
  font-size: 0.94rem;
}
.start-chip .chat-face { width: 2rem; height: 2rem; font-size: 0.72rem; }
.start-kinds { padding: 0.2rem 0.4rem; border-bottom: 1px solid var(--border); }
.more-line {
  display: flex;
  align-items: center;
  gap: 1.1rem;
  width: 100%;
  min-height: 3rem;
  padding: 0.4rem 0.9rem;
  text-align: left;
}
.more-line .ci { color: var(--text-secondary); }
.more-line span { min-width: 0; overflow-wrap: anywhere; }
.more-line.danger, .more-line.danger .ci { color: var(--danger); }
@media (hover: hover) { .more-line:hover { background: var(--surface-subtle); } }

/* --- The talk ---------------------------------------------------------- */

.chats-choose { position: relative; display: grid; place-items: center; background: var(--paper); overflow: hidden; }
.chats-choose::before, .talk-paper {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--paper-ink);
  opacity: var(--paper-force);
  -webkit-mask: url('chat-paper.svg?v=1') 0 0 / 420px;
  mask: url('chat-paper.svg?v=1') 0 0 / 420px;
  pointer-events: none;
}
.chats-choose .pill { position: relative; }
.talk {
  --side: max(0.6rem, calc((100% - 46rem) / 2));
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: var(--paper);
}
.talk-head, .talk-finding, .talk-top, .talk-keys, .talk-hits { position: relative; z-index: 3; flex: none; background: var(--surface); }
.talk-head { display: flex; align-items: center; gap: 0.2rem; min-height: 3.5rem; padding: 0.2rem 0.5rem; box-shadow: 0 1px 0 var(--border); }
#talk-back { display: none; }
.back-count {
  position: absolute;
  top: 0.1rem;
  right: 0.05rem;
  min-width: 1.15rem;
  padding: 0 0.25rem;
  border-radius: 1rem;
  background: var(--accent);
  color: var(--on-accent);
  font-size: 0.76rem;
  font-weight: 600;
  line-height: 1.15rem;
}
.talk-title { flex: 1; min-width: 0; display: flex; align-items: center; gap: 0.75rem; padding: 0.2rem 0.4rem; text-align: left; }
.talk-title .chat-face { width: 2.6rem; height: 2.6rem; font-size: 0.95rem; }
.talk-title-words { flex: 1; min-width: 0; }
.talk-title-words b, .talk-title-words small { display: block; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.talk-title-words b { font-weight: 600; }
.talk-title-words small { font-size: 0.91rem; color: var(--text-tertiary); }
.talk-title-words small.live { color: var(--accent); }
.typing-dots { display: inline-flex; gap: 0.16rem; margin-right: 0.35rem; }
.typing-dots i { width: 0.3rem; height: 0.3rem; border-radius: 50%; background: currentColor; animation: typing 1.1s infinite; }
.typing-dots i:nth-child(2) { animation-delay: 0.18s; }
.typing-dots i:nth-child(3) { animation-delay: 0.36s; }
@keyframes typing { 0%, 70%, 100% { opacity: 0.3; } 35% { opacity: 1; transform: translateY(-2px); } }
.talk-finding { display: flex; align-items: center; gap: 0.4rem; padding: 0.35rem 0.6rem; }
.talk-top { display: flex; align-items: center; padding: 0.2rem 0.5rem 0.2rem 0.9rem; border-top: 1px solid var(--border); }
.talk-top-go {
  flex: 1;
  min-width: 0;
  padding: 0.1rem 0.7rem;
  border-left: 3px solid var(--accent);
  border-radius: 2px;
  font-size: 0.94rem;
  line-height: 1.35;
  text-align: left;
}
.talk-top-go b, .talk-top-go span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.talk-top-go b { color: var(--accent); }
.talk-keys { border-radius: 0; font-size: 0.92rem; text-align: left; color: var(--danger); border-top: 1px solid var(--border); }
.talk-hits { max-height: 55%; overflow-y: auto; overscroll-behavior: contain; padding: 0.3rem; border-top: 1px solid var(--border); }
.talk-hits .chat-row { min-height: 3.5rem; }
.talk-hits .chat-face { width: 2.6rem; height: 2.6rem; font-size: 0.95rem; }

.talk-scroll { position: relative; flex: 1; min-height: 0; display: flex; }
.talk-paper { bottom: -12rem; }
.talk-lines {
  position: relative;
  flex: 1;
  min-width: 0;
  min-height: 0;
  overflow: hidden auto;
  scrollbar-width: thin;
  scrollbar-color: color-mix(in srgb, var(--text) 25%, transparent) transparent;
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
  padding: 0.6rem var(--side) 0.5rem;
}
/* The end is at the bottom, however little there is. */
.talk-lines > :first-child { margin-top: auto; }
.talk-lines > :not(.talk-row) { flex: none; align-self: center; }
.talk-lines > .talk-day { margin-block: 0.6rem; }
.talk-lines > .talk-day:first-child { margin-top: auto; }
.talk-day-now { position: absolute; top: 0.6rem; left: 50%; transform: translateX(-50%); z-index: 2; pointer-events: none; }
.talk-new {
  align-self: stretch !important;
  margin: 0.6rem calc(var(--side) * -1);
  padding: 0.2rem;
  background: color-mix(in srgb, var(--surface) 72%, transparent);
  color: var(--accent);
  font-size: 0.94rem;
  font-weight: 500;
  text-align: center;
}
.talk-spin {
  width: 2.2rem;
  height: 2.2rem;
  margin: 0.6rem;
  border: 3px solid #fff;
  border-top-color: transparent;
  border-radius: 50%;
  background: var(--pill);
  animation: talk-spin 0.9s linear infinite;
}
@keyframes talk-spin { to { transform: rotate(1turn); } }
.talk-lines > .talk-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  margin: auto;
  padding: 1.1rem 1.6rem;
  border-radius: 18px;
  background: var(--pill);
  color: #fff;
  text-align: center;
  max-width: 18rem;
}
.talk-empty .wave { font-size: 4rem; line-height: 1.2; padding: 0.4rem 1rem; }
.talk-empty .wave:hover { transform: rotate(12deg); }

.talk-row {
  position: relative;
  flex: none;
  display: flex;
  align-items: flex-end;
  flex-wrap: wrap;
  margin-top: 2px;
  transform: translateX(var(--swipe, 0));
  transition: transform 0.16s;
  -webkit-touch-callout: none;
}
.talk-row.first { margin-top: 0.5rem; }
.talk-row.own { justify-content: flex-end; }
.talk-row::after {
  content: '';
  position: absolute;
  right: -3.2rem;
  bottom: 0.2rem;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: var(--pill) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='1.8' stroke-linejoin='round'%3E%3Cpath d='M11 5 4 12l7 7v-4c5 0 7 1.5 9 5 0-6-3-10-9-11z'/%3E%3C/svg%3E") center / 1.2rem no-repeat;
  opacity: 0;
  pointer-events: none;
}
.talk-row[style*='-']::after { opacity: 0.6; }
.talk-row.ready::after { opacity: 1; background-color: var(--accent); }
.row-face { flex: none; width: 2.5rem; }
.row-face .chat-face { width: 2.1rem; height: 2.1rem; font-size: 0.8rem; }
.pick-mark {
  align-self: center;
  flex: none;
  width: 1.5rem;
  height: 1.5rem;
  margin: 0 0.7rem 0 0.2rem;
  border: 2px solid #fff;
  border-radius: 50%;
  background: var(--pill);
}
.talk-row.own .pick-mark { margin-right: auto; }
.picking .talk-row { cursor: pointer; margin-inline: calc(var(--side) * -1); padding-inline: var(--side); }
.talk-row.picked { background: color-mix(in srgb, var(--accent) 22%, transparent); }
.talk-row.picked .pick-mark {
  border-color: #fff;
  background: var(--accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='3'%3E%3Cpath d='m5 12.5 4.5 4.5L19 7.5'/%3E%3C/svg%3E") center / 1rem no-repeat;
}
.talk-row.flash { animation: talk-flash 1.8s; }
@keyframes talk-flash { 0%, 55% { background: color-mix(in srgb, var(--accent) 26%, transparent); } }

.talk-line {
  --big: 16px;
  --low: 6px;
  position: relative;
  min-width: 0;
  max-width: min(32rem, 86%);
  padding: 0.35rem 0.65rem 0.4rem;
  border-radius: var(--low) var(--big) var(--big) var(--low);
  background: var(--bubble);
  color: var(--text);
  line-height: 1.38;
  box-shadow: var(--shade);
}
.row-face + .talk-line { max-width: min(32rem, calc(86% - 2.5rem)); }
.talk-line.own { border-radius: var(--big) var(--low) var(--low) var(--big); background: var(--bubble-own); }
.talk-row.first > .talk-line { border-top-left-radius: var(--big); border-top-right-radius: var(--big); }
.talk-row.last > .talk-line { border-bottom-left-radius: 0; }
.talk-row.last > .talk-line.own { border-bottom-left-radius: var(--big); border-bottom-right-radius: 0; }
.talk-row.last > .talk-line::before {
  content: '';
  position: absolute;
  bottom: 0;
  left: -8px;
  width: 8px;
  height: 16px;
  background: inherit;
  clip-path: path('M8 0v16H0c5-2 8-7 8-16z');
}
.talk-row.last > .talk-line.own::before { left: auto; right: -8px; clip-path: path('M0 0v16h8C3 14 0 9 0 0z'); }
.talk-line.waiting { opacity: 0.85; }
.talk-who { display: block; font-size: 0.96rem; font-weight: 600; color: hsl(var(--hue) 55% 42%); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.talk-from { display: block; font-size: 0.94rem; font-weight: 500; color: var(--accent); }
.talk-words { display: block; white-space: pre-wrap; overflow-wrap: anywhere; }
.talk-words::after { content: ''; display: block; clear: both; }
.talk-words a { color: var(--accent); text-decoration: none; }
.talk-words a:hover { text-decoration: underline; }
.talk-words code, .talk-words pre { font: 0.9em/1.4 ui-monospace, Menlo, Consolas, monospace; background: color-mix(in srgb, var(--text) 8%, transparent); border-radius: 4px; padding: 0.05em 0.25em; }
.talk-words pre { margin: 0.2rem 0; padding: 0.5rem 0.6rem; border-left: 3px solid var(--accent); white-space: pre-wrap; }
.spoiler:not(.open) { border-radius: 4px; background: radial-gradient(circle at 1.5px 1.5px, color-mix(in srgb, var(--text) 60%, transparent) 0 1px, transparent 1.4px) 0 0 / 4px 4px, radial-gradient(circle at 3px 3px, color-mix(in srgb, var(--text) 35%, transparent) 0 0.8px, transparent 1.2px) 0 0 / 5px 5px; color: transparent; cursor: pointer; }
.talk-none { font-style: italic; color: var(--text-tertiary); }
.talk-time {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  float: right;
  margin: 0.4rem -0.15rem -0.3rem 0.6rem;
  font-size: 0.8rem;
  font-style: normal;
  line-height: 1.2rem;
  white-space: nowrap;
  color: var(--text-tertiary);
  -webkit-user-select: none;
  user-select: none;
}
.own .talk-time { color: var(--bubble-own-text); }
.talk-time .icon-pin { width: 0.85rem; height: 0.85rem; }
.talk-time .icon-clock { width: 0.9rem; height: 0.9rem; }
.talk-time .icon-warn { width: 1rem; height: 1rem; color: var(--danger); }
.talk-line > .talk-time { position: absolute; right: 0.65rem; bottom: 0.25rem; margin: 0; float: none; }
.talk-line > .talk-time.over, .talk-line.bare > .talk-time, .talk-line.big > .talk-time {
  right: 0.4rem;
  bottom: 0.4rem;
  padding: 0 0.45rem;
  border-radius: 1rem;
  background: var(--pill);
  color: #fff;
}

.talk-line.big, .talk-line.bare { padding: 0; background: none; box-shadow: none; }
.talk-line.big::before, .talk-line.bare::before, .talk-line.media:not(:has(> .talk-words))::before { display: none; }
.talk-line.big { padding-bottom: 1.4rem; }
.talk-line.big .talk-words { font-size: 4rem; line-height: 1.1; white-space: nowrap; }
.talk-line.big > .talk-time { right: 0; bottom: 0; }
.talk-line.big > .talk-quote, .talk-line.big > .talk-who { background: var(--bubble); padding: 0.3rem 0.6rem; border-radius: 10px; }

.talk-line.media { padding: 0; }
.talk-line.media:not(:has(> .talk-words)) { border-bottom-left-radius: var(--low); border-bottom-right-radius: var(--low); }
.talk-row.last > .talk-line.media:not(:has(> .talk-words)) { border-radius: var(--big); }
.talk-line.media > .talk-words, .talk-line.media > .talk-marks { padding: 0.35rem 0.65rem 0.4rem; }
.talk-line.media > .talk-who, .talk-line.media > .talk-from { padding: 0.35rem 0.65rem 0.2rem; }
.talk-line.media > .talk-quote { width: calc(100% - 1rem); margin: 0.4rem 0.5rem; }
.talk-frame, .talk-album, .talk-line.media > .talk-video { position: relative; overflow: hidden; border-radius: inherit; background: color-mix(in srgb, var(--text) 10%, transparent); }
.talk-line.media:has(> .talk-words, > .talk-marks) > :is(.talk-frame, .talk-album, .talk-video) { border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.talk-line.media.headed > :is(.talk-frame, .talk-album, .talk-video) { border-top-left-radius: 0; border-top-right-radius: 0; }
.talk-frame { display: grid; place-items: center; min-width: 8rem; min-height: 5rem; }
.talk-frame > * { grid-area: 1 / 1; }
.talk-frame.shaped { width: min(22rem, 72vw, calc(24rem * var(--shape))); aspect-ratio: var(--shape); }
.talk-picture { display: block; max-width: min(22rem, 72vw); max-height: 24rem; width: auto; height: auto; cursor: zoom-in; }
.talk-frame.shaped .talk-picture { width: 100%; height: 100%; max-width: none; max-height: none; object-fit: cover; }
.talk-picture:not([src]) { opacity: 0; }
.talk-album { display: grid; grid-template-columns: repeat(6, 1fr); gap: 2px; width: min(24rem, 76vw); }
.album-cell { grid-column: span 2; aspect-ratio: 1; min-width: 0; }
.album-cell .talk-frame, .album-cell .talk-frame.shaped { width: 100%; height: 100%; min-width: 0; min-height: 0; aspect-ratio: auto; }
.album-cell .talk-picture { width: 100%; height: 100%; max-width: none; max-height: none; object-fit: cover; }
.n2 .album-cell { aspect-ratio: 3 / 4; }
:is(.n2, .n4) .album-cell, .n3 .album-cell, .n5 .album-cell:nth-child(-n + 2), .n8 .album-cell:nth-child(-n + 2) { grid-column: span 3; }
:is(.n3, .n7, .n10) .album-cell:first-child { grid-column: span 6; aspect-ratio: 3 / 2; }

.talk-quote {
  --tone: hsl(var(--hue, 175) 55% 42%);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  min-width: 9rem;
  margin: 0.15rem 0 0.3rem;
  padding: 0.2rem 0.6rem;
  border-left: 3px solid var(--tone);
  border-radius: 5px;
  background: color-mix(in srgb, var(--tone) 12%, transparent);
  font-size: 0.94rem;
  line-height: 1.35;
  text-align: left;
}
.own .talk-quote { --tone: var(--accent); }
.talk-quote img { width: 2.1rem; height: 2.1rem; border-radius: 4px; object-fit: cover; }
.quote-words { flex: 1; min-width: 0; }
.quote-words > * { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.quote-words b { color: var(--tone); }
:root[data-theme='dark'] .talk-who { color: hsl(var(--hue) 60% 68%); }
:root[data-theme='dark'] .talk-quote { --tone: hsl(var(--hue, 175) 60% 68%); }
:root[data-theme='dark'] .own .talk-quote { --tone: var(--accent); }
@media (prefers-color-scheme: dark) {
  :root[data-theme='system'] .talk-who { color: hsl(var(--hue) 60% 68%); }
  :root[data-theme='system'] .talk-quote { --tone: hsl(var(--hue, 175) 60% 68%); }
  :root[data-theme='system'] .own .talk-quote { --tone: var(--accent); }
}

.talk-file, .thing-row { display: flex; align-items: center; gap: 0.75rem; max-width: 100%; padding: 0.2rem 0; text-align: left; border-radius: 8px; }
.talk-file { min-width: 14rem; }
.talk-line > .talk-file:nth-last-child(2) { padding-right: 3rem; }
.file-mark {
  flex: none;
  display: grid;
  place-items: center;
  width: 3rem;
  height: 3rem;
  border-radius: 12px;
  background: var(--accent);
  color: var(--on-accent);
  font-size: 0.82rem;
  font-weight: 600;
}
.file-words { min-width: 0; }
.file-words b, .file-words small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-words b { font-weight: 600; }
.file-words small { color: var(--text-tertiary); }
.own .file-words small { color: var(--bubble-own-text); }

.talk-marks { display: flex; flex-wrap: wrap; align-items: center; gap: 0.3rem; margin-top: 0.3rem; }
.talk-marks button {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  min-height: 1.9rem;
  padding: 0 0.5rem;
  border-radius: 1rem;
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  color: var(--accent);
  font-size: 1rem;
  line-height: 1;
}
.talk-marks button.mine { background: var(--accent); color: var(--on-accent); }
.talk-marks .chat-face { width: 1.3rem; height: 1.3rem; font-size: 0.5rem; }
.talk-marks .chat-face + .chat-face { margin-left: -0.6rem; }
.talk-marks .talk-time { float: none; margin: 0 0 -0.3rem auto; align-self: flex-end; padding-left: 0.4rem; }
.talk-failed { flex-basis: 100%; display: flex; justify-content: flex-end; gap: 0.3rem; }
.talk-failed button { min-height: 2.4rem; padding: 0 0.8rem; margin-top: 0.2rem; border-radius: 1.2rem; background: var(--bubble); font-size: 0.92rem; color: var(--danger); }
.talk-failed .ghost { color: var(--text-secondary); }

.talk-voice { display: grid; grid-template: auto auto / auto 1fr auto; align-items: center; column-gap: 0.7rem; min-width: min(17rem, 66vw); padding: 0.1rem 0; }
.voice-play, .video-play {
  flex: none;
  display: grid;
  place-items: center;
  width: 3rem;
  height: 3rem;
  padding: 0;
  border-radius: 50%;
  background: var(--accent);
  color: var(--on-accent);
}
.voice-play { grid-row: 1 / 3; }
.voice-play .icon-pause, .talk-voice.on .icon-play { display: none; }
.talk-voice.on .icon-pause { display: block; }
.voice-wave { width: 100%; height: 1.7rem; cursor: pointer; }
.voice-wave rect { fill: color-mix(in srgb, var(--accent) 40%, transparent); }
.voice-wave rect.done { fill: var(--accent); }
.voice-time { grid-area: 2 / 2; font-size: 0.87rem; line-height: 1.1rem; font-variant-numeric: tabular-nums; color: var(--text-tertiary); }
.own .voice-time { color: var(--bubble-own-text); }
.voice-rate { grid-area: 1 / 3; padding: 0.15rem 0.45rem; border-radius: 0.8rem; background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent); font-size: 0.82rem; font-weight: 600; }
.loading-file .voice-play, .loading-file .video-play { opacity: 0.5; }
.talk-video { position: relative; display: grid; place-items: center; min-width: 9rem; min-height: 6rem; }
.talk-video video { display: block; max-width: 100%; max-height: 24rem; background: #000; }
.talk-video.round, .talk-video.round video { width: min(15rem, 62vw); height: min(15rem, 62vw); }
.talk-video.round video { border-radius: 50%; object-fit: cover; }
.talk-video:not(.round) video { width: min(22rem, 72vw); aspect-ratio: 16 / 10; }
.video-play { position: absolute; background: rgb(0 0 0 / 0.45); color: #fff; }
.talk-video.on .video-play { opacity: 0; }
.talk-video:not(.round).on .video-play { display: none; }
.talk-video.round .video-play { width: 100%; height: 100%; background: none; }
.talk-video.round .video-play .chat-icon { width: 3rem; height: 3rem; padding: 0.7rem; border-radius: 50%; background: rgb(0 0 0 / 0.45); }
.video-time { position: absolute; left: 0.5rem; bottom: 0.4rem; padding: 0 0.45rem; border-radius: 0.8rem; background: rgb(0 0 0 / 0.45); color: #fff; font-size: 0.8rem; line-height: 1.2rem; }
.video-time:empty { display: none; }

.talk-down {
  position: absolute;
  right: max(0.7rem, calc((100% - 46rem) / 2 - 4rem));
  bottom: 0.6rem;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 3rem;
  height: 3rem;
  padding: 0;
  border-radius: 50%;
  background: var(--surface-raised);
  color: var(--text-secondary);
  box-shadow: 0 1px 6px rgb(0 0 0 / 0.2);
}
.down-count {
  position: absolute;
  top: -0.5rem;
  min-width: 1.4rem;
  padding: 0 0.35rem;
  border-radius: 1rem;
  background: var(--accent);
  color: var(--on-accent);
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1.4rem;
}

/* --- Where it is written ------------------------------------------------ */

.talk-foot { position: relative; z-index: 2; flex: none; padding: 0.25rem var(--side) calc(0.5rem + env(safe-area-inset-bottom)); }
.talk-bar { display: flex; align-items: flex-end; gap: 0.5rem; }
.talk-pill, .talk-asked, .talk-only, .talk-chosen { background: var(--surface-raised); border-radius: 1.5rem; box-shadow: 0 1px 4px rgb(0 0 0 / 0.12); }
.talk-pill { position: relative; flex: 1; min-width: 0; overflow: hidden; }
.talk-form { display: flex; align-items: flex-end; }
.talk-form .round { width: 2.9rem; height: 3rem; }
.chats-card .talk-form textarea {
  flex: 1;
  min-width: 0;
  min-height: 3rem;
  max-height: 200px;
  height: 3rem;
  padding: 0.75rem 0.1rem;
  border: 0;
  background: none;
  font-size: 1rem;
  line-height: 1.5rem;
  resize: none;
  overflow-y: auto;
  scrollbar-width: none;
}
.talk-over { display: flex; align-items: center; gap: 0.3rem; padding: 0.3rem 0 0 0.7rem; color: var(--accent); }
.talk-over-words {
  flex: 1;
  min-width: 0;
  margin-left: 0.5rem;
  padding: 0.1rem 0.6rem;
  border-left: 3px solid var(--accent);
  border-radius: 5px;
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  font-size: 0.94rem;
  line-height: 1.35;
  text-align: left;
}
.talk-over-words b, .talk-over-words span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.talk-over-words span { color: var(--text); }
.talk-main {
  position: relative;
  z-index: 2;
  flex: none;
  display: grid;
  place-items: center;
  width: 3rem;
  height: 3rem;
  padding: 0;
  border-radius: 50%;
  background: var(--accent);
  color: var(--on-accent);
  box-shadow: 0 1px 4px rgb(0 0 0 / 0.15);
  touch-action: none;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  transform-origin: 75% 75%;
  transition: transform 0.15s;
}
.talk-main .ci { grid-area: 1 / 1; display: none; }
.talk-main .for-send { fill: currentColor; }
.talk-main[data-does='voice'] .for-voice, .talk-main[data-does='video'] .for-video,
.talk-main[data-does='send'] .for-send, .talk-main[data-does='edit'] .for-edit { display: block; }
.talk-bar.held .talk-main { transform: translateX(var(--slid)) scale(1.75); }
.talk-rec { display: flex; align-items: center; gap: 0.6rem; min-height: 3rem; padding: 0 0.4rem 0 1rem; }
.talk-rec .rec-time { min-width: 3rem; font-variant-numeric: tabular-nums; }
.rec-slide { flex: 1; text-align: center; color: var(--text-tertiary); transform: translateX(calc(var(--slid, 0px) / 2)); }
.rec-slide::before { content: '‹ '; }
.talk-rec button { margin-left: auto; min-height: 2.75rem; color: var(--danger); }
.rec-mark { flex: none; width: 0.75rem; height: 0.75rem; border-radius: 50%; background: var(--danger); animation: rec-blink 1.2s infinite; }
@keyframes rec-blink { 50% { opacity: 0.2; } }
.talk-asked { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; padding: 0.6rem 0.8rem 0.6rem 1.1rem; }
.talk-asked span { flex: 1 1 12rem; }
.talk-asked button { min-height: 2.75rem; }
.talk-asked .danger { color: var(--danger); }
.talk-only { margin: 0; padding: 0.75rem 1rem; text-align: center; color: var(--text-secondary); }
.talk-chosen { display: flex; align-items: center; gap: 0.3rem; min-height: 3rem; padding: 0.1rem 0.4rem; }
.talk-chosen b { flex: 1; }
.talk.dropping .talk-lines { outline: 2px dashed var(--accent); outline-offset: -8px; }

.emoji-panel { position: absolute; left: var(--side); bottom: calc(100% + 0.1rem); z-index: 4; width: 23rem; max-width: calc(100% - 2 * var(--side)); height: 22rem; border-radius: 16px; background: var(--surface-raised); box-shadow: 0 4px 24px rgb(0 0 0 / 0.22); overflow: hidden; }
.emoji-panel, .popup-emoji { display: flex; flex-direction: column; }
.emoji-tabs { flex: none; display: flex; border-bottom: 1px solid var(--border); }
.emoji-tabs button { flex: 1; min-height: 2.6rem; padding: 0; font-size: 1.15rem; opacity: 0.75; }
.emoji-list { position: relative; flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 0.3rem; }
.emoji-part { display: grid; grid-template-columns: repeat(auto-fill, minmax(2.5rem, 1fr)); padding-bottom: 0.6rem; }
.emoji-part button { height: 2.5rem; padding: 0; font-size: 1.6rem; line-height: 1; }
.emoji-part button:hover { background: var(--surface-subtle); }

/* --- About the talk ------------------------------------------------------ */

.talk-more { min-width: 0; min-height: 0; display: flex; flex-direction: column; border-left: 1px solid var(--border); background: var(--surface); }
.more-body { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding-bottom: calc(1rem + env(safe-area-inset-bottom)); }
.more-card { display: flex; flex-direction: column; align-items: center; gap: 0.2rem; padding: 0.8rem 1rem 1rem; text-align: center; }
.more-name { margin-top: 0.6rem; font-size: 1.3rem; font-weight: 600; line-height: 1.25; overflow-wrap: anywhere; }
.more-card small { color: var(--text-tertiary); }
.more-tools { display: flex; gap: 0.5rem; padding: 0 0.8rem 0.9rem; }
.more-tool { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 0.25rem; padding: 0.6rem 0.2rem; border-radius: 12px; background: var(--surface-subtle); color: var(--accent); font-size: 0.75rem; line-height: 1.2; }
.more-tool span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.more-code { padding: 0 0.9rem; }
.more-code summary { display: flex; align-items: center; gap: 1.1rem; min-height: 3rem; cursor: pointer; list-style: none; }
.more-code summary::-webkit-details-marker { display: none; }
.more-code summary .ci { color: var(--text-secondary); }
.more-code .settings-note { margin: 0 0 0.8rem; }
.talk-code { margin: 0.3rem 0; font-size: 1.1rem; font-variant-numeric: tabular-nums; letter-spacing: 0.05em; }
.more-members { padding: 0.6rem 0.4rem; border-top: 8px solid var(--surface-muted); }
.more-title { display: block; padding: 0 0.6rem 0.4rem; color: var(--accent); font-weight: 600; }
.talk-invite { display: flex; gap: 0.5rem; padding: 0.2rem 0.6rem 0.6rem; }
.talk-invite button { flex: none; color: var(--accent); }
.more-shared { border-top: 8px solid var(--surface-muted); }
.more-tabs { position: sticky; top: 0; z-index: 1; display: flex; overflow-x: auto; scrollbar-width: none; background: var(--surface); border-bottom: 1px solid var(--border); }
.more-tabs button { flex: 1; justify-content: center; }
.more-things { min-height: 8rem; }
.more-things.is-media { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; align-content: start; }
.more-things.is-media .empty { grid-column: 1 / -1; }
.more-things.is-media .thing-row { grid-column: 1 / -1; }
.thing-cell { aspect-ratio: 1; padding: 0; border-radius: 0; overflow: hidden; background: var(--surface-subtle); }
.thing-cell img { width: 100%; height: 100%; object-fit: cover; }
.thing-row { width: 100%; padding: 0.5rem 0.9rem; border-radius: 0; }
@media (hover: hover) { .thing-row:hover { background: var(--surface-subtle); } }
.thing-link { padding: 0.6rem 0.9rem; border-bottom: 1px solid var(--border); }
.more-end { padding: 0.4rem 0; border-top: 8px solid var(--surface-muted); }

/* --- Over everything ------------------------------------------------------ */

.popup { position: fixed; inset: 0; z-index: 12; -webkit-touch-callout: none; }
.popup.dim { background: rgb(0 0 0 / 0.35); -webkit-backdrop-filter: blur(7px); backdrop-filter: blur(7px); animation: fade 0.14s; }
@keyframes fade { from { opacity: 0; } }
.popup-card { position: absolute; display: flex; flex-direction: column; align-items: flex-start; gap: 0.5rem; max-width: calc(100vw - 16px); max-height: calc(100dvh - 16px); animation: popup 0.13s ease-out; pointer-events: none; }
.popup-card > * { pointer-events: auto; }
@keyframes popup { from { opacity: 0; transform: scale(0.94); } }
.popup-rows { min-width: 13rem; max-width: 19rem; padding: 0.3rem; border-radius: 14px; background: var(--surface-raised); box-shadow: 0 4px 24px rgb(0 0 0 / 0.25); overflow-y: auto; }
.popup-row { display: flex; align-items: center; gap: 0.9rem; width: 100%; min-height: 2.6rem; padding: 0.3rem 0.8rem; border-radius: 10px; text-align: left; font-size: 0.98rem; }
.popup-row .ci { width: 1.3rem; height: 1.3rem; color: var(--text-secondary); }
.popup-row.danger, .popup-row.danger .ci { color: var(--danger); }
@media (hover: hover) { .popup-row:hover { background: var(--surface-subtle); } }
@media (pointer: coarse) { .popup-row { min-height: 2.9rem; } }
.popup-words { flex: 1; min-width: 0; line-height: 1.3; }
.popup-words small { display: block; color: var(--text-tertiary); }
.popup-on { flex: none; position: relative; width: 2.2rem; height: 1.3rem; border-radius: 1rem; background: var(--border); }
.popup-on::after { content: ''; position: absolute; top: 0.15rem; left: 0.15rem; width: 1rem; height: 1rem; border-radius: 50%; background: #fff; }
.popup-on.yes { background: var(--accent); }
.popup-on.yes::after { left: 1.05rem; }
.popup-signs { display: flex; padding: 0.2rem 0.35rem; border-radius: 2rem; background: var(--surface-raised); box-shadow: 0 4px 24px rgb(0 0 0 / 0.25); }
.popup-card.around .popup-signs { margin-bottom: calc(var(--hole) - 0.5rem); }
.popup-signs button { display: grid; place-items: center; width: 2.6rem; height: 2.6rem; padding: 0; border-radius: 50%; font-size: 1.65rem; line-height: 1; transition: transform 0.12s; }
.popup-signs button.mine { background: var(--selection); }
.popup-signs .more { color: var(--text-secondary); }
@media (hover: hover) { .popup-signs button:hover { transform: scale(1.2); } }
.popup-emoji { width: min(22rem, calc(100vw - 16px)); height: 20rem; border-radius: 16px; background: var(--surface-raised); box-shadow: 0 4px 24px rgb(0 0 0 / 0.25); overflow: hidden; }
.popup-shown { position: absolute !important; max-width: none !important; margin: 0; overflow: hidden; pointer-events: auto; }
.popup-shown::before { display: none; }

.outbox-card { display: flex; flex-direction: column; max-height: 85dvh; padding: 0.4rem 0.6rem calc(0.6rem + env(safe-area-inset-bottom)); }
.outbox-files { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 0.5rem; padding: 0.3rem 0.4rem; }
.outbox-files.pictures { display: grid; grid-template-columns: 1fr 1fr; gap: 3px; border-radius: 12px; }
.outbox-file { display: flex; align-items: center; gap: 0.75rem; min-width: 0; }
.outbox-file img { width: 3rem; height: 3rem; border-radius: 10px; object-fit: cover; }
.pictures .outbox-file img { width: 100%; height: auto; aspect-ratio: 1; border-radius: 4px; }
.pictures .outbox-file:only-child { grid-column: 1 / -1; }
.pictures .outbox-file:only-child img { aspect-ratio: auto; max-height: 50dvh; object-fit: contain; border-radius: 12px; }
.pictures .outbox-file:nth-child(odd):last-child:not(:only-child) { grid-column: 1 / -1; }
.pictures .outbox-file:nth-child(odd):last-child:not(:only-child) img { aspect-ratio: 2; }
.outbox-foot { display: flex; align-items: center; gap: 0.5rem; padding: 0.5rem 0.4rem 0; }
.outbox-foot input { flex: 1; min-width: 0; padding: 0.7rem 0.9rem; border: 1px solid var(--border); border-radius: 1.4rem; background: var(--surface); outline: 0; }
.outbox-foot input:focus { border-color: var(--accent); }
.outbox-foot button { min-height: 2.8rem; border-radius: 1.4rem; padding: 0 1.2rem; }

.light { gap: 0; padding: 0; background: #000; }
.light-head { position: absolute; inset: 0 0 auto; z-index: 1; display: flex; align-items: center; gap: 0.3rem; padding: calc(0.4rem + env(safe-area-inset-top)) 0.6rem 0.4rem 1rem; background: linear-gradient(rgb(0 0 0 / 0.6), transparent); }
.light-words { flex: 1; min-width: 0; line-height: 1.3; }
.light-words b, .light-words small { display: block; }
.light-words small { opacity: 0.7; }
.light .round { color: #fff; }
.light .round:hover { background: rgb(255 255 255 / 0.15); }
.light img { max-width: 100%; max-height: 100dvh; object-fit: contain; }
.light-step { position: absolute !important; top: 50%; z-index: 1; translate: 0 -50%; }
#light-before { left: 0.5rem; }
#light-after { right: 0.5rem; }
.light-caption { position: absolute; inset: auto 0 0; margin: 0; padding: 1.5rem 1.2rem calc(1rem + env(safe-area-inset-bottom)); text-align: center; white-space: pre-wrap; background: linear-gradient(transparent, rgb(0 0 0 / 0.75)); }
.camera.held .camera-buttons { visibility: hidden; }

/* --- Sizes ------------------------------------------------------------------ */

@media (min-width: 76rem) {
  .chats-panes:has(> .talk-more:not([hidden])) { grid-template-columns: clamp(19rem, 25vw, 23rem) minmax(0, 1fr) 23rem; }
}
@media (max-width: 75.99rem) {
  .talk-more { position: absolute; inset: 0 0 0 auto; z-index: 6; width: min(24rem, 100%); box-shadow: -4px 0 24px rgb(0 0 0 / 0.15); }
}
@media (max-width: 44rem) {
  .chats-panes { grid-template-columns: minmax(0, 1fr); }
  .chats-panes.talking .chats-side, .chats-panes:not(.talking) .chats-choose { display: none; }
  .chats-side { border-right: 0; }
  #talk-back { display: grid; }
  .talk { --side: 0.5rem; }
  .talk-head { padding-left: 0.1rem; }
  .talk-title { gap: 0.6rem; padding-inline: 0.1rem; }
  .talk-more { width: 100%; border-left: 0; }
  .talk-line { max-width: 86%; }
  .chats-list { padding-inline: 0; }
  .chat-row { border-radius: 0; padding-inline: 0.75rem; }
  .emoji-panel { position: static; width: auto; max-width: none; height: 17rem; margin: 0.5rem calc(var(--side) * -1) calc(-0.5rem - env(safe-area-inset-bottom)); border-radius: 0; box-shadow: none; }
}
@media (hover: none) and (max-width: 44rem) { .light-step { display: none; } }
@media (prefers-reduced-motion: reduce) {
  .popup-card, .popup.dim, .typing-dots i, .talk-row.flash { animation: none; }
}

/* A word about what happened must not lie over the field. */

/* --- Earlier messages for a device that came later --------------------- */

.history-banner {
  margin: 0.6rem;
  padding: 0.9rem;
  border: 1px solid var(--accent);
  border-radius: 14px;
  background: var(--surface-subtle);
  font-size: 0.94rem;
}
.history-banner[hidden] { display: none; }
.history-banner p { margin: 0; }
.history-code {
  display: block;
  margin-top: 0.6rem;
  color: var(--accent);
  font-size: 1.15rem;
  font-variant-numeric: tabular-nums;
  text-align: center;
}
.history-row { display: flex; justify-content: flex-end; gap: 0.5rem; margin-top: 0.7rem; }
.history-row button { min-height: 2.5rem; }
