/* ==========================================================================
   chat.css — live chats (js/chat.js) and the things they brought with them
   Desktop: glass panel docked on the right; collapses to a slim pill.
            Below 1280px it floats over the page instead of pushing it.
   Phone:   a page behind its own tab; an open thread takes the whole screen.
   ========================================================================== */
:root {
  --chat-w: 25rem;
}

.chat-dock {
  display: none;
}

/* ------------------------------------------------- the app steps aside -- */
@media (min-width: 761px) {
  .chat-dock {
    display: block;
  }
  .app:has(.chat-dock) {
    padding-right: calc(var(--rail-w) + .75rem);
  }
  .app:has(.chat-dock) .shell {
    --gutter: clamp(.75rem, 1.6vw, 2.25rem);
  }
}
@media (min-width: 1280px) {
  body.chat-open .app:has(.chat-dock) {
    padding-right: calc(var(--chat-w) + .75rem);
  }
  /* the AI panel sits exactly over the chats, so nothing jumps */
  body.chat-open .ai {
    right: .75rem;
    width: var(--chat-w);
  }
}
body.ai-open .chat-slim {
  opacity: 0;
  pointer-events: none;
}
/* the slim pill takes the room the AI panel used to have on its right */
@media (min-width: 761px) {
  .ai {
    right: .75rem;
  }
}

/* the page is narrower next to the panel — use the laptop layouts earlier */
@media (min-width: 1280px) and (max-width: 1699px) {
  body.chat-open .g-3 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  body.chat-open .g-3 > :last-child:nth-child(odd) {
    grid-column: 1 / -1;
  }
  body.chat-open .g-props {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  body.chat-open .prop-layout,
  body.chat-open .ct-layout {
    display: flex;
    flex-direction: column;
    align-items: stretch;
  }
  body.chat-open .col-main,
  body.chat-open .col-side {
    display: contents;
  }
  body.chat-open .o-1 { order: 1; }
  body.chat-open .o-2 { order: 2; }
  body.chat-open .o-3 { order: 3; }
  body.chat-open .o-4 { order: 4; }
  body.chat-open .o-5 { order: 5; }
  body.chat-open .o-6 { order: 6; }
  body.chat-open .o-7 { order: 7; }
  body.chat-open .o-8 { order: 8; }
  body.chat-open .o-9 { order: 9; }
  body.chat-open .o-10 { order: 10; }
  body.chat-open .o-11 { order: 11; }
  body.chat-open .doc-maker {
    grid-template-columns: minmax(0, 1fr);
  }
  body.chat-open .dm-preview {
    position: static;
  }
  body.chat-open .map-layout {
    grid-template-columns: minmax(16rem, 20rem) minmax(0, 1fr);
  }
  body.chat-open .board {
    grid-template-columns: repeat(5, 16.25rem);
  }
}
@media (min-width: 1280px) and (max-width: 1499px) {
  body.chat-open .g-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  body.chat-open .g-props {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  body.chat-open .toolbar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  body.chat-open .toolbar .search-field {
    grid-column: 1 / -1;
  }
  body.chat-open .as-layout {
    grid-template-columns: minmax(0, 1fr);
  }
  body.chat-open .comp-row {
    grid-template-columns: 1fr 1.3fr 0.9fr 1.3fr 0.7fr;
  }
  body.chat-open .me-name {
    display: none;
  }
  body.chat-open button.me {
    padding: 0;
  }
  body.chat-open .page-head {
    flex-direction: column;
    align-items: stretch;
  }
  body.chat-open .head-actions .btn {
    min-width: 0;
  }
}

/* ---------------------------------------------------- the docked panel -- */
.chat-panel {
  color: var(--ink);
}
.chat-dock .chat-panel {
  position: fixed;
  z-index: 60;
  top: 1.375rem;
  bottom: 1.375rem;
  right: .75rem;
  width: var(--chat-w);
  max-width: calc(100vw - 1.5rem);
  border-radius: 2rem;
  background: linear-gradient(160deg, var(--sheen), transparent 40%), var(--glass-strong);
  backdrop-filter: blur(44px) saturate(1.7);
  -webkit-backdrop-filter: blur(44px) saturate(1.7);
  border: 1px solid var(--edge);
  box-shadow: 0 2.5rem 6.25rem -1.875rem rgb(0 0 0 / 0.55);
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateX(2.5rem) scale(0.98);
  transition:
    transform 0.6s var(--ease),
    opacity 0.35s,
    visibility 0s 0.6s;
}
body.chat-open .chat-dock .chat-panel {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: none;
  transition:
    transform 0.6s var(--ease),
    opacity 0.35s,
    visibility 0s;
}
.chat-view {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}
.chat-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: .75rem;
  padding: 1.125rem .875rem .625rem 1.25rem;
}
.chat-title h3 {
  font-size: 1.1875rem;
  font-weight: 650;
  letter-spacing: -0.3px;
}
.chat-title p {
  margin-top: .125rem;
  font-size: .8125rem;
  color: var(--muted);
}
.chat-tools {
  display: grid;
  gap: .625rem;
  padding: 0 .875rem .625rem;
  min-width: 0;
}
.chat-search {
  height: 2.5rem;
}
.chat-seg button {
  font-size: .75rem;
  gap: .25rem;
  padding-left: .25rem;
  padding-right: .25rem;
}
.chat-online-title {
  padding: .25rem .375rem;
  font-size: .75rem;
  font-weight: 600;
  color: var(--muted);
}
.chat-online-row {
  display: flex;
  gap: .625rem;
  padding: .25rem .25rem .375rem;
  overflow-x: auto;
  scrollbar-width: none;
}
.chat-online-row::-webkit-scrollbar {
  display: none;
}
.chat-online-btn {
  display: grid;
  justify-items: center;
  gap: .25rem;
  width: 3.5rem;
  flex-shrink: 0;
  border-radius: .875rem;
  transition: transform 0.3s var(--spring);
}
.chat-online-btn:hover {
  transform: translateY(-2px);
}
.chat-online-btn small {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: .75rem;
  font-weight: 500;
  color: var(--ink-2);
}
.chat-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: .125rem .5rem .75rem;
}

