/* Kai outside Telegram (web.js, chat.js): drawn as the Android app is (android_app/reference/kai-mockup.html) — one
   chat in iOS colours, the drawer on the left (search, the pages, «Боты», the person), cards on a grey surface, a
   round input. A phone: the chat fills the screen and the drawer slides out. A computer (1000 px and wider): the
   drawer stays, the chat is in the middle, Kai's browser in the cloud on the right. The Mini App's pages
   (app.css, its iOS skin) are shown in place of the chat. */

html.web {
  --bg: #ffffff;
  --page: #efeff4;
  --section: #ffffff;
  --surface: #f4f4f6;
  --text: #000000;
  --hint: #8e8e93;
  --subtitle: #8e8e93;
  --link: #007aff;
  --accent: #007aff;
  --button: #007aff;
  --button-text: #ffffff;
  --on-accent: #ffffff;
  --section-header: #6d6d72;
  --destructive: #ff3b30;
  --separator: rgba(60, 60, 67, 0.2);
  --fill: rgba(118, 118, 128, 0.12);
  --fill-strong: rgba(118, 118, 128, 0.2);
  --pressed: rgba(0, 0, 0, 0.06);
  --tint: rgba(0, 122, 255, 0.12);
  --green: #34c759;
  --orange: #ff9500;
  --scrim: rgba(0, 0, 0, 0.36);
  --side-w: 300px;
  --cloud-w: min(440px, 36vw);
  --chat-max: 760px;
  --vvh: 100dvh;
  --vvt: 0px;
}
html.web[data-theme="dark"] {
  --bg: #000000;
  --page: #000000;
  --section: #1c1c1e;
  --surface: #1c1c1e;
  --text: #ffffff;
  --hint: #98989f;
  --subtitle: #98989f;
  --link: #0a84ff;
  --accent: #0a84ff;
  --button: #0a84ff;
  --section-header: #98989f;
  --destructive: #ff453a;
  --separator: rgba(84, 84, 88, 0.6);
  --fill: rgba(118, 118, 128, 0.24);
  --fill-strong: rgba(118, 118, 128, 0.34);
  --pressed: rgba(255, 255, 255, 0.07);
  --tint: rgba(10, 132, 255, 0.22);
  --green: #30d158;
  --orange: #ff9f0a;
  --scrim: rgba(0, 0, 0, 0.55);
}
html.web, html.web body { background: var(--bg); }
html.web:not(.web-page) body { overflow: hidden; height: 100%; }
html.web:not(.web-page) .app, html.web .tabbar { display: none !important; }
html.web.web-page .web-chat { display: none; }
html.web.web-page body { background: var(--page); }
html.web.web-wide .app { margin-left: calc(var(--side-w) + max(0px, (100vw - var(--side-w) - 640px) / 2)); }
html.web .appbar-chat { display: none; }
html.web:not(.web-wide) .appbar-chat {
  grid-column: 1;
  justify-self: start;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  min-height: 44px;
  padding: 0 10px 0 2px;
  border: 0;
  background: none;
  color: var(--link);
  font-size: 17px;
}
html.web:not(.web-wide) .appbar-chat .i { --i: 24px; stroke-width: 2.4; }
html.web:not(.web-wide) body.sub .appbar-chat { display: none; }

/* ---- buttons with an icon only ------------------------------------------------------------- */
.wbtn {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--text);
  transition: background 0.15s ease, transform 0.15s ease, opacity 0.15s ease;
}
.wbtn .i { --i: 24px; stroke-width: 1.8; }
.wbtn:active { background: var(--pressed); }
@media (hover: hover) and (pointer: fine) { .wbtn:hover { background: var(--pressed); } }
.wi path { stroke-width: 1.9; }

