/* Chat tokens follow the theme selected by the existing Mini App. */
:root {
  --kc-canvas:#f6f7fb;
  --kc-panel:#ffffff;
  --kc-line:#e4e6f0;
  --kc-ink:#1e2036;
  --kc-muted:#62687d;
  --kc-soft:#eff0f8;
  --kc-accent:#5949be;
  --kc-on-accent:#ffffff;
  --kc-out:#eae6fd;
  --kc-live:#168061;
  --kc-danger:#a83347;
  --kc-tint-1:#e4f4ee;
  --kc-tint-2:#fce9e2;
  --kc-tint-3:#e5ecfb;
}
:root.dark:not([data-kc-theme=light]),:root[data-kc-theme=dark] {
  --kc-canvas:#171824;
  --kc-panel:#202131;
  --kc-line:#33354a;
  --kc-ink:#f1effb;
  --kc-muted:#b0b1c9;
  --kc-soft:#292b40;
  --kc-accent:#b8a9ff;
  --kc-on-accent:#221749;
  --kc-out:#37305b;
  --kc-live:#70d7b7;
  --kc-danger:#ff9ba9;
  --kc-tint-1:#243d3d;
  --kc-tint-2:#433242;
  --kc-tint-3:#303851;
}
.kc-enabled .tabbar__btn[data-tab=chat] { flex:1.25 1 0; }
.kc-active #screen-main > .topbar,.kc-keyboard .tabbar { display:none; }
.kc-active #screen-main > .screen__body {
  padding-top:max(8px,env(safe-area-inset-top)); padding-bottom:0;
}
body.kc-active { overscroll-behavior:none; }
#tab-chat:not(.hidden) {
  display:flex; flex-direction:column; min-width:0; min-height:0;
  height:var(--kc-height,70vh); max-width:900px; margin:0 auto;
}
#tab-chat,.kc-sheet { color:var(--kc-ink); font-size:14px; line-height:1.45; }
#tab-chat svg,.kc-sheet svg {
  display:block; width:20px; height:20px; flex:none; fill:none; stroke:currentColor;
  stroke-width:1.7; stroke-linecap:round; stroke-linejoin:round;
}
#tab-chat [hidden],.kc-sheet [hidden] { display:none!important; }
#tab-chat :focus-visible,.kc-sheet :focus-visible {
  outline:2px solid var(--kc-accent); outline-offset:2px;
}
.kc-body {
  isolation:isolate; position:relative; display:flex; flex:1; flex-direction:column;
  min-height:0; overflow:hidden; border:1px solid var(--kc-line); border-radius:22px;
  background:var(--kc-panel);
}
.kc-mast,.kc-head,.kc-compose-tray { display:flex; align-items:center; gap:10px; min-width:0; }
.kc-mast { padding:12px 16px 9px; }
.kc-brand,.kc-empty-icon {
  display:grid; place-items:center; width:42px; height:42px; flex:none;
  color:var(--kc-accent); background:var(--kc-out); border-radius:14px;
}
.kc-title { flex:1; min-width:0; }
.kc-title strong { display:block; font-size:17px; font-weight:750; letter-spacing:-.04em; }
.kc-connection { color:var(--kc-muted); font-size:11px; }
.kc-connection[data-live]::before {
  content:''; display:inline-block; width:6px; height:6px; margin:0 5px 1px 0;
  border-radius:50%; background:currentColor;
}
.kc-connection[data-live=true]::before { color:var(--kc-live); }
#tab-chat > .kc-connection { padding:0 4px 4px; }
.kc-shortcuts { display:flex; gap:4px; }
.kc-navigation,.kc-admin-tabs {
  display:flex; gap:3px; padding:3px; margin:0 16px 8px;
  border-radius:12px; background:var(--kc-soft);
}
.kc-section,.kc-button,.kc-peer,.kc-author,.kc-dialog,.kc-preview,.kc-more,.kc-quote {
  font:inherit; color:inherit; border:0; cursor:pointer; text-decoration:none; background:transparent;
}
.kc-section,.kc-button {
  display:inline-flex; align-items:center; justify-content:center; gap:7px;
  min-height:36px; padding:6px 11px; border-radius:10px; font-size:13px; font-weight:620;
}
.kc-section { flex:1; color:var(--kc-muted); white-space:nowrap; }
.kc-section svg { width:16px!important; height:16px!important; }
.kc-section[aria-pressed=true] { background:var(--kc-panel); color:var(--kc-accent); }
.kc-button { background:var(--kc-soft); }
.kc-button:disabled { opacity:.5; cursor:default; }
.kc-primary { background:var(--kc-accent); color:var(--kc-on-accent); }
.kc-danger { color:var(--kc-danger); }
.kc-icon { width:40px; min-height:40px; padding:0; flex:none; }
.kc-shortcuts .kc-icon,.kc-head .kc-icon,.kc-sheet-head .kc-icon { background:transparent; }
.kc-head {
  min-height:44px; padding:3px 16px 7px; border-bottom:1px solid var(--kc-line);
}
.kc-head h2 { font-size:15px; letter-spacing:-.02em; margin:0; }
.kc-history { flex:1; min-height:0; display:flex; flex-direction:column; position:relative; }
.kc-stream {
  flex:1; min-height:0; display:flex; flex-direction:column; overflow:auto;
  overscroll-behavior:contain; overflow-anchor:none; scrollbar-width:thin;
  padding:12px clamp(10px,3vw,26px); background:var(--kc-canvas);
}
.kc-stream[data-view=dialogs],.kc-stream[data-view=admin] { background:var(--kc-panel); }
.kc-day {
  align-self:center; margin:5px 0 12px; padding:3px 9px; border-radius:99px;
  background:var(--kc-soft); color:var(--kc-muted); font-size:11px;
}
.kc-message {
  display:flex; flex-direction:column; align-self:flex-start; align-items:flex-start;
  min-width:0; max-width:min(86%,540px); margin-bottom:11px; gap:4px;
  animation:kc-appear .15s ease-out;
}
.kc-message:has(+ .kc-grouped) { margin-bottom:3px; }
.kc-mine { align-self:flex-end; align-items:flex-end; }
.kc-author,.kc-peer { display:flex; align-items:center; min-width:0; gap:7px; padding:0; text-align:left; }
.kc-author { font-size:12px; font-weight:680; color:var(--kc-muted); max-width:100%; }
.kc-author span:last-child,.kc-peer strong { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.kc-avatar {
  position:relative; display:inline-grid; place-items:center; width:27px; height:27px; flex:none;
  border-radius:50%; overflow:hidden; background:var(--kc-out); color:var(--kc-ink);
  font-size:10px; font-weight:750; letter-spacing:-.02em;
}
.kc-avatar[data-tint="1"] { background:var(--kc-tint-1); }
.kc-avatar[data-tint="2"] { background:var(--kc-tint-2); }
.kc-avatar[data-tint="3"] { background:var(--kc-tint-3); }
.kc-avatar img { position:absolute; inset:0; width:100%; height:100%; object-fit:cover; }
.kc-avatar.kc-large { width:44px; height:44px; font-size:15px; }
.kc-avatar.kc-huge { width:78px; height:78px; font-size:25px; }
.kc-avatar.kc-huge svg { width:31px; height:31px; }
.kc-bubble {
  max-width:100%; min-width:72px; padding:8px 10px 3px; background:var(--kc-panel);
  border:1px solid var(--kc-line); border-radius:5px 16px 16px 16px;
}
.kc-mine .kc-bubble { background:var(--kc-out); border-color:transparent; border-radius:16px 5px 16px 16px; }
.kc-grouped .kc-bubble { border-radius:13px; }
.kc-text { margin:0; white-space:pre-wrap; overflow-wrap:anywhere; font-size:14px; line-height:1.45; }
.kc-quote {
  display:block; max-width:100%; overflow:hidden; text-overflow:ellipsis; white-space:nowrap;
  margin:0 0 5px; padding:5px 8px; text-align:left; font-size:12px; color:var(--kc-muted);
  border-inline-start:2px solid var(--kc-accent); border-radius:4px; background:var(--kc-soft);
}
.kc-meta { display:flex; align-items:center; justify-content:flex-end; gap:5px; color:var(--kc-muted); font-size:10px; }
.kc-more { width:30px; min-height:27px; display:grid; place-items:center; padding:0; border-radius:7px; }
.kc-more svg { width:16px!important; height:16px!important; }
.kc-flash { outline:2px solid var(--kc-accent); border-radius:12px; }
.kc-new { position:absolute; inset:auto 12px 12px auto; border:1px solid var(--kc-line); background:var(--kc-panel); color:var(--kc-accent); }
.kc-older { align-self:center; margin:0 auto 10px; }
.kc-composer { padding:8px 12px; border-top:1px solid var(--kc-line); background:var(--kc-panel); }
.kc-compose-tray { gap:6px; padding:3px; background:var(--kc-soft); border-radius:15px; }
.kc-compose-tray .kc-icon { background:transparent; color:var(--kc-muted); }
.kc-compose-tray .kc-send { background:var(--kc-accent); color:var(--kc-on-accent); border-radius:12px; }
.kc-input {
  min-height:40px; padding:8px 10px; font:inherit; font-size:16px; color:inherit;
  background:var(--kc-canvas); border:1px solid var(--kc-line); border-radius:10px;
}
.kc-composer textarea { flex:1; min-width:0; max-height:110px; resize:none; background:none; border:0; }
.kc-attachment-draft,.kc-compose-quote {
  display:flex; align-items:center; justify-content:space-between; gap:8px;
  padding:3px 6px 3px 9px; margin-bottom:5px; font-size:12px; background:var(--kc-soft); border-radius:10px;
}
.kc-attachment-draft .kc-selected,.kc-compose-quote span { flex:1; overflow:hidden; text-overflow:ellipsis; }
.kc-attachment-draft .kc-icon,.kc-compose-quote .kc-icon { width:32px; min-height:32px; }
.kc-busy svg { visibility:hidden; }
.kc-busy::after {
  content:''; position:absolute; width:16px; height:16px; border:2px solid currentColor;
  border-right-color:transparent; border-radius:50%; animation:kc-spin .7s linear infinite;
}
.kc-dialog {
  display:flex; align-items:center; gap:11px; width:100%; padding:11px 2px; text-align:left;
  border-bottom:1px solid var(--kc-line);
}
.kc-dialog-text { flex:1; min-width:0; display:grid; gap:3px; }
.kc-dialog-text span,.kc-dialog-text strong { overflow:hidden; white-space:nowrap; text-overflow:ellipsis; }
.kc-dialog-text span,.kc-muted,.kc-blocked { font-size:12px; color:var(--kc-muted); }
.kc-dialog-meta { display:grid; gap:4px; justify-items:end; color:var(--kc-muted); font-size:11px; }
.kc-count { background:var(--kc-accent); color:var(--kc-on-accent); border-radius:20px; padding:2px 7px; font-size:11px; }
.kc-welcome { width:min(560px,100%); padding:clamp(16px,4vw,30px); margin:0 auto; overflow:auto; }
.kc-rule-head { display:flex; align-items:center; gap:13px; }
.kc-rule-head h2 { font-size:clamp(20px,5vw,28px); line-height:1.2; letter-spacing:-.04em; margin:0; }
.kc-rules { margin:16px 0; padding:0; list-style:none; counter-reset:rule; }
.kc-rules li {
  position:relative; counter-increment:rule; padding:9px 0 9px 32px;
  border-bottom:1px solid var(--kc-line);
}
.kc-rules li::before {
  content:counter(rule); position:absolute; inset:9px auto auto 0; width:22px; height:22px;
  display:grid; place-items:center; border-radius:7px; background:var(--kc-soft); color:var(--kc-accent);
  font-size:11px; font-weight:700;
}
.kc-rule-footer { display:flex; flex-wrap:wrap; gap:7px; margin-top:13px; }
.kc-rule-footer .kc-check { width:100%; }
.kc-check { display:flex; align-items:center; gap:9px; min-height:42px; font-size:14px; }
.kc-check input { width:19px; height:19px; margin:0; flex:none; accent-color:var(--kc-accent); }
.kc-empty {
  display:grid; gap:8px; justify-items:center; margin:auto; padding:22px 12px; text-align:center;
  max-width:310px; color:var(--kc-muted);
}
.kc-empty strong { color:var(--kc-ink); font-size:16px; }
.kc-empty p { margin:0; }
.kc-skeleton { display:grid; gap:11px; padding:14px 0; width:100%; color:var(--kc-muted); }
.kc-skeleton span {
  display:block; height:36px; width:51%; background:var(--kc-soft); border-radius:12px;
  animation:kc-pulse .9s ease-in-out infinite alternate;
}
.kc-skeleton span:nth-child(2) { justify-self:end; width:40%; }
.kc-skeleton span:nth-child(3) { width:61%; }
.kc-notice {
  padding:9px 12px; color:var(--kc-ink); background:var(--kc-out); border-radius:10px;
  font-size:13px; overflow-wrap:anywhere;
}
.kc-preview { display:block; max-width:100%; padding:0; }
.kc-file { display:grid; gap:5px; justify-items:start; margin:3px 0 5px; min-width:0; }
.kc-file img,.kc-file video { display:block; width:min(360px,100%); max-height:290px; object-fit:contain; border-radius:10px; }
.kc-file img { min-height:60px; }
.kc-file .kc-button { min-height:30px; font-size:11px; }
.kc-document { display:flex; align-items:center; gap:10px; padding:5px 7px; }
.kc-document > svg { color:var(--kc-accent); }
.kc-document span { display:grid; justify-items:start; gap:4px; }
.kc-full-image { max-width:100%; max-height:65dvh; object-fit:contain; justify-self:center; border-radius:10px; }
.kc-sheet {
  background:var(--kc-panel); border:1px solid var(--kc-line); border-radius:20px;
  width:min(460px,calc(100% - 24px)); max-height:calc(100dvh - 24px); padding:0; overflow:auto;
}
.kc-sheet[open] { animation:kc-sheet-in .17s ease-out; }
.kc-sheet::backdrop { background:rgba(16,15,31,.54); }
.kc-sheet-content { display:grid; gap:9px; padding:14px 16px 18px; overflow-wrap:anywhere; }
.kc-sheet-head { display:flex; align-items:center; justify-content:space-between; gap:10px; }
.kc-sheet-head h2 { margin:0; font-size:17px; letter-spacing:-.03em; }
.kc-sheet-content p { margin:0; }
.kc-profile-hero { display:grid; justify-items:center; gap:6px; text-align:center; padding:4px 0 14px; }
.kc-name { font-size:23px; font-weight:730; letter-spacing:-.035em; }
.kc-action-list { display:grid; gap:3px; }
.kc-action { justify-content:flex-start; min-height:43px; text-align:left; }
.kc-action svg { color:var(--kc-accent); }
.kc-action.kc-danger svg { color:var(--kc-danger); }
.kc-action.kc-primary svg { color:inherit; }
.kc-privacy { padding:7px 11px 10px; border-radius:12px; background:var(--kc-out); }
.kc-toggle { justify-content:space-between; font-weight:650; }
.kc-toggle input {
  appearance:none; display:grid; align-items:center; width:36px; height:21px; border-radius:20px;
  background:var(--kc-muted); padding:3px; cursor:pointer; transition:background .15s;
}
.kc-toggle input::after {
  content:''; width:15px; height:15px; border-radius:50%; background:#fff; transition:transform .15s;
}
.kc-toggle input:checked { background:var(--kc-accent); }
.kc-toggle input:checked::after { transform:translateX(15px); }
.kc-form,.kc-admin-results { display:grid; gap:8px; width:100%; min-width:0; }
.kc-form textarea { min-height:75px; resize:vertical; }
.kc-admin-tools { display:flex; align-items:center; flex-wrap:wrap; gap:7px; margin-bottom:7px; }
.kc-admin-tabs { margin:0; }
.kc-admin-tools input { width:min(180px,52vw); }
.kc-admin-row { display:grid; justify-items:start; gap:6px; padding:11px 0; border-bottom:1px solid var(--kc-line); overflow-wrap:anywhere; }
.kc-admin-row p { margin:0; }
@media (hover:hover) {
  .kc-section:hover,.kc-dialog:hover,.kc-more:hover,.kc-shortcuts .kc-icon:hover { background:var(--kc-soft); color:var(--kc-accent); }
  .kc-button:hover:not(:disabled) { filter:brightness(.96); }
}
@media(max-width:520px) {
  .kc-active #screen-main > .screen__body { padding-inline:0; }
  .kc-body { border-inline:0; border-radius:0; }
  .kc-mast { padding:8px 11px 6px; }
  .kc-navigation { margin:0 11px 5px; }
  .kc-head { padding-inline:11px; }
  .kc-sheet { inset:auto 0 0; width:100%; max-width:none; margin:0; border-radius:20px 20px 0 0; }
  .kc-sheet-content { padding-bottom:calc(16px + env(safe-area-inset-bottom)); }
  .kc-enabled .tabbar { width:calc(100% - 8px); padding-inline:3px; }
  .kc-enabled .tabbar__btn { font-size:8px; }
}
@media(max-height:490px) {
  .kc-keyboard .kc-mast { display:none; }
  .kc-keyboard .kc-head { min-height:34px; }
}
@keyframes kc-appear { from { opacity:.6; transform:translateY(3px); } }
@keyframes kc-sheet-in { from { opacity:.7; transform:translateY(8px); } }
@keyframes kc-pulse { to { opacity:.45; } }
@keyframes kc-spin { to { transform:rotate(1turn); } }
@media(prefers-reduced-motion:reduce) {
  #tab-chat *,.kc-sheet,.kc-sheet * { animation:none!important; transition:none!important; scroll-behavior:auto!important; }
}
.kc-room-count { color:var(--kc-muted); font-size:11px; }
.kc-new[data-new]::after {
  content:''; width:8px; height:8px; position:absolute; top:4px; right:5px;
  border-radius:50%; background:var(--kc-accent);
}
.kc-compose-tray textarea::placeholder { color:var(--kc-muted); opacity:1; }
.kc-stream[data-view=room]:has(.kc-message)::before { content:''; flex:1 0 0; }
.kc-gate { display:flex; flex-direction:column; flex:1; min-height:0; overflow:hidden; }
.kc-gate .kc-rules-scroll { min-height:0; flex:1; overflow:auto; padding:0 3px 8px; overscroll-behavior:contain; }
.kc-gate .kc-rule-footer { padding-top:5px; margin-top:0; border-top:1px solid var(--kc-line); }

/* Messenger surfaces and palettes are scoped to chat and its dialogs. */
:root {
  --kc-canvas:#f8f6fe;
  --kc-panel:#fff;
  --kc-line:#e7dff3;
  --kc-ink:#20152e;
  --kc-muted:#675976;
  --kc-soft:#f0eaf8;
  --kc-accent:#6825ad;
  --kc-bright:#7d30cd;
  --kc-on-accent:#fff;
  --kc-out:#efe2fb;
  --kc-wallpaper:#7345a3;
  --kc-received:#fff;
}
:root.dark:not([data-kc-theme=light]),:root[data-kc-theme=dark] {
  --kc-canvas:#100e18;
  --kc-panel:#15131f;
  --kc-line:#30273e;
  --kc-ink:#fbf8ff;
  --kc-muted:#c4b5d3;
  --kc-soft:#231d30;
  --kc-accent:#d9afff;
  --kc-bright:#8435d5;
  --kc-on-accent:#fff;
  --kc-out:#6329a3;
  --kc-wallpaper:#9a60ef;
  --kc-received:#272137;
}
:root[data-kc-accent=blue] { --kc-bright:#285bc2; --kc-out:#254983; }
:root[data-kc-accent=pink] { --kc-bright:#a72869; --kc-out:#762849; }
:root[data-kc-accent=orange] { --kc-bright:#aa4f16; --kc-out:#814119; }
:root[data-kc-accent=mint] { --kc-bright:#167869; --kc-out:#1b5f53; }
#tab-chat,.kc-sheet { --kc-highlight:color-mix(in srgb,var(--kc-bright) 25%,var(--kc-panel)); }
#tab-chat {
  font-family:system-ui,-apple-system,'Segoe UI',sans-serif;
}
.kc-body { border-radius:22px; background:var(--kc-panel); }
.kc-head {
  min-height:61px; padding:8px 14px; gap:10px;
  position:relative; z-index:1; background:var(--kc-panel);
}
.kc-head h2 { font-size:17px; font-weight:730; }
.kc-head-text { flex:1; min-width:0; }
.kc-head-text h2 { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.kc-head .kc-icon { width:34px; min-height:39px; }
.kc-room-mark,.kc-home-link > svg:first-child {
  display:grid; place-items:center; flex:none; width:40px; height:40px;
  border-radius:50%; background:var(--kc-highlight); color:var(--kc-accent);
}
.kc-room-count { display:block; font-size:11px; }
.kc-head .kc-peer { flex:1; }
.kc-head .kc-peer .kc-avatar { width:36px; height:36px; }
.kc-head .kc-connection { font-size:10px; white-space:nowrap; }
.kc-pin {
  display:flex; align-items:center; gap:9px; text-align:left; flex:none;
  color:var(--kc-accent); font:inherit; font-weight:660; font-size:12px; cursor:pointer;
  margin:7px 11px 4px; padding:6px 10px; border:0; border-radius:11px;
  border-inline-start:2px solid var(--kc-bright); background:var(--kc-soft);
}
.kc-pin span { flex:1; }
.kc-pin small { display:block; color:var(--kc-muted); font-size:10px; font-weight:400; }
.kc-pin svg:last-child { width:15px!important; height:15px!important; }
.kc-stream[data-view=home] { background:var(--kc-panel); padding:0 0 16px; }
.kc-home-hero {
  display:grid; place-content:center; position:relative; isolation:isolate; overflow:hidden;
  min-height:clamp(130px,27vh,240px); padding:18px 0 21px; text-align:center;
  background:radial-gradient(ellipse at 49% 10%,var(--kc-highlight),transparent 68%),var(--kc-canvas);
}
.kc-home-hero::before,.kc-home-hero::after {
  content:''; position:absolute; z-index:-1; width:80%; height:60%;
  border-radius:25% 55% 50% 50%; opacity:.83;
  background:linear-gradient(155deg,var(--kc-highlight),var(--kc-bright));
  transform:rotate(-18deg); inset:-33% auto auto -14%;
  box-shadow:0 6px 28px color-mix(in srgb,var(--kc-bright) 32%,transparent);
}
.kc-home-hero::after { inset:-33% -20% auto auto; transform:rotate(31deg); opacity:.51; }
.kc-home-hero h3 { margin:0; font-size:clamp(33px,7vw,53px); line-height:1.05; letter-spacing:-.065em; }
.kc-home-hero p { margin:6px 0 0; color:var(--kc-muted); font-size:14px; }
.kc-home-links {
  display:grid; gap:9px; width:min(100%,540px); margin:0 auto; padding:0 14px 6px;
}
.kc-home-link {
  display:flex; align-items:center; gap:11px; min-width:0; min-height:59px; padding:9px 12px;
  font:inherit; color:var(--kc-ink); text-align:start; cursor:pointer;
  border:1px solid var(--kc-line); border-radius:16px; background:var(--kc-soft);
}
.kc-home-link:first-child {
  border-color:var(--kc-bright);
  background:linear-gradient(120deg,var(--kc-highlight),var(--kc-soft));
  box-shadow:0 0 12px color-mix(in srgb,var(--kc-bright) 27%,transparent);
}
.kc-home-link > svg:first-child { width:27px!important; height:27px!important; background:transparent; }
.kc-home-link > svg:last-child { color:var(--kc-muted); width:15px!important; height:15px!important; }
.kc-home-label { flex:1; min-width:0; display:grid; gap:3px; }
.kc-home-label strong { line-height:1.15; font-weight:710; }
.kc-home-label small { color:var(--kc-muted); font-size:11px; }
.kc-stream[data-view=room] {
  background-color:var(--kc-canvas);
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='156' height='130' viewBox='0 0 156 130'%3E%3Cg fill='none' stroke='%238e4eca' stroke-width='1' opacity='.11' stroke-linejoin='round'%3E%3Cpath d='M12 16q0-4 4-4h14q4 0 4 4v9q0 4-4 4H20l-7 5v-6q-1-1-1-3zM18 19h10m-10 4h7M91 18l11-6 11 6-11 6zm-11 6v10m0-4l11 6 7-4M51 66l15-5-5 15-3-7zm70 16h15v15h-15zM123 93l5-5 4 4 2-2M26 107l3-8 3 8 8 3-8 3-3 8-3-8-8-3zM89 115l10-3 3-10 3 10 10 3-10 3-3 9-3-9z'/%3E%3C/g%3E%3C/svg%3E");
  padding-inline:clamp(12px,3vw,24px);
}
.kc-stream[data-view=profile],.kc-stream[data-view=appearance],.kc-stream[data-view=admin] { background:var(--kc-panel); }
.kc-message { position:relative; padding-inline-start:35px; max-width:min(92%,550px); }
.kc-message.kc-mine { padding-inline-start:0; max-width:min(86%,525px); }
.kc-message:not(.kc-mine) .kc-author .kc-avatar { position:absolute; inset:0 auto auto 0; width:29px; height:29px; }
.kc-author { font-weight:710; font-size:11px; padding-inline:3px; color:var(--kc-ink); }
.kc-message.kc-mine .kc-author { display:none; }
.kc-bubble { background:var(--kc-received); }
.kc-mine .kc-bubble { background:var(--kc-out); color:var(--kc-on-accent); }
:root.light:not([data-kc-theme=dark]) .kc-mine .kc-bubble,
:root[data-kc-theme=light] .kc-mine .kc-bubble {
  background:color-mix(in srgb,var(--kc-bright) 36%,var(--kc-panel)); color:var(--kc-ink);
}
.kc-mine .kc-meta { color:inherit; opacity:.76; }
.kc-mine .kc-quote { background:color-mix(in srgb,var(--kc-panel) 87%,transparent); }
.kc-send,.kc-primary,.kc-count { background:var(--kc-bright)!important; color:#fff!important; }
.kc-compose-tray { border-radius:23px; padding:2px 4px; }
.kc-compose-tray .kc-send { border-radius:50%; }
.kc-dialog { padding:11px 3px; }
.kc-dialog-text strong { font-size:14px; }
.kc-profile-page,.kc-appearance { display:grid; gap:10px; width:min(100%,450px); margin:0 auto; }
.kc-profile-hero { position:relative; padding:21px 0 19px; }
.kc-profile-hero .kc-avatar {
  width:108px; height:108px; border:2px solid var(--kc-accent);
  box-shadow:0 0 20px color-mix(in srgb,var(--kc-bright) 45%,transparent);
}
.kc-profile-hero .kc-name { margin-top:5px; }
.kc-profile-page .kc-action-list { gap:0; border:1px solid var(--kc-line); border-radius:14px; overflow:hidden; }
.kc-profile-page .kc-action-list > button {
  border-radius:0; border-bottom:1px solid var(--kc-line);
}
.kc-profile-page .kc-action-list > button:last-of-type { border-bottom:0; }
.kc-profile-page .kc-action-list > p { margin:0; padding:8px 10px; }
.kc-privacy { background:var(--kc-soft); border:1px solid var(--kc-line); }
.kc-privacy p { margin:0; }
.kc-toggle input:checked { background:var(--kc-bright); }
.kc-theme-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:9px; }
.kc-appearance h3 { font-size:14px; margin:12px 0 0; }
.kc-theme-choice {
  display:grid; justify-items:center; gap:6px; padding:0; cursor:pointer;
  color:var(--kc-ink); background:transparent; font:inherit; font-size:11px; border:0;
}
.kc-theme-preview {
  display:grid; gap:5px; width:100%; height:88px; padding:12px; align-content:center;
  background:#232032; border:1px solid var(--kc-line); border-radius:14px;
}
.kc-theme-preview[data-theme=auto] { background:linear-gradient(145deg,#282236 50%,#535069 50%); }
.kc-theme-preview[data-theme=light] { background:#f0e9fc; }
.kc-theme-preview i { height:8px; width:65%; border-radius:6px; background:#8980a0; }
.kc-theme-preview i:nth-child(2) { justify-self:end; background:#9d64e4; }
.kc-theme-choice[aria-pressed=true] .kc-theme-preview { border-color:var(--kc-bright); outline:1px solid var(--kc-bright); }
.kc-color-grid { display:flex; flex-wrap:wrap; gap:11px; padding:4px 0; }
.kc-accent-choice {
  width:37px; height:37px; border:1px solid #ffffff60; border-radius:50%; cursor:pointer; background:#8435d5;
}
.kc-accent-choice[data-choice=blue] { background:#285bc2; }
.kc-accent-choice[data-choice=pink] { background:#a72869; }
.kc-accent-choice[data-choice=orange] { background:#aa4f16; }
.kc-accent-choice[data-choice=mint] { background:#167869; }
.kc-accent-choice[aria-pressed=true]::after { content:'✓'; color:#fff; font-size:19px; }
.kc-context { width:min(340px,calc(100% - 46px)); }
.kc-context-preview {
  padding:8px 10px; border-radius:11px; background:var(--kc-highlight);
  display:-webkit-box; -webkit-line-clamp:3; -webkit-box-orient:vertical; overflow:hidden;
}
.kc-context .kc-action { border-bottom:1px solid var(--kc-line); }
.kc-copy-fallback { position:absolute; opacity:0; width:1px; height:1px; }
.kc-media-view {
  inset:0; width:100%; height:100%; max-width:none; max-height:none; margin:0;
  border:0; border-radius:0; background:#0b0910; color:#fff;
}
.kc-media-view .kc-sheet-content {
  min-height:100%; display:grid; grid-template-rows:auto 1fr auto; align-items:center;
  padding-block:max(14px,env(safe-area-inset-top)) max(14px,env(safe-area-inset-bottom));
}
.kc-media-view .kc-full-image { max-height:78dvh; border-radius:0; }
.kc-media-view .kc-button:not(.kc-icon) { justify-self:center; color:var(--kc-ink); }
.kc-admin-row {
  padding:13px; border:1px solid var(--kc-line); border-radius:13px; background:var(--kc-soft);
}
.kc-admin-row .kc-button { background:var(--kc-highlight); }
.kc-admin-tabs [aria-pressed=true] { background:var(--kc-bright); color:#fff; }
.kc-document { gap:8px; }
.kc-document > svg:first-child { width:27px!important; height:27px!important; color:var(--kc-accent); }
.kc-document .kc-button { width:34px; height:34px; min-height:34px; padding:0; border-radius:50%; }
.kc-document .kc-button svg { width:15px!important; height:15px!important; }
.kc-rule-head { flex-direction:column; text-align:center; gap:8px; }
.kc-rule-head .kc-brand { width:53px; height:53px; box-shadow:0 0 16px color-mix(in srgb,var(--kc-bright) 26%,transparent); }
.kc-rule-head .kc-brand svg { width:27px!important; height:27px!important; }
.kc-rules li { border-radius:7px; }
.kc-rule-footer .kc-primary { flex:1; min-height:43px; }
@media (max-width:520px) {
  .kc-body { border-radius:0; }
  .kc-head { min-height:52px; padding:5px 9px; gap:7px; }
  .kc-head .kc-icon { width:32px; }
  .kc-context { inset:auto 13px max(12px,env(safe-area-inset-bottom)) auto; border-radius:16px; max-width:calc(100% - 26px); }
  .kc-media-view { inset:0; border-radius:0; }
}
@media (max-height:510px) {
  .kc-keyboard .kc-head { min-height:39px; }
  .kc-keyboard .kc-pin { display:none; }
}
.kc-home-hero::before { height:81%; inset:-54% auto auto -14%; border-radius:30% 22% 61% 53%; }
.kc-home-hero::after { height:70%; inset:-40% -20% auto auto; border-radius:28% 32% 38% 66%; }
.kc-home-link:hover { border-color:var(--kc-bright); }
.kc-theme-preview {
  place-items:center; align-content:center; height:104px; padding:8px;
}
.kc-theme-device {
  position:relative; display:grid; align-content:center; gap:6px; width:46px; height:77px;
  border-radius:8px; padding:8px 5px; border:1px solid #82748e;
  background:#302942; overflow:hidden;
}
.kc-theme-device::before {
  content:''; position:absolute; inset:5px 33% auto; height:3px; border-radius:5px;
  background:#b9abc8;
}
.kc-theme-preview[data-theme=light] .kc-theme-device { background:#fff; }
.kc-theme-preview[data-theme=auto] .kc-theme-device { background:#453954; }
.kc-theme-device i { height:7px; width:73%; }
.kc-report-card {
  display:grid; grid-template-columns:auto minmax(0,1fr); column-gap:10px;
  align-items:center;
}
.kc-report-card .kc-primary { grid-column:2; }
.kc-report-mark {
  display:grid; place-items:center; width:35px; height:35px; border-radius:50%;
  background:color-mix(in srgb,var(--kc-danger) 20%,var(--kc-panel)); color:var(--kc-danger);
}
.kc-report-details { display:grid; gap:3px; min-width:0; }
.kc-dialog-selected { background:var(--kc-soft); border-radius:11px; padding-inline:7px; }

#tab-chat.kc-compact .kc-pin { display:none; }
#tab-chat.kc-compact .kc-head { min-height:39px; }

.kc-expired { margin:4px 0; font-size:12px; opacity:.85; }

.kc-bot-mode { display:flex; gap:7px; align-items:center; font-size:12px; padding:3px 6px 7px; color:var(--kc-accent); }
.kc-bot-label { padding:0 4px; border:1px solid var(--kc-line); border-radius:4px; font-size:9px; }

/* The chat alone occupies the measured visible viewport. Its history owns scrolling. */
html:has(body.kc-active),body.kc-active { overflow:hidden; }
body.kc-active #screen-main { animation:none; transform:none; }
body.kc-active #tab-chat:not(.hidden) {
  position:fixed; top:var(--kc-top,6px); left:0; right:0;
  width:100%; max-width:900px; z-index:100;
  height:var(--kc-height,calc(100svh - 100px));
}
body.kc-active .kc-composer { flex:0 0 auto; }
body.kc-active .kc-history { flex:1 1 0; }
body.kc-active .kc-composer textarea {
  min-height:40px; max-height:120px; line-height:22px;
  padding:8px 10px; resize:none; box-sizing:border-box;
}