/* --------------------------------------------------------- list rows -- */
.chat-row {
  display: flex;
  align-items: center;
  gap: .75rem;
  width: 100%;
  padding: .625rem .625rem;
  border-radius: 1.125rem;
  text-align: left;
  transition: background-color 0.2s;
}
.chat-row:hover {
  background: var(--soft);
}
.chat-row-main {
  flex: 1;
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: .1875rem;
}
.chat-row-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: .5rem;
}
.chat-row-top b {
  font-size: .9375rem;
  font-weight: 550;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chat-row.unread .chat-row-top b {
  font-weight: 700;
}
.chat-row-top time {
  flex-shrink: 0;
  font-size: .75rem;
  color: var(--muted);
}
.chat-row-sub {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
}
.chat-prev {
  display: block;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: .8125rem;
  color: var(--muted);
}
.chat-prev svg {
  vertical-align: -.125rem;
  margin-right: .25rem;
}
.chat-row.unread .chat-prev {
  color: var(--ink-2);
  font-weight: 500;
}
.chat-you {
  color: var(--ink-2);
}
.chat-typing-line {
  color: var(--green);
  font-weight: 600;
}

/* ------------------------------------------- avatars, presence, channel -- */
.chat-ava {
  position: relative;
  flex-shrink: 0;
  display: block;
  width: 2.75rem;
  height: 2.75rem;
}
.chat-ava.sm {
  width: 2.5rem;
  height: 2.5rem;
}
.chat-ava.sm .avatar {
  width: 2.5rem;
  height: 2.5rem;
  font-size: .8125rem;
}
.online-dot {
  position: absolute;
  top: -.0625rem;
  right: -.0625rem;
  width: .75rem;
  height: .75rem;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 0 .125rem #fff;
}
.ch {
  position: absolute;
  right: -.25rem;
  bottom: -.1875rem;
  display: grid;
  place-items: center;
  font-style: normal;
  color: #fff;
  box-shadow: 0 0 0 .125rem #fff;
}
.ch-telegram {
  width: 1.125rem;
  height: 1.125rem;
  border-radius: 50%;
  background: #1d8fcc;
}
.ch-olx {
  height: .9375rem;
  padding: 0 .25rem;
  border-radius: .3125rem;
  background: #002f34;
  font-size: .5625rem;
  font-weight: 800;
  letter-spacing: 0.2px;
  line-height: 1;
}
.chat-badge {
  display: inline-grid;
  place-items: center;
  flex-shrink: 0;
  min-width: 1.25rem;
  height: 1.25rem;
  padding: 0 .3125rem;
  border-radius: 62.4375rem;
  background: #d92d3a;
  color: #fff;
  font-size: .6875rem;
  font-style: normal;
  font-weight: 700;
  line-height: 1;
}
.chat-badge[hidden] {
  display: none;
}

/* -------------------------------------------------------- collapsed pill -- */
.chat-slim {
  --in: 0.3s;
  position: fixed;
  z-index: 50;
  right: .5rem;
  top: 7.5rem;
  width: calc(var(--rail-w) - .25rem);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .5rem;
  padding: .5rem;
  border-radius: 62.4375rem;
  transition:
    opacity 0.3s,
    transform 0.5s var(--ease);
}
body.chat-open .chat-slim {
  opacity: 0;
  pointer-events: none;
  transform: translateX(1rem);
}
.chat-slim-people {
  display: grid;
  gap: .375rem;
}
.chat-slim-btn {
  position: relative;
  display: grid;
  place-items: center;
  width: 2.875rem;
  height: 2.875rem;
  border-radius: 50%;
  color: var(--chrome-ink);
  transition:
    background-color 0.25s,
    transform 0.35s var(--spring);
}
.chat-slim-btn:hover {
  background: var(--chrome-hover);
  transform: scale(1.06);
}
.chat-slim-btn > .chat-badge {
  position: absolute;
  top: -.0625rem;
  left: -.125rem;
  box-shadow: 0 0 0 .125rem rgb(255 255 255 / 0.9);
}
.chat-slim-main > .chat-badge {
  left: auto;
  right: -.125rem;
}
.chat-slim-line {
  width: 1.5rem;
  height: 1px;
  background: rgb(255 255 255 / 0.4);
}
.chat-slim-btn::after {
  content: attr(data-tip);
  position: absolute;
  right: calc(100% + .875rem);
  top: 50%;
  translate: .375rem -50%;
  padding: .5rem .75rem;
  border-radius: .75rem;
  background: var(--glass-strong);
  backdrop-filter: blur(24px) saturate(1.6);
  -webkit-backdrop-filter: blur(24px) saturate(1.6);
  border: 1px solid var(--edge);
  color: var(--ink);
  font-size: .8125rem;
  font-weight: 500;
  white-space: nowrap;
  box-shadow: 0 1rem 2.25rem -1rem rgb(0 0 0 / 0.4);
  pointer-events: none;
  opacity: 0;
  transition:
    opacity 0.2s,
    translate 0.3s var(--ease);
}
.chat-slim-btn:hover::after {
  opacity: 1;
  translate: 0 -50%;
}

/* ------------------------------------------------------------- thread -- */
.chat-thread-head {
  display: flex;
  align-items: center;
  gap: .625rem;
  padding: .875rem .75rem .625rem;
}
.chat-who {
  flex: 1;
  min-width: 0;
  display: grid;
  line-height: 1.25;
}
.chat-who b {
  font-size: .9688rem;
  font-weight: 650;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chat-who small {
  font-size: .8125rem;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chat-who small.live {
  color: var(--green);
  font-weight: 600;
}
.chat-prop {
  display: flex;
  align-items: center;
  gap: .625rem;
  margin: 0 .75rem .5rem;
  padding: .375rem .625rem .375rem .375rem;
  border-radius: .875rem;
  background: var(--soft);
  box-shadow: inset 0 0 0 1px var(--line);
  color: var(--ink);
  transition: background-color 0.2s;
}
.chat-prop:hover {
  background: var(--soft-2);
}
.chat-prop img {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: .625rem;
  object-fit: cover;
  flex-shrink: 0;
}
.chat-prop span {
  flex: 1;
  min-width: 0;
  display: grid;
  line-height: 1.3;
}
.chat-prop b {
  font-size: .8438rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chat-prop b i {
  font-style: normal;
  font-weight: 600;
  color: var(--muted);
}
.chat-prop small {
  font-size: .75rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chat-msgs {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: .375rem .75rem .75rem;
  display: flex;
  flex-direction: column;
  gap: .375rem;
}
.chat-day,
.chat-new {
  display: flex;
  justify-content: center;
  margin: .5rem 0 .25rem;
}
.chat-day span {
  padding: .1875rem .625rem;
  border-radius: 62.4375rem;
  background: var(--soft);
  font-size: .75rem;
  font-weight: 500;
  color: var(--ink-2);
}
.chat-new {
  align-items: center;
  gap: .625rem;
  font-size: .75rem;
  font-weight: 600;
  color: #c0242f;
}
[data-ink='light'] .chat-new {
  color: #ff9aa2;
}
.chat-new::before,
.chat-new::after {
  content: '';
  flex: 1;
  height: 1px;
  background: currentColor;
  opacity: 0.45;
}
.bubble-wrap {
  display: flex;
  min-width: 0;
}
.bubble-wrap.me {
  justify-content: flex-end;
}
.bubble {
  max-width: 86%;
  min-width: 0;
  padding: .4375rem .625rem .3125rem .75rem;
  border-radius: 1.125rem;
  background: var(--soft-2);
  box-shadow: inset 0 0 0 1px var(--line);
  color: var(--ink);
  font-size: .875rem;
  line-height: 1.4;
}
.bubble-wrap.them .bubble {
  border-bottom-left-radius: .375rem;
}
.bubble-wrap.me .bubble {
  background: var(--solid);
  color: var(--on-solid);
  box-shadow: none;
  border-bottom-right-radius: .375rem;
}
.bubble-text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.bubble-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: .1875rem;
  margin-top: .0625rem;
  font-size: .6875rem;
  color: var(--muted);
}
.bubble-wrap.me .bubble-meta {
  color: color-mix(in srgb, var(--on-solid) 78%, transparent);
}
.tick {
  display: inline-flex;
  opacity: 0.8;
}
.tick svg {
  stroke-width: 2.6;
}
.tick svg + svg {
  margin-left: -.5rem;
}
.tick.read {
  opacity: 1;
}

/* albums */
.bubble.k-album {
  width: 16rem;
  padding: .25rem .25rem .3125rem;
}
.bubble.k-album .bubble-text,
.bubble.k-album .bubble-meta {
  padding: 0 .5rem;
}
.bubble.k-album .bubble-text {
  margin-top: .375rem;
}
.album {
  display: grid;
  gap: .1875rem;
  width: 100%;
  border-radius: .9375rem;
  overflow: hidden;
  grid-template-columns: repeat(6, minmax(0, 1fr));
}
.album button {
  position: relative;
  display: block;
  grid-column: span 3;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: var(--soft);
}
.album img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s var(--ease);
}
.album button:hover img {
  transform: scale(1.04);
}
.album.n-1 button {
  grid-column: span 6;
  aspect-ratio: 16 / 10;
}
.album.n-3 button:first-child {
  grid-column: span 6;
  aspect-ratio: 16 / 9;
}
.album.n-5 button:nth-child(n + 3) {
  grid-column: span 2;
  aspect-ratio: 1;
}
.album-more {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgb(10 10 14 / 0.55);
  color: #fff;
  font-size: 1.125rem;
  font-weight: 700;
}

/* voice */
.voice {
  display: flex;
  align-items: center;
  gap: .5rem;
  min-width: 13.75rem;
  max-width: 100%;
  padding-top: .1875rem;
}
.voice-play {
  flex-shrink: 0;
  width: 2.375rem;
  height: 2.375rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--solid);
  color: var(--on-solid);
  transition: transform 0.3s var(--spring);
}
.voice-play:hover {
  transform: scale(1.06);
}
.voice-play:active {
  transform: scale(0.92);
}
.bubble-wrap.me .voice-play {
  background: var(--on-solid);
  color: var(--solid);
}
.voice-wave {
  flex: 1;
  min-width: 0;
  height: 1.75rem;
  display: flex;
  align-items: center;
  gap: 2px;
  overflow: hidden;
}
.voice-wave i {
  flex: 1 1 0;
  min-width: 1.5px;
  max-width: 3px;
  height: var(--h);
  border-radius: 2px;
  background: currentColor;
  opacity: 0.38;
  transition: opacity 0.15s;
}
.voice-wave i.on {
  opacity: 1;
}
.voice-time {
  flex-shrink: 0;
  min-width: 1.875rem;
  text-align: right;
  font-size: .75rem;
  font-weight: 600;
}

/* typing */
.chat-typing[hidden] {
  display: none;
}
.chat-typing .bubble {
  padding: .625rem .75rem;
}
.dots {
  display: flex;
  gap: .25rem;
}
.dots i {
  width: .4375rem;
  height: .4375rem;
  border-radius: 50%;
  background: var(--muted);
  animation: chatDot 1.2s infinite ease-in-out;
}
.dots i:nth-child(2) {
  animation-delay: 0.15s;
}
.dots i:nth-child(3) {
  animation-delay: 0.3s;
}
@keyframes chatDot {
  0%,
  60%,
  100% {
    transform: none;
    opacity: 0.5;
  }
  30% {
    transform: translateY(-.25rem);
    opacity: 1;
  }
}

/* composer */
.chat-form {
  padding: .375rem .75rem .75rem;
}
.chat-strip {
  display: flex;
  gap: .375rem;
  padding-bottom: .5rem;
  overflow-x: auto;
}
.chat-strip[hidden] {
  display: none;
}
.chat-thumb {
  position: relative;
  flex-shrink: 0;
  width: 3.5rem;
  height: 3.5rem;
  border-radius: .75rem;
  overflow: hidden;
}
.chat-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.chat-thumb button {
  position: absolute;
  top: .1875rem;
  right: .1875rem;
  width: 1.125rem;
  height: 1.125rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgb(10 10 14 / 0.65);
  color: #fff;
}
.chat-input,
.chat-rec {
  display: flex;
  align-items: flex-end;
  gap: .25rem;
  min-height: 3rem;
  padding: .3125rem;
  border-radius: 1.5rem;
  background: var(--soft-2);
  box-shadow: inset 0 0 0 1px var(--line-2);
}
.chat-input[hidden],
.chat-rec[hidden] {
  display: none;
}
.chat-input:focus-within {
  box-shadow: inset 0 0 0 1.5px var(--ink-2);
}
.chat-input .icon-btn[hidden],
.chat-send[hidden] {
  display: none;
}
.chat-input textarea {
  flex: 1;
  min-width: 0;
  max-height: 7.5rem;
  padding: .5rem .25rem;
  border: 0;
  background: none;
  resize: none;
  font-size: .875rem;
  line-height: 1.4;
  color: var(--ink);
}
.chat-input textarea:focus-visible {
  outline: none;
}
.chat-input textarea::placeholder {
  color: var(--muted);
}
.chat-send {
  flex-shrink: 0;
  width: 2.375rem;
  height: 2.375rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--solid);
  color: var(--on-solid);
  transition: transform 0.3s var(--spring);
}
.chat-send:hover {
  transform: scale(1.06);
}
.chat-send:active {
  transform: scale(0.92);
}
.chat-rec {
  align-items: center;
  gap: .5rem;
}
.chat-rec-dot {
  width: .625rem;
  height: .625rem;
  border-radius: 50%;
  background: #d92d3a;
  animation: pulse 1.4s infinite;
}
.chat-rec-time {
  font-weight: 700;
}
.chat-rec-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: .8125rem;
  color: var(--muted);
}