/* ---- the drawer ------------------------------------------------------------------------------ */
.web-side {
  position: fixed;
  z-index: 30;
  left: 0;
  top: var(--vvt);
  height: var(--vvh);
  width: var(--side-w);
  display: flex;
  flex-direction: column;
  padding-top: calc(14px + var(--safe-top));
  background: var(--bg);
  border-right: 0.5px solid var(--separator);
  color: var(--text);
}
html.web:not(.web-wide) .web-side {
  width: 86%;
  max-width: 360px;
  border-right: 0;
  transform: translateX(-102%);
  transition: transform 0.3s cubic-bezier(0.2, 0.9, 0.25, 1);
}
html.web.drawer-open:not(.web-wide) .web-side { transform: none; box-shadow: 0 0 40px rgba(0, 0, 0, 0.25); }
.web-scrim { position: fixed; inset: 0; z-index: 29; background: var(--scrim); opacity: 0; pointer-events: none; transition: opacity 0.25s; }
html.web.drawer-open:not(.web-wide) .web-scrim { opacity: 1; pointer-events: auto; }
.d-search { display: flex; align-items: center; gap: 8px; margin: 6px 12px 4px; padding: 0 12px; border-radius: 12px; background: var(--fill); color: var(--hint); }
.d-search .i { --i: 18px; stroke-width: 2; }
.d-search input { flex: 1; min-width: 0; padding: 10px 0; border: 0; background: none; color: var(--text); font-size: 16.5px; outline: none; -webkit-appearance: none; appearance: none; }
.d-search input::placeholder { color: var(--hint); }
.d-search input::-webkit-search-cancel-button { display: none; }
.d-nav { padding: 4px 8px; }
.nav {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 11px 10px;
  border: 0;
  border-radius: 12px;
  background: none;
  color: var(--text);
  font-size: 17px;
  text-align: left;
}
.nav .i { --i: 24px; stroke-width: 1.8; }
.nav.active { background: var(--tint); color: var(--link); }
.nav:active, .tmain:active { background: var(--pressed); }
@media (hover: hover) and (pointer: fine) { .nav:not(.active):hover, .trow:not(.active):hover { background: var(--pressed); } }
.d-sec { display: flex; justify-content: space-between; align-items: center; padding: 14px 20px 4px; color: var(--hint); font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.1px; }
.d-new { min-height: 44px; margin: -11px 0; padding: 4px 0 4px 10px; border: 0; background: none; color: var(--link); font-size: 14px; font-weight: 500; text-transform: none; }
.d-list { flex: 1; min-height: 0; overflow-y: auto; padding: 4px 8px 8px; scrollbar-width: none; overscroll-behavior: contain; }
.d-list::-webkit-scrollbar { display: none; }
.d-list > * + * { margin-top: 2px; }
.trow { position: relative; display: flex; align-items: center; border-radius: 12px; }
.trow.active { background: var(--tint); }
.tmain { display: flex; flex: 1; min-width: 0; align-items: center; gap: 12px; padding: 8px 10px; border: 0; border-radius: 12px; background: none; color: var(--text); text-align: left; }
.tmain .tx { display: grid; flex: 1; min-width: 0; }
.tmain b { overflow: hidden; font-size: 16.5px; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.tmain small { overflow: hidden; color: var(--hint); font-size: 13px; line-height: 1.25; text-overflow: ellipsis; white-space: nowrap; }
.tmain small.busy { color: var(--link); }
.trow.closed b { color: var(--hint); }
.undot { width: 9px; height: 9px; flex: none; border-radius: 50%; background: var(--accent); }
.more { padding: 8px 12px 8px 4px; border: 0; background: none; color: var(--hint); font-size: 20px; letter-spacing: 1px; line-height: 1; }
.d-foot { flex: none; padding: 8px 12px calc(10px + var(--safe-bottom)); border-top: 0.5px solid var(--separator); }
.who { display: flex; align-items: center; gap: 12px; width: 100%; padding: 8px; border: 0; border-radius: 12px; background: none; color: var(--text); text-align: left; }
.who:active { background: var(--pressed); }
.av { display: grid; place-items: center; width: 34px; height: 34px; flex: none; border-radius: 50%; background: #5856d6; color: #fff; font-size: 15px; font-weight: 600; }
.who b { flex: 1; min-width: 0; overflow: hidden; font-size: 16.5px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }

/* A topic's icon: Kai's face for the general chat, else its emoji (or letter) on its colour. */
.ticon {
  --size: 30px;
  display: grid;
  place-items: center;
  flex: none;
  width: var(--size);
  height: var(--size);
  overflow: hidden;
  border-radius: calc(var(--size) * 0.3);
  background: var(--c, var(--fill));
  line-height: 1;
}
.ticon.gen { border-radius: 50%; background: #e3f6ef; }
/* Kai fits his round: only the ground shadow would be cut by it. */
.ticon.gen .kai-shadow { display: none; }
.ticon .temoji { font-size: calc(var(--size) * 0.533); }
.ticon .tletter { color: #fff; font-size: calc(var(--size) * 0.5); font-weight: 700; }

/* ---- the chat -------------------------------------------------------------------------------- */
.web-chat {
  position: fixed;
  z-index: 10;
  left: 0;
  right: 0;
  top: var(--vvt);
  height: var(--vvh);
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-size: 17px;
  line-height: 1.3;
}
html.web.web-wide .web-chat { left: var(--side-w); }
html.web.web-wide.cloud-open .web-chat { right: var(--cloud-w); }
.web-chat.dropping::after {
  content: "Отпустите — файлы прикрепятся к сообщению";
  position: absolute;
  inset: 12px;
  z-index: 20;
  display: grid;
  place-items: center;
  border: 2px dashed var(--link);
  border-radius: 20px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  color: var(--link);
  font-size: 17px;
  font-weight: 600;
  pointer-events: none;
}
.chat-head {
  position: relative;
  z-index: 3;
  flex: none;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: calc(14px + var(--safe-top)) 8px 8px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
}
html.web-wide .chat-head { padding-top: 10px; }
html.web-wide .head-menu { visibility: hidden; }
.head-more[hidden] { display: inline-grid !important; visibility: hidden; }
.ttl {
  display: flex;
  flex: 1;
  min-width: 0;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 2px 6px;
  border: 0;
  border-radius: 12px;
  background: none;
  color: var(--text);
  text-align: left;
}
.ttl:active { background: var(--pressed); }
.ttl .txt { min-width: 0; }
.ttl b { display: block; overflow: hidden; font-size: 17px; font-weight: 600; line-height: 20px; text-overflow: ellipsis; white-space: nowrap; }
.ttl small { display: block; overflow: hidden; color: var(--hint); font-size: 12.5px; line-height: 15px; text-overflow: ellipsis; white-space: nowrap; }
.ttl small[hidden] { display: none; }
.ttl small.busy { color: var(--link); }
.ttl small.bad { color: var(--destructive); }
.strip {
  flex: none;
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 16px;
  border: 0;
  background: var(--tint);
  color: var(--link);
  font-size: 14px;
  font-weight: 600;
  line-height: 18px;
  text-align: left;
}
.strip[hidden] { display: none; }
.strip > span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.strip.paused { padding: 6px 10px 6px 16px; }
.strip.paused .i { --i: 18px; stroke-width: 2.4; }
.strip-btn { flex: none; padding: 6px 12px; border: 0; border-radius: 10px; background: var(--accent); color: var(--on-accent); font-size: 14px; font-weight: 600; }
.runbar .pulse { width: 8px; height: 8px; flex: none; border-radius: 50%; background: var(--accent); animation: wpulse 1.4s ease-in-out infinite; }
.feeds { position: relative; flex: 1; min-height: 0; }
.feed { position: absolute; inset: 0; overflow-x: hidden; overflow-y: auto; outline: none; overscroll-behavior: contain; scrollbar-width: none; }
.feed[hidden] { display: none; }
.feed::-webkit-scrollbar { display: none; }
@media (hover: hover) and (pointer: fine) {
  .feed { scrollbar-width: thin; }
  .feed::-webkit-scrollbar { display: block; width: 8px; }
  .feed::-webkit-scrollbar-thumb { border-radius: 4px; background: var(--fill-strong); }
}
.feed-inner { display: flex; flex-direction: column; max-width: var(--chat-max); min-height: 100%; margin: 0 auto; padding: 12px 14px 8px; }
.feed-list { display: flex; flex-direction: column; gap: 14px; }
.feed-list + .feed-list:not(:empty) { margin-top: 14px; }
.feed-top { height: 1px; flex: none; }
.feed-top.loading { height: 40px; background: radial-gradient(circle at center, var(--hint) 3px, transparent 4px) center / 14px 14px no-repeat; animation: wpulse 1s ease infinite; }
.feed-empty { display: flex; flex: 1; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 24px 36px; text-align: center; }
.feed-empty[hidden] { display: none; }
.feed-empty .empty-title { font-size: 17px; font-weight: 600; line-height: 22px; }
.day { align-self: center; padding: 2px 10px; border-radius: 999px; background: var(--fill); color: var(--hint); font-size: 12px; }

/* A message: Kai's is text on the page, the person's own a grey bubble on the right. */
.msg { position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 3px; transition: transform 0.15s ease; }
.msg[hidden] { display: none; }
.msg.from-kai > .bubble { align-self: stretch; }
.msg.from-me { align-items: flex-end; }
.msg .bubble { max-width: 100%; overflow-wrap: anywhere; }
.msg.from-me .bubble { max-width: 82%; padding: 9px 14px; border-radius: 20px; background: var(--fill); font-size: 16.5px; line-height: 1.35; }
.msg.from-me .bubble:has(> .files:only-child) { padding: 0; background: none; }
.msg.from-kai .bubble { font-size: 16.5px; line-height: 1.42; }
.msg.from-me .text { white-space: pre-wrap; }
.msg.pending .bubble { opacity: 0.7; }
.msg.failed .bubble { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--destructive) 55%, transparent); }
.msg-failed { display: inline-flex; align-items: center; gap: 5px; padding: 1px 2px; border: 0; background: none; color: var(--destructive); font-size: 12.5px; font-weight: 600; text-align: right; }
.msg-failed .i { --i: 15px; }
.msg-time { display: none; color: var(--hint); font-size: 11.5px; }
.msg-time .i { --i: 13px; }
.msg.pending .msg-time { display: inline-flex; }
/* A touch screen has no hover: the time shows under the message tapped. */
.msg.selected > .msg-time { display: block; }
.msg.selected .bubble { box-shadow: 0 0 0 2px color-mix(in srgb, var(--link) 35%, transparent); }
.msg.from-kai.selected .bubble { border-radius: 6px; }
/* 👍/👎 under Kai's answer: small and grey, the one chosen in the text's colour, softly filled. */
.marks { display: flex; gap: 2px; margin: -2px 0 0 -7px; }
.marks .mark { width: 30px; height: 30px; color: var(--hint); opacity: 0.75; }
.marks .mark .i { --i: 16px; stroke-width: 1.9; }
.marks .mark.on { color: var(--text); opacity: 1; }
.marks .mark.on .i path { fill: currentColor; fill-opacity: 0.18; }
.marks .mark:active { transform: scale(0.88); }
.pills { display: flex; gap: 8px; padding-top: 3px; animation: wrise 0.18s ease; }
.pill-act {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border: 0.5px solid var(--separator);
  border-radius: 999px;
  background: var(--section);
  color: var(--link);
  font-size: 14px;
  font-weight: 600;
  line-height: 18px;
}
.pill-act .i { --i: 16px; stroke-width: 2.2; }
@keyframes wrise { from { opacity: 0; transform: translateY(-4px); } }
.msg-tools { position: absolute; top: -8px; display: none; gap: 2px; padding: 2px; border-radius: 12px; background: var(--section); box-shadow: 0 0 0 0.5px var(--separator), 0 4px 14px rgba(0, 0, 0, 0.12); }
.msg.from-kai .msg-tools { right: 0; }
.msg.from-me .msg-tools { right: calc(min(82%, 600px) + 8px); }
.msg-tools .wbtn { width: 30px; height: 30px; color: var(--hint); }
.msg-tools .wbtn .i { --i: 18px; }
@media (hover: hover) and (pointer: fine) { .msg:hover > .msg-tools { display: flex; } .msg:hover > .msg-time { display: block; } }
.msg.flash .bubble, .msg.flash > .wcard { animation: wflash 1.4s ease-out; }
@keyframes wflash { 0%, 30% { box-shadow: 0 0 0 4px color-mix(in srgb, var(--link) 35%, transparent); } 100% { box-shadow: 0 0 0 4px transparent; } }
.msg-prose { padding: 0; border-radius: 0; background: none; box-shadow: none; font-size: 16.5px; line-height: 1.42; }
.ios .msg-prose, .android .msg-prose { padding: 0; box-shadow: none; }
.msg-prose p, .msg-prose ul, .msg-prose ol, .msg-prose blockquote, .msg-prose pre { margin: 0 0 10px; }
.msg-prose > :last-child { margin-bottom: 0; }
.msg-prose ul, .msg-prose ol { padding-left: 22px; }
.msg-prose li + li { margin-top: 3px; }
.msg-prose h1, .msg-prose h2, .msg-prose h3, .msg-prose h4 { margin: 14px 0 6px; font-size: 17.5px; line-height: 1.3; }
.msg-prose > :first-child { margin-top: 0; }
.msg-prose :not(pre) > code { padding: 1px 5px; border-radius: 5px; background: var(--fill); font-size: 14px; }
.msg-prose pre { padding: 12px; border-radius: 12px; background: var(--fill); overflow-x: auto; }
.msg-prose pre code { font-size: 13.5px; }
.msg-prose hr { height: 0; margin: 14px 0; border: 0; border-top: 0.5px solid var(--separator); }
.msg-prose blockquote { padding-left: 12px; border-left: 3px solid var(--accent); }
.msg-prose .result-table { margin: 6px 0 12px; overflow-x: auto; border-radius: 12px; background: var(--surface); }
.msg-prose table { display: table; width: 100%; margin: 0; border-collapse: collapse; font-size: 14.5px; }
.msg-prose th, .msg-prose td { padding: 8px 12px; border-bottom: 0.5px solid var(--separator); text-align: left; }
.msg-prose tr:last-child td { border-bottom: 0; }
.msg-prose th { color: var(--hint); font-weight: 600; }
.msg-prose.plain p { white-space: pre-line; }
.msg-prose a, .msg .text a { color: var(--link); text-decoration: none; }
.msg-actions { margin-top: 10px; }
.msg.error .bubble { color: var(--hint); }
.transcript { margin-top: 5px; color: var(--hint); font-size: 14px; line-height: 1.35; white-space: pre-wrap; }
.transcript.failed { font-style: italic; }
.wquote {
  display: flex;
  flex-direction: column;
  width: 100%;
  min-width: 140px;
  margin-bottom: 6px;
  padding: 4px 8px 4px 11px;
  border: 0;
  border-radius: 8px;
  background: var(--tint) linear-gradient(var(--accent), var(--accent)) left / 3px 100% no-repeat;
  color: inherit;
  text-align: left;
}
.wquote-who { color: var(--link); font-size: 12.5px; font-weight: 600; line-height: 16px; }
.wquote-text { overflow: hidden; font-size: 14px; line-height: 18px; opacity: 0.85; text-overflow: ellipsis; white-space: nowrap; }
.place { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; }
.place .i { color: var(--destructive); }
.place > span { display: flex; flex-direction: column; font-size: 14px; }
.place > span span { color: var(--hint); font-size: 13px; }
.typing { display: flex; gap: 4px; margin-top: 14px; padding: 6px 2px; }
.typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--hint); animation: wblink 1.1s infinite; }
.typing span:nth-child(2) { animation-delay: 0.15s; }
.typing span:nth-child(3) { animation-delay: 0.3s; }
.typing[hidden] { display: none; }
@keyframes wblink { 0%, 60%, 100% { opacity: 0.3; } 30% { opacity: 1; } }
@keyframes wpulse { 50% { opacity: 0.35; transform: scale(0.85); } }
.shake { animation: wshake 0.4s ease; }
@keyframes wshake { 20%, 60% { transform: translateX(-5px); } 40%, 80% { transform: translateX(5px); } }

/* Kai's keyboard under a message. */
.kb { display: flex; flex-direction: column; gap: 8px; width: 100%; max-width: 520px; margin-top: 7px; }
.kb-row { display: flex; gap: 8px; }
.kb-btn {
  display: inline-flex;
  flex: 1;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 11px 12px;
  border: 0;
  border-radius: 12px;
  background: var(--tint);
  color: var(--link);
  font-size: 16px;
  font-weight: 600;
  line-height: 1.25;
}
.kb-btn .i { --i: 16px; }
.kb-btn.success, .kb-btn.primary { background: var(--accent); color: var(--on-accent); }
.kb-btn.danger { background: var(--fill); color: var(--destructive); }
.kb-btn.pressing, .kb-btn:disabled { opacity: 0.55; }
.kb-btn:active { opacity: 0.8; }
.kb-done { display: inline-flex; align-items: center; color: var(--hint); font-size: 14px; }

/* ---- cards ---------------------------------------------------------------------------------- */
.msg.event { max-width: 100%; }
.msg.event > .wcard:not(.folded) { align-self: stretch; }
.wcard { display: grid; gap: 10px; width: 100%; max-width: 560px; padding: 12px; border-radius: 16px; background: var(--surface); }
.wcard.folded { display: inline-flex; align-items: center; gap: 8px; width: auto; padding: 0 2px; background: none; color: var(--hint); font-size: 14.5px; }
/* The voice call that goes (cards.js voiceCard): Kai in the middle over a soft teal, the voices as bars. */
.wcard.vcall { --vc: var(--kai-teal); justify-items: center; gap: 6px; padding: 16px; border-radius: 20px; text-align: center; background: linear-gradient(180deg, color-mix(in srgb, var(--vc) 16%, var(--surface)), var(--surface) 85%); box-shadow: 0 4px 16px rgba(31, 42, 51, 0.1); }
html.web[data-theme="dark"] .wcard.vcall { --vc: #2bc4bc; background: linear-gradient(180deg, color-mix(in srgb, var(--vc) 22%, var(--surface)), var(--surface) 85%); box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35); }
.vcall .kai { transition: opacity 0.2s ease; }
.vcall .kai.muted { opacity: 0.55; }
.vcall-title { margin-top: 2px; font-size: 16px; font-weight: 600; line-height: 1.3; }
.vcall-bars { display: flex; align-items: center; gap: 3px; height: 20px; }
.vcall-bars[hidden], .vcall-title[hidden] { display: none; }
.vcall-bars i { width: 3px; height: 20px; border-radius: 2px; background: var(--vc); transform: scaleY(0.2); }
.vcall-state { color: var(--hint); font-size: 13px; font-variant-numeric: tabular-nums; }
.wcard-head { display: flex; align-items: center; gap: 8px; }
.wcard-dot { width: 9px; height: 9px; flex: none; border-radius: 50%; background: var(--hint); }
.wcard-head .wcard-dot { align-self: flex-start; margin-top: 6px; }
.wcard-dot.accent { background: var(--accent); }
.wcard-dot.run { background: var(--accent); animation: wpulse 1.4s ease-in-out infinite; }
.wcard-dot.warn { background: var(--orange); }
.wcard-dot.ok { background: var(--green); }
.wcard-dot.bad { background: var(--destructive); }
.wcard-dot.none { background: var(--hint); }
.wcard-titles { display: flex; flex: 1; flex-direction: column; min-width: 0; gap: 2px; }
.wcard-title { font-size: 16px; font-weight: 600; line-height: 1.3; }
.wcard-title-link { padding: 0; border: 0; background: none; color: inherit; font-family: inherit; text-align: start; cursor: pointer; }
.wcard-title-link:hover { color: var(--link); }
.wcard-sub { color: var(--hint); font-size: 14px; line-height: 1.35; overflow-wrap: anywhere; }
.wcard-pill { flex: none; align-self: flex-start; padding: 3px 9px; border-radius: 999px; background: var(--tint); color: var(--link); font-size: 12px; font-weight: 600; white-space: nowrap; }
.wcard-quote { margin: 0; padding: 10px 12px; border-radius: 10px; background: var(--fill); font-size: 15px; line-height: 1.4; white-space: pre-wrap; overflow-wrap: anywhere; }
.wcard-hint { color: var(--hint); font-size: 13px; line-height: 1.35; }
.wcard-actions { display: flex; gap: 8px; }
.wcard-btn { display: inline-flex; flex: 1; align-items: center; justify-content: center; padding: 11px 12px; border: 0; border-radius: 12px; font-size: 16px; font-weight: 600; }
.wcard-btn.primary { background: var(--accent); color: var(--on-accent); }
.wcard-btn.ghost { background: var(--tint); color: var(--link); }
.wcard-btn:active { opacity: 0.8; }
.wcard-btn:disabled, .wcard-btn.pressing { opacity: 0.6; }
.wcard-options { display: grid; gap: 8px; }
.wcard-options.busy { opacity: 0.6; pointer-events: none; }
.wcard-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-radius: 10px;
  background: var(--fill);
  color: var(--text);
  font-size: 15.5px;
  text-align: left;
}
.wcard-option > span:first-child { flex: 1; }
.wcard-option .i { --i: 18px; color: var(--hint); }
.choice-main { display: flex; flex: 1; flex-direction: column; gap: 2px; min-width: 0; }
.choice-main b { font-weight: 600; }
.choice-main span { color: var(--hint); font-size: 13px; }
.choice-price { font-weight: 600; white-space: nowrap; }
.wcard-option.more { padding-top: 4px; padding-bottom: 4px; background: none; }
.wcard-steps { display: grid; gap: 7px; margin: 0; padding: 0; list-style: none; font-size: 15px; }
.wcard-steps li { display: flex; align-items: center; gap: 10px; color: var(--hint); }
.wcard-steps li::before { content: ""; width: 16px; height: 16px; flex: none; box-sizing: border-box; border: 1.7px solid var(--hint); border-radius: 50%; }
.wcard-steps li.done { color: var(--text); }
.wcard-steps li.done::before { border-color: var(--green); background: var(--green); }
.wcard-steps li.run { color: var(--text); font-weight: 600; }
.wcard-steps li.run::before { border-color: var(--accent); background: radial-gradient(circle, var(--accent) 38%, transparent 42%); }
.wcard-code { width: 100%; padding: 12px; border: 0; border-radius: 12px; background: var(--fill); color: var(--text); font-size: 26px; font-weight: 600; letter-spacing: 8px; text-align: center; }
.wcard-code::placeholder { color: var(--hint); font-size: 22px; font-weight: 400; letter-spacing: 1px; }
.wcard-code:focus { outline: none; box-shadow: inset 0 0 0 1.5px var(--accent); }
.wcard-code.sent { opacity: 0.6; }
.wcard-code-row { display: flex; gap: 8px; }
.wcard-code-row .wcard-code { flex: 1; min-width: 0; }
.wcard-code-row .wcard-btn { flex: none; }