/* -------------------------------------------------------------- lightbox -- */
.lb {
  position: fixed;
  inset: 0;
  z-index: 130;
  display: grid;
  place-items: center;
  background: rgb(8 8 12 / 0.9);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  touch-action: pan-y;
}
.lb-stage {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  padding: calc(var(--safe-t) + 3.75rem) calc(var(--safe-r) + 1rem) calc(var(--safe-b) + 3.75rem) calc(var(--safe-l) + 1rem);
  min-height: 0;
}
.lb-stage img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: .75rem;
  user-select: none;
  -webkit-user-select: none;
}
.lb-paper {
  width: min(100%, 75rem);
  height: 100%;
  padding: 1.25rem;
  border-radius: 1rem;
  background: #fbfaf7;
}
.lb-paper .plan-svg {
  display: block;
  width: 100%;
  height: 100%;
}
.lb-count {
  position: absolute;
  top: calc(var(--safe-t) + 1.25rem);
  left: 50%;
  translate: -50% 0;
  color: #fff;
  font-size: .875rem;
  font-weight: 600;
}
.lb-btn {
  position: absolute;
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  background: rgb(255 255 255 / 0.14);
  transition: background-color 0.2s;
}
.lb-btn:hover {
  background: rgb(255 255 255 / 0.26);
}
.lb-close {
  top: calc(var(--safe-t) + .625rem);
  right: calc(var(--safe-r) + .625rem);
}
.lb-prev {
  left: calc(var(--safe-l) + .625rem);
  top: 50%;
  translate: 0 -50%;
}
.lb-next {
  right: calc(var(--safe-r) + .625rem);
  top: 50%;
  translate: 0 -50%;
}

/* ------------------------------------------------- language and currency -- */
.locale-sheet {
  display: grid;
  gap: 1.25rem;
}
#locale-card {
  display: grid;
  gap: 1.25rem;
}
.locale-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .5rem;
  margin-top: .625rem;
}
.locale-btn {
  display: grid;
  place-items: center;
  align-content: center;
  gap: .125rem;
  min-height: var(--h-btn);
  padding: .5rem .375rem;
  border-radius: var(--r-md);
  background: var(--soft);
  box-shadow: inset 0 0 0 1px var(--line-2);
  color: var(--ink);
  text-align: center;
  transition:
    background-color 0.2s,
    color 0.2s,
    transform 0.3s var(--spring);
}
.locale-btn:hover {
  background: var(--soft-2);
}
.locale-btn:active {
  transform: scale(0.97);
}
.locale-btn b {
  font-size: .875rem;
  font-weight: 650;
}
.locale-btn small {
  font-size: .75rem;
  color: var(--muted);
}
.locale-btn.on {
  background: var(--solid);
  color: var(--on-solid);
  box-shadow: none;
}
.locale-btn.on small {
  color: inherit;
  opacity: 0.85;
}
.locale-rate {
  margin-top: .625rem;
  font-size: .8125rem;
  color: var(--muted);
}