/* ---- files ---------------------------------------------------------------------------------- */
.files { display: grid; gap: 6px; }
.files:not(:last-child) { margin-bottom: 8px; }
.grid { display: grid; gap: 4px; width: min(100%, 420px); overflow: hidden; border-radius: 14px; }
.grid.n2, .grid.n3, .grid.n4 { grid-template-columns: 1fr 1fr; }
.grid.n3 .tile-media:first-child { grid-column: 1 / -1; aspect-ratio: 2 / 1; }
.tile-media { position: relative; display: block; width: 100%; padding: 0; overflow: hidden; border: 0; background: var(--fill); aspect-ratio: 1; cursor: zoom-in; }
.grid.n1 .tile-media { aspect-ratio: 4 / 3; max-height: 460px; }
.tile-media img { display: block; width: 100%; height: 100%; object-fit: cover; }
.play-badge { position: absolute; left: 50%; top: 50%; display: grid; place-items: center; width: 46px; height: 46px; margin: -23px 0 0 -23px; border-radius: 50%; background: rgba(255, 255, 255, 0.9); color: #111; }
.play-badge .i { --i: 18px; fill: currentColor; }
.dur { position: absolute; right: 8px; bottom: 8px; padding: 1px 7px; border-radius: 6px; background: rgba(0, 0, 0, 0.6); color: #fff; font-size: 12px; }
.svg-image { max-width: min(100%, 360px); border-radius: 12px; background: #fff; }
.voice { display: flex; align-items: center; gap: 12px; min-width: 220px; max-width: 320px; }
.msg.from-me .voice { padding: 8px 14px 8px 8px; border-radius: 20px; background: var(--fill); }
.msg.from-me .bubble:has(.voice) { padding: 0; background: none; }
.voice-play { display: grid; place-items: center; width: 44px; height: 44px; flex: none; padding: 0; border: 0; border-radius: 50%; background: var(--accent); color: var(--on-accent); }
.msg.from-me .voice-play { width: 36px; height: 36px; }
.voice-play .i { --i: 18px; fill: currentColor; }
.voice-main { display: flex; flex: 1; flex-direction: column; gap: 2px; min-width: 0; }
.voice-wave { display: flex; align-items: center; gap: 2px; height: 36px; cursor: pointer; }
.voice-wave i { flex: 1; min-width: 2px; border-radius: 2px; background: var(--hint); opacity: 0.4; }
.voice-wave i.on { background: var(--accent); opacity: 1; }
.voice-time { color: var(--hint); font-size: 12px; font-variant-numeric: tabular-nums; }
.voice-wrap { display: flex; flex-direction: column; }
.track { display: flex; align-items: center; gap: 12px; min-width: 240px; max-width: 380px; padding: 12px; border-radius: 16px; background: var(--surface); }
.msg.from-me .track { background: var(--fill); }
.track-main { display: flex; flex: 1; flex-direction: column; gap: 4px; min-width: 0; }
.track-name { overflow: hidden; font-size: 16px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.track-bar { height: 4px; border-radius: 2px; background: var(--fill-strong); cursor: pointer; }
.track-bar i { display: block; width: var(--done, 0%); height: 100%; border-radius: 2px; background: var(--accent); }
.track-time { color: var(--hint); font-size: 12px; font-variant-numeric: tabular-nums; }
.round { width: 220px; height: 220px; border-radius: 50%; object-fit: cover; background: var(--fill); }
.animation { max-width: min(100%, 320px); border-radius: 14px; }
.wsticker { width: 160px; height: auto; }
.doc { display: flex; align-items: center; gap: 12px; width: min(100%, 380px); padding: 11px 12px; border: 0; border-radius: 16px; background: var(--surface); color: inherit; text-align: left; }
.msg.from-me .doc { background: var(--fill); }
.doc .tile { --tile: 38px; --tile-radius: 10px; }
.doc > .i { --i: 20px; color: var(--hint); }
.doc-main { display: flex; flex: 1; flex-direction: column; min-width: 0; }
.doc-name { overflow: hidden; font-size: 16px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.doc-size { color: var(--hint); font-size: 13px; }
.save { width: 34px; height: 34px; color: var(--hint); }
.poll { display: grid; gap: 8px; min-width: 240px; max-width: 420px; padding: 12px; border-radius: 16px; background: var(--surface); }
.poll-q { font-weight: 600; }
.poll-option { position: relative; display: flex; justify-content: space-between; gap: 8px; width: 100%; padding: 10px 12px; overflow: hidden; border: 0; border-radius: 10px; background: var(--fill); color: var(--text); font-size: 15.5px; text-align: left; }
.poll-option.chosen { box-shadow: inset 0 0 0 1.5px var(--accent); }
.poll-bar { position: absolute; inset: 0 auto 0 0; background: var(--tint); transition: width 0.4s; }
.poll-text, .poll-share { position: relative; }
.poll-text { flex: 1; }
.poll-share { color: var(--hint); font-size: 13px; }
.poll-total { color: var(--hint); font-size: 13px; }

/* ---- the dock: suggestions, the reply, the tray, the input ------------------------------------ */
.dock { position: relative; z-index: 2; flex: none; background: var(--bg); }
.dock-inner { position: relative; display: grid; gap: 8px; max-width: var(--chat-max); margin: 0 auto; padding: 4px 12px calc(10px + var(--safe-bottom)); }
.down {
  position: absolute;
  right: 14px;
  bottom: calc(100% + 8px);
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 0.5px solid var(--separator);
  border-radius: 50%;
  background: var(--section);
  color: var(--text);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
}
.down[hidden] { display: none; }
.down .i { --i: 20px; stroke-width: 2.2; }
.down-count { position: absolute; top: -6px; right: -4px; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--accent); color: #fff; font-size: 12px; font-weight: 600; line-height: 20px; text-align: center; }
.down-count[hidden] { display: none; }
.chat-banners:empty { display: none; }
.chat-banners { display: grid; gap: 6px; }
.chat-banner { display: flex; align-items: center; gap: 10px; padding: 8px 6px 8px 14px; border-radius: 16px; background: var(--tint); color: var(--link); font-size: 14px; font-weight: 600; }
.chat-banner .banner-line { flex: 1; }
.chat-banner .btn { border-radius: 10px; }
.chat-banner .wbtn { width: 32px; height: 32px; color: var(--link); }
.chips.suggestions { display: flex; gap: 8px; margin: 0; padding: 0 0 2px; overflow-x: auto; scrollbar-width: none; }
.chips.suggestions[hidden] { display: none; }
.chip.suggestion { flex: none; height: auto; padding: 8px 14px; border: 1px solid var(--separator); border-radius: 999px; background: var(--bg); color: var(--text); box-shadow: none; font-size: 14.5px; font-weight: 400; white-space: nowrap; }
@media (hover: hover) and (pointer: fine) { .chip.suggestion:hover { background: var(--pressed); } }
.replybar { display: flex; align-items: center; gap: 10px; padding: 4px 4px 4px 12px; }
.replybar[hidden] { display: none; }
.replybar > .i { --i: 20px; color: var(--link); }
.reply-main { display: flex; flex: 1; flex-direction: column; min-width: 0; padding: 2px 8px 2px 11px; border-radius: 8px; background: var(--tint) linear-gradient(var(--accent), var(--accent)) left / 3px 100% no-repeat; }
.reply-who { color: var(--link); font-size: 12.5px; font-weight: 600; line-height: 16px; }
.reply-text { overflow: hidden; font-size: 14px; line-height: 18px; text-overflow: ellipsis; white-space: nowrap; }
.replybar .wbtn { width: 32px; height: 32px; color: var(--hint); }
.tray { display: flex; gap: 8px; padding: 2px 0; overflow-x: auto; scrollbar-width: none; }
.tray[hidden] { display: none; }
.tray-item { position: relative; flex: none; width: 72px; height: 72px; overflow: hidden; border-radius: 14px; background: var(--fill); }
.tray-item.failed { box-shadow: inset 0 0 0 2px var(--destructive); }
.tray-thumb { display: block; width: 100%; height: 100%; object-fit: cover; }
.tray-file { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; width: 100%; height: 100%; padding: 6px; color: var(--hint); font-size: 11px; text-align: center; }
.tray-file span { width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tray-remove { position: absolute; top: 3px; right: 3px; width: 22px; height: 22px; background: rgba(0, 0, 0, 0.55); color: #fff; }
.tray-remove .i { --i: 14px; }
.tray-progress { position: absolute; left: 6px; right: 6px; bottom: 6px; height: 4px; border-radius: 2px; background: rgba(0, 0, 0, 0.35); }
.tray-progress::after { content: ""; display: block; width: var(--p, 0%); height: 100%; border-radius: 2px; background: #fff; transition: width 0.2s ease; }
.closed-bar { display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 0 16px; border-radius: 28px; background: var(--fill); color: var(--hint); font-size: 16px; }
.closed-bar[hidden] { display: none; }
.closed-bar > span { flex: 1; }
.strip-link { border: 0; background: none; color: var(--link); font-size: 15px; font-weight: 600; }
.composer { position: relative; display: flex; align-items: flex-end; gap: 6px; padding: 5px; border-radius: 28px; background: var(--fill); }
.composer[hidden] { display: none; }
.composer .winput { flex: 1; min-width: 0; max-height: 35vh; margin: 0; padding: 8px 4px; border: 0; background: none; color: var(--text); font-size: 17px; line-height: 22px; resize: none; outline: none; }
.composer .winput::placeholder { color: var(--hint); }
.cbtn { width: 38px; height: 38px; background: var(--section); color: var(--text); }
.cbtn .i { --i: 20px; stroke-width: 2; }
@media (hover: hover) and (pointer: fine) { .cbtn:hover { background: var(--section); opacity: 0.85; } }
.cbtn.send { background: var(--text); color: var(--bg); }
.cbtn.send .i { stroke-width: 2.4; }
.cbtn.send.busy { opacity: 0.6; }
.cbtn[hidden] { display: none; }
.composer .mic { touch-action: none; }
.rec-bar { position: absolute; inset: 0; display: flex; align-items: center; gap: 10px; padding: 0 5px 0 16px; border-radius: inherit; background: var(--surface); transform: translateX(var(--slide, 0)); }
.rec-bar[hidden] { display: none; }
.composer.recording:not(.locked) .mic { position: relative; z-index: 2; background: var(--destructive); color: #fff; transform: scale(1.12); }
.composer.recording:not(.locked) .rec-bar { padding-right: 52px; }
.rec-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--destructive); animation: wpulse 1s ease infinite; }
.rec-time { font-size: 15px; font-variant-numeric: tabular-nums; }
.rec-wave { flex: 1; height: 4px; border-radius: 2px; background: linear-gradient(90deg, var(--accent) calc(var(--level, 0) * 100%), var(--fill-strong) 0); }
.rec-hint { color: var(--hint); font-size: 13.5px; white-space: nowrap; }
.rec-cancel, .rec-send { display: none !important; }
.composer.locked .rec-cancel, .composer.locked .rec-send { display: inline-grid !important; }
.composer.locked .rec-hint, .composer.locked .mic { display: none; }
.composer.locked .rec-bar { padding-left: 5px; }
.rec-send { width: 38px; height: 38px; background: var(--text); color: var(--bg); }
.rec-cancel { width: 38px; height: 38px; color: var(--destructive); }

/* ---- a topic's sheet: its icon and colour (chat.js topicForm) -------------------------------- */
.input-group .topic-icons { display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: 4px; max-height: 196px; padding: 8px; overflow-y: auto; }
.topic-icon { display: grid; place-items: center; height: 44px; padding: 0; border: 0; border-radius: 12px; background: none; font-size: 24px; line-height: 1; }
.topic-icon.none .i { --i: 20px; color: var(--hint); }
.topic-icon[aria-checked="true"] { background: var(--tint); box-shadow: inset 0 0 0 2px var(--accent); }
.input-group .topic-colors { display: flex; flex-wrap: wrap; gap: 12px; padding: 12px; }
.topic-color { width: 34px; height: 34px; padding: 0; border: 0; border-radius: 50%; background: var(--topic); }
.topic-color[aria-checked="true"] { box-shadow: 0 0 0 3px var(--section), 0 0 0 5px var(--topic); }

/* ---- the viewer of photos and videos ------------------------------------------------------- */
.viewer { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; background: rgba(0, 0, 0, 0.94); outline: none; }
.viewer-stage { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; padding: calc(56px + var(--safe-top)) 8px calc(16px + var(--safe-bottom)); }
.viewer-stage img, .viewer-stage video { max-width: 100%; max-height: 100%; border-radius: 4px; object-fit: contain; }
.viewer-bar { position: absolute; top: 0; left: 0; right: 0; display: flex; align-items: center; gap: 4px; padding: calc(8px + var(--safe-top)) 8px 8px 16px; color: #fff; }
.viewer-bar .wbtn { color: #fff; }
.viewer-space { flex: 1; }
.viewer-count { font-size: 15px; }
.viewer-prev, .viewer-next { position: absolute; top: 50%; width: 48px; height: 48px; margin-top: -24px; background: rgba(255, 255, 255, 0.12); color: #fff; }
.viewer-prev { left: 12px; }
.viewer-next { right: 12px; }
@media (pointer: coarse) { .viewer-prev, .viewer-next { display: none; } }

/* ---- Kai's browser in the cloud (cloud.js) -------------------------------------------------- */
.web-cloud { position: fixed; z-index: 40; top: var(--vvt); right: 0; display: flex; flex-direction: column; width: 100%; height: var(--vvh); padding-bottom: var(--safe-bottom); background: var(--bg); color: var(--text); }
.web-cloud[hidden] { display: none; }
html.web-wide .web-cloud { z-index: 12; width: var(--cloud-w); border-left: 0.5px solid var(--separator); }
.cloud-head { display: flex; align-items: center; gap: 6px; padding: calc(14px + var(--safe-top)) 8px 8px 16px; }
html.web-wide .cloud-head { padding-top: 10px; }
.cloud-titles { display: flex; flex: 1; flex-direction: column; min-width: 0; }
.cloud-title { font-size: 17px; font-weight: 600; line-height: 20px; }
.cloud-site { overflow: hidden; color: var(--hint); font-size: 12.5px; line-height: 15px; text-overflow: ellipsis; white-space: nowrap; }
.cloud-stage { display: flex; flex: 1; min-height: 0; align-items: center; justify-content: center; padding: 8px 14px 12px; }
.cloud-frame { position: relative; height: 100%; max-width: 100%; overflow: hidden; border-radius: 20px; background: #fff; box-shadow: 0 0 0 0.5px var(--separator); aspect-ratio: 360 / 784; transition: box-shadow 0.2s ease; }
@supports not (aspect-ratio: 1) { .cloud-frame { width: min(100%, 46vh); height: auto; } }
html:not(.web-wide) .cloud-stage { padding: 0; }
html:not(.web-wide) .cloud-frame { width: 100%; height: auto; max-height: 100%; border-radius: 0; box-shadow: none; }
.web-cloud.in-hand .cloud-frame { box-shadow: 0 0 0 3px var(--accent); }
html:not(.web-wide) .web-cloud.in-hand .cloud-frame { box-shadow: inset 0 0 0 3px var(--accent); }
.cloud-screen { display: block; width: 100%; height: 100%; object-fit: contain; outline: none; touch-action: none; user-select: none; -webkit-user-select: none; }
.cloud-veil { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 24px; background: var(--surface); color: var(--hint); font-size: 15px; text-align: center; }
.cloud-veil[hidden] { display: none; }
.cloud-spinner { width: 28px; height: 28px; border: 3px solid var(--fill-strong); border-top-color: var(--accent); border-radius: 50%; animation: wspin 0.9s linear infinite; }
.cloud-veil.still .cloud-spinner { display: none; }
@keyframes wspin { to { transform: rotate(360deg); } }
.cloud-status { padding: 8px 16px; background: var(--tint); color: var(--link); font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cloud-status[hidden] { display: none; }
.cloud-ask { display: grid; gap: 8px; padding: 10px 14px 12px; }
.cloud-ask[hidden] { display: none; }
.cloud-ask-text { color: var(--text); font-size: 15px; font-weight: 600; text-align: center; }
.cloud-ask .btn { border-radius: 12px; }
.cloud-keys { position: absolute; left: 0; bottom: 0; width: 1px; height: 1px; padding: 0; border: 0; opacity: 0; font-size: 16px; resize: none; pointer-events: none; }

/* The Mini App's toast: above the input, in the middle of the chat on a computer. */
html.web:not(.web-page) body > .toast { z-index: 60; bottom: calc(84px + var(--safe-bottom)); }
html.web.web-wide:not(.web-page) body > .toast { left: calc(var(--side-w) + (100vw - var(--side-w)) / 2); }
html.web.web-wide.cloud-open:not(.web-page) body > .toast { left: calc(var(--side-w) + (100vw - var(--side-w) - var(--cloud-w)) / 2); }
html.web.web-page .toast { bottom: calc(20px + var(--safe-bottom)); }

@media (prefers-reduced-motion: reduce) {
  .web-side, .web-scrim, .msg, .typing span, .wcard-dot.run, .rec-dot, .runbar .pulse, .pills { transition: none; animation: none; }
}

/* The person's photo with a caption: the picture to the bubble's edges, the caption under it. */
.msg.from-me .bubble:has(> .files .grid) { max-width: min(82%, 420px); padding: 4px; }
.msg.from-me .bubble:has(> .files .grid) .grid { width: 100%; border-radius: 16px; }
.msg.from-me .bubble:has(> .files .grid) > .text { padding: 5px 10px 4px; }
.msg.from-me .bubble:has(> .files .grid) > .wquote { width: auto; margin: 0 0 4px; }

/* Kai's live answers (live.js): his text, then blocks as the Android app draws them — cards on the grey surface,
   pills, a graphite ink; coloured tags only where a colour says something (risk, plus and minus). */
html.web { --live-ink: color-mix(in srgb, var(--text) 82%, transparent); --live-eyebrow: #e0782e; }
.live { display: grid; gap: 12px; min-width: 0; }
.live > * { min-width: 0; }
.lcard { display: grid; gap: 10px; padding: 14px 16px; border-radius: 18px; background: var(--surface); }
.lhead { display: flex; align-items: baseline; gap: 10px; }
.ltitle { flex: 1; min-width: 0; font-size: 16px; font-weight: 600; line-height: 1.3; }
.laside { flex: none; color: var(--hint); font-size: 13.5px; }
.lnote { color: var(--hint); font-size: 13px; line-height: 1.35; }
.lscroll { overflow-x: auto; scrollbar-width: thin; }
.lrow-scroll { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 4px; scroll-snap-type: x proximity; scrollbar-width: thin; }
.lrow-scroll > * { scroll-snap-align: start; }

/* tags and source chips */
.ltag { display: inline-block; max-width: 100%; padding: 2px 7px; border-radius: 6px; font-size: 12.5px; font-weight: 600; line-height: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; vertical-align: top; }
.ltag.wrap { white-space: normal; justify-self: start; }
.ltag.bad { color: #e5484d; background: rgba(229, 72, 77, 0.16); }
.ltag.warn { color: #f08c2e; background: rgba(240, 140, 46, 0.16); }
.ltag.good { color: #3fa36b; background: rgba(63, 163, 107, 0.16); }
.ltag.neutral { color: var(--hint); background: var(--fill); }
.ltag.eyebrow { color: var(--live-eyebrow); background: color-mix(in srgb, var(--live-eyebrow) 16%, transparent); }
.lchip { display: inline-flex; align-items: center; gap: 4px; max-width: 100%; padding: 1px 8px 1px 3px; border-radius: 999px; background: var(--fill); color: var(--hint) !important; font-size: 12.5px; font-weight: 500; line-height: 17px; text-decoration: none !important; vertical-align: 1px; white-space: nowrap; }
.lchip > span:last-child { overflow: hidden; text-overflow: ellipsis; }
.lchip-mark { display: inline-grid; place-items: center; flex: none; width: 15px; height: 15px; border-radius: 50%; background: color-mix(in srgb, var(--text) 10%, transparent); color: var(--hint); font-size: 8.5px; font-weight: 700; line-height: 1; }
.lchips { display: flex; flex-wrap: wrap; gap: 6px; padding-top: 2px; }
@media (hover: hover) and (pointer: fine) { .lchip:hover { background: var(--fill-strong); } }

/* text between blocks */
.ltext { display: grid; gap: 8px; }

/* points */
.lpoints { gap: 0; }
.lpoints .lhead { padding-bottom: 8px; }
.lpoint { display: grid; gap: 6px; padding: 12px 0; border-top: 1px solid color-mix(in srgb, var(--text) 7%, transparent); }
.lpoints .lhead + .lpoint, .lpoints > .lpoint:first-child { padding-top: 0; border-top: 0; }
.lpoint:last-child { padding-bottom: 0; }
/* One column of tags for every point: the titles start at one line. */
.lpoints.column { grid-template-columns: max-content minmax(0, 1fr); column-gap: 12px; }
.lpoints.column > .lhead { grid-column: 1 / -1; }
.lpoints.column .lpoint { grid-column: 1 / -1; grid-template-columns: subgrid; }
.lpoint-tag { padding-top: 1px; }
.lpoint-body { display: grid; gap: 4px; min-width: 0; }
.lpoint-title { font-size: 15.5px; font-weight: 600; line-height: 1.3; }
.lpoint-body .msg-prose { font-size: 14.5px; line-height: 1.4; }

/* choice */
.lchoice { display: flex; flex-wrap: wrap; gap: 8px; }
.loption { display: inline-flex; align-items: center; gap: 6px; padding: 9px 16px; border: 1px solid color-mix(in srgb, var(--text) 14%, transparent); border-radius: 999px; background: var(--section); color: var(--text); font: inherit; font-size: 15px; font-weight: 500; cursor: pointer; transition: opacity 0.2s, background 0.2s; }
.loption.chosen { border-color: transparent; background: var(--text); color: var(--bg); }
.lchoice.decided .loption:not(.chosen) { opacity: 0.45; }
.loption:disabled { cursor: default; }
.lchoice.busy .loption { pointer-events: none; opacity: 0.7; }
@media (hover: hover) and (pointer: fine) { .lchoice:not(.decided) .loption:hover { background: var(--pressed); } }

/* checklist */
.lchecklist { gap: 4px; }
.lchecklist .lhead { padding-bottom: 4px; }
.lcheck { display: flex; align-items: flex-start; gap: 12px; width: 100%; padding: 7px 0; border: 0; background: none; color: var(--text); font: inherit; font-size: 15.5px; line-height: 1.35; text-align: left; cursor: pointer; }
.lcheck-box { display: grid; place-items: center; flex: none; width: 22px; height: 22px; margin-top: -1px; border: 1.5px solid color-mix(in srgb, var(--text) 30%, transparent); border-radius: 50%; color: transparent; transition: background 0.15s, border-color 0.15s; }
.lcheck.on .lcheck-box { border-color: var(--text); background: var(--text); color: var(--bg); }
.lcheck.on .lcheck-text { color: var(--hint); text-decoration: line-through; }

/* compare */
.lcompare-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14.5px; line-height: 1.35; }
.lcompare-table th, .lcompare-table td { padding: 8px 10px; text-align: left; vertical-align: top; border-top: 1px solid color-mix(in srgb, var(--text) 7%, transparent); }
.lcompare-table thead th { border-top: 0; font-weight: 600; white-space: nowrap; }
.lcompare-table tbody th { color: var(--hint); font-weight: 500; min-width: 90px; }
.lcompare-table td { min-width: 96px; }
.lcompare-table .best { background: color-mix(in srgb, var(--text) 6%, transparent); }
.lcompare-table thead .best { border-radius: 10px 10px 0 0; }
.lcompare-table tbody tr:last-child .best { border-radius: 0 0 10px 10px; }
.lbest { display: inline-block; margin-left: 6px; padding: 1px 6px; border-radius: 6px; background: var(--text); color: var(--bg); font-size: 11.5px; font-weight: 600; vertical-align: 1px; }

/* sources */
.lsources { display: grid; gap: 8px; }
.lsources-label { color: var(--hint); font-size: 13.5px; font-weight: 500; }
.lsource { display: grid; align-content: space-between; gap: 8px; flex: none; width: 200px; min-height: 84px; padding: 10px 12px; border-radius: 14px; background: var(--surface); color: var(--text); text-decoration: none; }
.lsource-title { display: -webkit-box; overflow: hidden; font-size: 14px; font-weight: 500; line-height: 1.3; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.lsource-site { display: flex; align-items: center; gap: 5px; color: var(--hint); font-size: 12.5px; overflow: hidden; white-space: nowrap; }
.lsource-site > span:last-child { overflow: hidden; text-overflow: ellipsis; }
@media (hover: hover) and (pointer: fine) { .lsource:hover { background: var(--fill-strong); } }

/* gallery */
.lgallery { display: grid; gap: 8px; }
.lgallery-card { display: grid; align-content: start; overflow: hidden; border-radius: 16px; background: var(--surface); color: var(--text); text-decoration: none; }
.lgallery.row .lgallery-card { flex: none; width: 210px; }
.lgallery-media { position: relative; }
.lgallery-img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; background: var(--fill); }
.lgallery-img.none { background: linear-gradient(135deg, var(--fill), var(--fill-strong)); }
.lbadge { position: absolute; left: 8px; bottom: 8px; max-width: calc(100% - 16px); padding: 3px 8px; border-radius: 8px; background: rgba(255, 255, 255, 0.92); color: #1f2a33; font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lgallery-body { display: grid; align-content: start; gap: 3px; padding: 10px 12px 12px; }
.lgallery-title { font-size: 15px; font-weight: 600; line-height: 1.3; }
.lgallery-sub { color: var(--hint); font-size: 13px; line-height: 1.3; }
.lgallery-text { display: -webkit-box; overflow: hidden; color: var(--live-ink); font-size: 13.5px; line-height: 1.35; -webkit-box-orient: vertical; -webkit-line-clamp: 3; }
.lgallery-video { display: inline-flex; align-items: center; gap: 4px; margin-top: 4px; color: var(--link); font-size: 13.5px; font-weight: 600; text-decoration: none; }
.lgallery-list { display: grid; gap: 8px; }
.lgallery.list .lgallery-card { grid-template-columns: 112px 1fr; }
.lgallery.list .lgallery-img { height: 100%; min-height: 96px; aspect-ratio: auto; }
@media (hover: hover) and (pointer: fine) { a.lgallery-card:hover { background: var(--fill-strong); } }

/* calculator */
.lcalc { gap: 14px; }
.lcalc-input { display: grid; gap: 8px; }
.lcalc-input-head { display: flex; justify-content: space-between; gap: 12px; font-size: 14.5px; }
.lcalc-input-value { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.lcalc input[type="range"] { --fill: 50%; width: 100%; height: 28px; margin: 0; background: transparent; cursor: pointer; -webkit-appearance: none; appearance: none; touch-action: pan-y; }
.lcalc input[type="range"]::-webkit-slider-runnable-track { height: 4px; border-radius: 2px; background: linear-gradient(to right, var(--text) var(--fill), var(--fill-strong) var(--fill)); }
.lcalc input[type="range"]::-moz-range-track { height: 4px; border-radius: 2px; background: var(--fill-strong); }
.lcalc input[type="range"]::-moz-range-progress { height: 4px; border-radius: 2px; background: var(--text); }
.lcalc input[type="range"]::-webkit-slider-thumb { width: 24px; height: 24px; margin-top: -10px; border: 0; border-radius: 50%; background: #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.28), 0 0 0 0.5px rgba(0, 0, 0, 0.1); -webkit-appearance: none; appearance: none; }
.lcalc input[type="range"]::-moz-range-thumb { width: 24px; height: 24px; border: 0; border-radius: 50%; background: #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.28); }
.lcalc input[type="range"]:focus-visible { outline: 2px solid color-mix(in srgb, var(--link) 50%, transparent); outline-offset: 2px; border-radius: 8px; }
.lcalc-results { display: grid; gap: 6px; padding-top: 12px; border-top: 1px solid color-mix(in srgb, var(--text) 8%, transparent); }
.lcalc-main { display: grid; gap: 2px; }
.lcalc-main .lcalc-value { font-size: 28px; font-weight: 700; line-height: 1.15; font-variant-numeric: tabular-nums; }
.lcalc-row { display: flex; justify-content: space-between; gap: 12px; font-size: 15px; }
.lcalc-row .lcalc-value { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.lcalc-label { color: var(--hint); font-size: 14px; }

/* steps */
.lsteps-list { display: grid; margin: 0; padding: 0; list-style: none; }
.lstep { position: relative; display: grid; grid-template-columns: 26px 1fr; gap: 12px; padding-bottom: 14px; }
.lstep:last-child { padding-bottom: 0; }
.lstep:not(:last-child)::before { content: ""; position: absolute; left: 12.5px; top: 28px; bottom: 2px; width: 1.5px; background: color-mix(in srgb, var(--text) 14%, transparent); }
.lstep-n { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--section); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--text) 14%, transparent); font-size: 13px; font-weight: 600; }
.lstep-body { display: grid; gap: 3px; padding-top: 3px; min-width: 0; }
.lstep-body .ltag { justify-self: start; }
.lstep-title { font-size: 15.5px; font-weight: 600; line-height: 1.3; }
.lstep-text { color: var(--live-ink); font-size: 14.5px; line-height: 1.4; }
.lbutton { display: inline-flex; align-items: center; justify-content: center; gap: 6px; justify-self: start; padding: 9px 16px; border: 0; border-radius: 999px; background: var(--text); color: var(--bg); font: inherit; font-size: 15px; font-weight: 600; cursor: pointer; }
.lbutton.small { padding: 6px 12px; font-size: 14px; }
.lbutton:disabled { background: var(--fill); color: var(--hint); cursor: default; }

/* stats */
.lstats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
@media (min-width: 560px) { .lstats.n3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .lstats.n4 { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.lstat { display: grid; align-content: start; gap: 2px; padding: 12px 14px; border-radius: 16px; background: var(--surface); }
.lstat-value { font-size: 22px; font-weight: 700; line-height: 1.2; overflow-wrap: anywhere; }
.lstat-label { color: var(--live-ink); font-size: 13.5px; line-height: 1.3; }
.lstat-note { color: var(--hint); font-size: 12.5px; line-height: 1.3; }

/* rows */
.lrows { gap: 0; }
.lrows .lhead { padding-bottom: 6px; }
.lrow { display: grid; grid-template-columns: auto auto 1fr; align-items: baseline; gap: 10px; padding: 8px 0; border-top: 1px solid color-mix(in srgb, var(--text) 7%, transparent); font-size: 15px; line-height: 1.35; }
.lrows .lhead + .lrow, .lrows > .lrow:first-child { border-top: 0; padding-top: 2px; }
.lrow:not(:has(.lrow-icon)) { grid-template-columns: auto 1fr; }
.lrow:not(:has(.lrow-label)) { grid-template-columns: auto 1fr; }
.lrow:not(:has(.lrow-icon)):not(:has(.lrow-label)) { grid-template-columns: 1fr; }
.lrow-icon { display: grid; place-items: center; align-self: center; width: 22px; color: var(--hint); font-weight: 600; }
.lrow-label { color: var(--hint); font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; }

/* charts */
.lchart-plot { position: relative; min-height: 230px; touch-action: pan-y; }
.lchart-svg { display: block; overflow: visible; }
.lchart-svg .tick { fill: var(--hint); font-size: 11.5px; font-variant-numeric: tabular-nums; }
.lchart-svg .grid { stroke: color-mix(in srgb, var(--text) 8%, transparent); stroke-width: 1; }
.lchart-svg .zero { stroke: color-mix(in srgb, var(--text) 30%, transparent); stroke-width: 1; }
.lchart-svg .cursor { stroke: color-mix(in srgb, var(--text) 25%, transparent); stroke-width: 1; stroke-dasharray: 3 3; }
.lchart-tip { position: absolute; top: 4px; z-index: 2; display: grid; gap: 2px; max-width: 240px; padding: 7px 10px; border-radius: 10px; background: var(--section); box-shadow: 0 0 0 0.5px var(--separator), 0 6px 18px rgba(0, 0, 0, 0.14); font-size: 12.5px; line-height: 1.35; pointer-events: none; }
.lchart-tip[hidden] { display: none; }
.lchart-tip i { display: inline-block; width: 8px; height: 8px; margin-right: 6px; border-radius: 2px; }
.llegend { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.llegend-item { display: inline-flex; align-items: center; gap: 6px; color: var(--hint); font-size: 13px; }
.llegend-mark { flex: none; width: 10px; height: 10px; border-radius: 3px; background: var(--c); }
.llegend-mark.line { width: 14px; height: 0; border-top: 2.5px solid var(--c); border-radius: 0; background: none; }
.llegend-mark.line.dashed { border-top-style: dashed; }
.llegend-mark.bar.dashed { opacity: 0.55; }
.lhbars { display: grid; gap: 10px; }
.lhbar { display: grid; grid-template-columns: minmax(80px, 34%) 1fr auto; align-items: center; gap: 10px; font-size: 14px; }
.lhbar-label { line-height: 1.3; overflow-wrap: anywhere; }
.lhbar-track { position: relative; height: 14px; }
.lhbar-zero { position: absolute; top: -4px; bottom: -4px; width: 1px; background: color-mix(in srgb, var(--text) 30%, transparent); }
.lhbar-bar { position: absolute; top: 0; bottom: 0; border-radius: 4px; }
.lhbar-value { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* maps */
.lmap { gap: 10px; }
.lmap-canvas { position: relative; height: 280px; margin: 0 -16px; overflow: hidden; background: var(--fill); }
.lmap-fail { display: grid; place-items: center; height: 100%; color: var(--hint); font-size: 14px; }
.lmark { display: grid; place-items: center; min-width: 26px; height: 26px; padding: 0 6px; border: 2px solid #fff; border-radius: 13px; background: #1f2a33; color: #fff; font-size: 12.5px; font-weight: 700; box-shadow: 0 2px 6px rgba(31, 42, 51, 0.35); cursor: pointer; }
.lmark.emoji { padding: 0 3px; background: #fff; font-size: 15px; }
.lmark.picked { transform: scale(1.18); background: var(--link); }
.lmark.emoji.picked { background: #fff; box-shadow: 0 0 0 3px var(--link); }
.lmap-list { display: grid; margin: 0; padding: 0; list-style: none; }
.lmap-place { display: grid; grid-template-columns: 26px 1fr auto auto; align-items: center; gap: 10px; padding: 6px 0; }
.lmap-n { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 12px; background: var(--fill); font-size: 12.5px; font-weight: 700; }
.lmap-n.emoji { background: none; font-size: 17px; }
.lmap-place.picked .lmap-n:not(.emoji) { background: var(--link); color: #fff; }
.lmap-name { display: grid; gap: 1px; min-width: 0; padding: 0; border: 0; background: none; color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.lmap-title { font-size: 15px; font-weight: 500; line-height: 1.3; }
.lmap-text { color: var(--hint); font-size: 13px; line-height: 1.3; }
.lmap-away { color: var(--hint); font-size: 13px; font-weight: 600; white-space: nowrap; }
.lmap-open { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; color: var(--hint); }
.lmap-leg { padding: 0 0 2px 36px; color: var(--hint); font-size: 12.5px; font-weight: 600; }
.lmap-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; color: var(--hint); font-size: 13px; line-height: 1.35; }
.lmap-line { flex: 1 1 auto; }
.lmap-actions { margin-left: auto; }
.lmap .maplibregl-ctrl-attrib { font-size: 10px; }
@media (hover: hover) and (pointer: fine) { .lmap-open:hover { background: var(--pressed); } .lmap-name:hover .lmap-title { color: var(--link); } }

@media (prefers-reduced-motion: reduce) { .loption, .lcheck-box { transition: none; } }

/* Live voice (voice.js): the call bar under the chat's head; the chat stays in sight. */
.cbtn.talk { color: var(--accent); }
.voicebar { flex: none; display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px 10px 14px; border-bottom: 0.5px solid var(--separator); background: var(--tint); }
.voicebar[hidden] { display: none; }
/* Kai himself on the bar (icons.js, 40 px over the buttons' 36): the bar keeps its height; he
   dims while the mic is off. */
.vb-kai { margin: -2px 0; transition: opacity 0.2s ease; }
.vb-kai.muted { opacity: 0.55; }
.vb-space { flex: 1; }
.vb-btn { width: 36px; height: 36px; flex: none; background: var(--section); color: var(--text); }
.vb-btn .i { --i: 20px; stroke-width: 2; }
.vb-btn.on { background: var(--accent); color: var(--on-accent); }
.vb-btn.end { background: var(--destructive); color: #fff; }
.vb-cam { position: relative; width: 96px; height: 72px; flex: none; overflow: hidden; border-radius: 10px; background: #000; }
.vb-cam[hidden] { display: none; }
.vb-cam video { display: block; width: 100%; height: 100%; object-fit: fill; }
.vb-box { position: absolute; border: 2px solid #ff2d55; border-radius: 4px; }
html:not(.web-wide) .vb-cam { width: 72px; height: 54px; }