/* ==========================================================================
   Phone
   ========================================================================== */
@media (max-width: 760px) {
  .chat-page .chat-tools.card {
    padding: .75rem;
    margin-bottom: var(--gap);
  }
  .chat-page .chat-list.card {
    padding: .375rem;
  }
  /* an open thread takes the whole screen, like any messenger */
  body.chat-thread .topbar,
  body.chat-thread .tabbar {
    display: none;
  }
  body.chat-thread .shell {
    padding: 0;
  }
  body.chat-thread .frame {
    margin: 0;
  }
  body.chat-thread .chat-view.thread {
    position: fixed;
    inset: 0;
    z-index: 35;
    height: 100dvh;
    padding: var(--safe-t) var(--safe-r) var(--safe-b) var(--safe-l);
    background: linear-gradient(160deg, var(--sheen), transparent 40%), var(--glass-strong);
    backdrop-filter: blur(44px) saturate(1.7);
    -webkit-backdrop-filter: blur(44px) saturate(1.7);
  }
  .chat-input textarea {
    font-size: 16px;
  }
  .tab > .chat-badge {
    position: absolute;
    top: .1875rem;
    left: calc(50% + .1875rem);
    box-shadow: 0 0 0 .125rem rgb(255 255 255 / 0.9);
  }
  .lb-prev,
  .lb-next {
    display: none;
  }
  .locale-btn {
    padding: .5rem .25rem;
  }
  .more-grid > :last-child:nth-child(odd) {
    grid-column: 1 / -1;
  }
  /* no shared panel on phones, so each pane carries its text by itself */
  [data-glass='clear'][data-ink='light'] {
    --card-a: 0.62;
  }
  [data-glass='clear'][data-ink='dark'] {
    --card-a: 0.56;
  }
  [data-glass='smoke'] {
    --card-a: 0.62;
  }
  /* the page title lies straight on the wallpaper: calm the brightest one behind it */
  [data-bg='sunset'] .bg-veil {
    background: linear-gradient(180deg, rgb(20 8 24 / 0.5), rgb(20 8 24 / 0.1) 45%);
  }
  /* two buttons side by side keep their words in every language */
  .btn-grid.two .btn {
    padding-inline: .5rem;
    gap: .375rem;
    font-size: .8125rem;
  }
}
