/* c21: same messenger, lighter contours and a content-sized editor. */
#talk-win {
  --chat-surface: color-mix(in srgb, var(--bg1) 35%, var(--bg2));
  --chat-line: color-mix(in srgb, var(--ink) 10%, transparent);
  --chat-divider: color-mix(in srgb, var(--ink) 6%, transparent);
  width: min(520px, 100%); height: min(560px, calc(100dvh - 64px));
  max-height: calc(100dvh - 64px); padding: 0; overflow: hidden;
  display: flex; flex-direction: column; border: 1px solid var(--chat-line);
  border-radius: 14px; background: var(--chat-surface); box-shadow: 0 18px 55px #0002;
}
#talk-win.talk--inline { width: 100%; height: 480px; max-height: none; box-shadow: none; }
/* Inline desktop messenger follows the directory height, keeping its own width.
   The overlay and compact dock retain their independent approved dimensions. */
@media (min-width: 961px) {
  .contact #contact-compose {
    display: flex; align-self: stretch; justify-self: end;
    width: min(480px, 100%); min-width: 0;
  }
  #contact-compose > #talk-win.talk--inline { flex: 1; height: auto; min-height: 0; }
}
#talk-win .talk__head { flex: 0 0 auto; position: static; display: grid; grid-template-columns: minmax(0,1fr) auto; padding: 13px 18px; border: 0; border-bottom: 1px solid var(--chat-divider); border-radius: 0; box-shadow: none; background: transparent; }
#talk-win .talk__t { font: 400 16px/1.4 var(--sans); letter-spacing: -.015em; }
#talk-win .talk__who, #talk-win .talk__note { display: none; }
#talk-win .talk__ctl .ictl { width: 28px; height: 28px; color: var(--ink2); }
#talk-win .talk__ctl .ictl:hover { color: var(--ink); }
#talk-win .talk__ctl .ictl:focus-visible { outline: 1px solid var(--ink2); outline-offset: 1px; }
#talk-win .talk__form { min-height: 0; flex: 1; display: flex; flex-direction: column; overflow: auto; margin: 0; padding: 0; border: 0; border-radius: 0; gap: 0; background: transparent; }
#talk-win .talk-context { position: relative; flex: 0 0 auto; padding: 10px 18px; margin: 0; border: 0; border-bottom: 1px solid var(--chat-divider); background: transparent; }
#talk-win .talk-context {
  --chat-context-rgb: 227 190 44;
}
/* c161: the accent belongs to the complete heading, not a fixed-height strip. */
#talk-win .talk-context__bar {
  position: relative; min-height: 42px; margin: -10px -18px 0;
  padding: 10px 18px; box-sizing: border-box;
  background-image: linear-gradient(90deg, rgb(var(--chat-context-rgb) / .15), rgb(var(--chat-context-rgb) / .06) 45%, rgb(var(--chat-context-rgb) / 0) 85%);
}
#talk-win .talk-context__bar::before {
  content: ''; position: absolute; left: 8px; top: 12px;
  width: 2px; bottom: 12px; border-radius: 1px;
  background: rgb(var(--chat-context-rgb)); pointer-events: none;
}
#talk-win .talk-context:has(#talk-feedback[hidden]) .talk-context__bar { margin-bottom: -10px; }
#talk-win .talk-context:has(#talk-feedback[hidden]) #talk-feedback-meta { display: none; }
#talk-win #talk-feedback-meta { font: 11px/1.6 var(--sans); color: var(--ink2); margin: 3px 0 0; padding-right: 64px; overflow-wrap: anywhere; }
#talk-win .talk-feedback { padding-top: 10px; }
#talk-win .talk-context__head { margin: 0; padding-right: 64px; min-height: 22px; }
#talk-win .talk-context__head a { gap: 7px; }
#talk-win .talk-context__head img { width: 28px; height: 19px; border-radius: 3px; }
#talk-win .talk-context__trace { font: 10px/1.5 var(--mono); min-width: 0; gap: 6px; }
#talk-win .talk-context__trace b { font-weight: 400; text-transform: none; }
#talk-win #talk-context-remove { position: absolute; right: 14px; top: 9px; width: 26px; height: 26px; font-size: 16px; }
#talk-win .talk-context__edit > summary { position: absolute; right: 43px; top: 9px; width: 26px; height: 26px; padding: 5px; display: grid; place-items: center; color: var(--ink2); border-radius: 5px; }
#talk-win .talk-context__edit > summary::marker, #talk-win .talk-context__edit > summary::-webkit-details-marker { display: none; content: ''; }
#talk-win .talk-context__edit > summary svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.1; stroke-linecap: round; stroke-linejoin: round; }
html[data-ui-size="large"] #talk-win .talk-context__head { min-height: 44px; padding-right: 100px; }
html[data-ui-size="large"] #talk-win #talk-feedback-meta { padding-right: 100px; }
html[data-ui-size="large"] #talk-win .talk-context__edit > summary { right: 62px; width: 44px; height: 44px; }
#talk-win .talk-context__edit > summary:hover { color: var(--ink); background: var(--chat-divider); }
#talk-win .talk-context__edit[open] { padding-bottom: 0; border-bottom: 0; }
#talk-win .talk-context__code { position: relative; margin-top: 12px; overflow: hidden; border: 1px solid var(--chat-divider); border-radius: 8px; background: color-mix(in srgb, var(--ink) 1.5%, var(--chat-surface)); }
#talk-win .talk-context__code:focus-within { border-color: var(--chat-line); }
#talk-win :is(.talk-context__intro,.talk-context__paint) { box-sizing: border-box; padding: 10px 12px; margin: 0; border: 0; border-radius: 0; font: 400 12px/1.75 var(--mono); letter-spacing: 0; tab-size: 2; white-space: pre-wrap; overflow-wrap: break-word; word-break: normal; text-align: left; }
#talk-win .talk-context__intro { position: relative; z-index: 1; min-height: 108px; max-height: 140px; background: transparent; color: var(--ink); caret-color: var(--ink); scrollbar-width: thin; }
#talk-win .talk-context__intro:focus-visible { outline: none; }
#talk-win .talk-context__paint { display: none; position: absolute; inset: 0; overflow: hidden; color: var(--ink); pointer-events: none; user-select: none; }
#talk-win .talk-context__code[data-highlighted] .talk-context__paint { display: block; }
#talk-win .talk-context__code[data-highlighted] .talk-context__intro { color: transparent; }
#talk-win .talk-context__intro::selection { color: var(--ink); background: color-mix(in srgb, var(--ink) 18%, var(--chat-surface)); }
#talk-win .talk-context__url { color: var(--ink); text-decoration: underline; text-decoration-color: rgb(var(--chat-context-rgb) / .48); text-decoration-thickness: 1px; text-underline-offset: 3px; }
#talk-win .talk-context__comment { color: var(--ink2); }
#talk-win .talk-context__local { font: 10px/1.5 var(--mono); }
@media (forced-colors: active) {
  #talk-win .talk-context__code[data-highlighted] .talk-context__paint { display: none; }
  #talk-win .talk-context__code[data-highlighted] .talk-context__intro { color: CanvasText; caret-color: CanvasText; }
}
#talk-win .talk-context__conflict { flex: 0 0 auto; margin: 8px 12px; }
#talk-win .talk-thread { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 22px 18px; display: flex; flex-direction: column; gap: 24px; scrollbar-width: thin; }
#talk-win .talk-thread:focus-visible { outline: 1px solid var(--chat-line); outline-offset: -3px; }
#talk-win .talk-message { display: flex; align-items: flex-start; gap: 9px; flex: 0 0 auto; }
#talk-win .talk-avatar { width: 24px; height: 24px; flex: 0 0 24px; color: var(--ink2); }
#talk-win .talk-avatar--guest { padding: 3px; fill: none; stroke: currentColor; stroke-width: 1.15; stroke-linecap: round; stroke-linejoin: round; border-radius: 50%; background: color-mix(in srgb, var(--ink) 3%, transparent); }
#talk-win .talk-message__body { min-width: 0; }
#talk-win .talk-message__body > p { font: 400 13px/1.65 var(--sans); letter-spacing: 0; color: var(--ink); margin: 0; overflow-wrap: anywhere; }
#talk-win .talk-message--visitor { align-self: flex-end; max-width: 92%; }
#talk-win .talk-message__body .talk-message__meta { font: 9px/1.5 var(--mono); color: var(--ink2); margin: 0 0 5px; }
#talk-win .talk-message__body .talk-message__bubble { white-space: pre-wrap; padding: 8px 11px; border-radius: 9px; background: color-mix(in srgb, var(--ink) 4%, var(--chat-surface)); }
#talk-win .talk__composer { flex: 0 0 auto; position: relative; padding: 10px 11px 7px; margin: 0 12px 12px; border: 1px solid var(--chat-divider); border-radius: 10px; background: color-mix(in srgb, var(--ink) 1.5%, var(--chat-surface)); }
#talk-win .talk__composer:focus-within { border-color: var(--chat-line); box-shadow: none; }
#talk-win .talk__text { display: block; width: 100%; min-height: 32px; max-height: 104px; padding: 0 1px 8px; margin: 0; resize: none; border: 0; border-radius: 0; background: none; font: 400 13px/1.65 var(--sans); color: var(--ink); box-sizing: border-box; }
#talk-win .talk__text:focus-visible { outline: none; box-shadow: none; }
#talk-win .talk__row { display: flex; align-items: center; gap: 7px; margin: 0; padding: 0; border: 0; }
#talk-win .talk-tools { display: flex; align-items: center; gap: 1px; }
#talk-win .talk-tool { width: 30px; height: 30px; padding: 6px; border: 0; border-radius: 6px; color: var(--ink2); background: transparent; display: grid; place-items: center; cursor: pointer; transition: background-color 160ms ease, color 160ms ease; }
#talk-win .talk-tool svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.1; stroke-linecap: round; stroke-linejoin: round; }
#talk-win .talk-tool--type { font: 400 13px/1 var(--sans); }
#talk-win .talk-tool:hover, #talk-win .talk-tool[aria-expanded="true"] { color: var(--ink); background: var(--chat-divider); }
#talk-win .talk-tool[aria-pressed="true"] { color: var(--warn); }
#talk-win :is(.talk-tool,.talk-popover button,.talk-channel-label,.talk-attachment button,summary):focus-visible { outline: 1px solid var(--ink2); outline-offset: 2px; }
#talk-win .talk-channel-label { display: flex; align-items: center; gap: 5px; margin-left: auto; padding: 6px 3px; border: 0; border-radius: 5px; background: none; font: 10px/1.3 var(--mono); color: var(--ink2); cursor: pointer; }
#talk-win .talk-channel-label svg { width: 10px; height: 10px; fill: none; stroke: currentColor; stroke-width: 1.1; }
#talk-win .talk-channel-label:hover, #talk-win .talk-channel-label[aria-expanded="true"] { color: var(--ink); }
#talk-win .send { flex: 0 0 32px; width: 32px; height: 32px; margin: 0; }
/* Smaller visible artwork; the existing 30/32px hit areas stay unchanged. */
#talk-win .send { color: color-mix(in srgb, var(--ink) 88%, var(--ink2)); }
#talk-win .send::before {
  inset: 3px; border-color: color-mix(in srgb,var(--ink) 19%,transparent);
  background: color-mix(in srgb,var(--ink) 13%,var(--chat-surface));
  box-shadow: inset 0 1px 0 color-mix(in srgb,var(--ink) 9%,transparent);
}
#talk-win .send:is(:hover,:focus-visible)::before {
  background: color-mix(in srgb,var(--ink) 20%,var(--chat-surface));
  border-color: color-mix(in srgb,var(--ink) 30%,transparent);
}
/* Home dark messenger: quieter ring, unchanged fill and arrow. */
html[data-theme="dark"]:not(.not-home) #talk-win .send::before {
  border-color: color-mix(in srgb,var(--ink) 8%,transparent);
  box-shadow: inset 0 1px 0 color-mix(in srgb,var(--ink) 3%,transparent);
}
html[data-theme="dark"]:not(.not-home) #talk-win .send:is(:hover,:focus-visible)::before {
  border-color: color-mix(in srgb,var(--ink) 16%,transparent);
}
#talk-win .send__arrow { width: 12px; height: 12px; }
#talk-win .send__mark { width: 19px; height: 19px; }
#talk-win .talk-popover { position: absolute; z-index: 5; left: 8px; bottom: 43px; width: min(248px, calc(100% - 16px)); padding: 8px; border: 1px solid var(--chat-line); border-radius: 9px; background: var(--bg2); box-shadow: 0 8px 26px #0003; }
#talk-win #talk-channel-popover, #talk-win .talk-popover--files { left: auto; right: 8px; }
#talk-win .talk-popover__label { margin: 3px 7px 7px; color: var(--ink2); font: 10px/1.5 var(--mono); }
#talk-win .talk-popover button { display: block; width: 100%; border: 0; padding: 7px; border-radius: 5px; background: transparent; text-align: left; color: var(--ink2); font: 400 12px/1.5 var(--sans); cursor: pointer; }
#talk-win .talk-popover button:hover { background: var(--chat-divider); color: var(--ink); }
#talk-win .talk-popover--attach {
  --talk-attach-shift-y: 0px;
  width: min(280px, calc(100% - 16px));
  transform: translateY(var(--talk-attach-shift-y));
}
#talk-win .talk-attach-item { display: grid; grid-template-columns: minmax(0,1fr) 24px; align-items: center; border-radius: 5px; }
#talk-win .talk-popover .talk-attach-option { display: grid; grid-template-columns: 18px minmax(0,1fr); column-gap: 10px; align-items: center; padding: 7px; }
#talk-win .talk-attach-option svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.1; stroke-linecap: round; stroke-linejoin: round; }
#talk-win .talk-popover .talk-attach-info { display: grid; place-items: center; width: 18px; height: 18px; padding: 0; border: 1px solid var(--chat-divider); border-radius: 50%; background: transparent; color: var(--ink3); font: 400 9px/1 var(--mono); }
#talk-win .talk-popover .talk-attach-info:hover,
#talk-win .talk-popover .talk-attach-info[aria-expanded="true"] { border-color: var(--chat-line); background: color-mix(in srgb, var(--ink) 4%, transparent); color: var(--ink); }
#talk-win .talk-attach-detail { grid-column: 1 / -1; margin: 0 7px 6px 35px; color: var(--ink3); font: 9px/1.5 var(--mono); animation: talk-attach-detail-in 130ms ease-out both; }
@keyframes talk-attach-detail-in {
  from { opacity: 0; transform: translateY(-2px); }
  to { opacity: 1; transform: translateY(0); }
}
#talk-win .talk-attach-limit { margin: 6px 7px 2px; padding-top: 7px; border-top: 1px solid var(--chat-divider); color: var(--ink3); font: 10px/1.5 var(--mono); }
#talk-win .talk-attachment__type { width: 38px; height: 38px; flex: 0 0 38px; display: grid; place-items: center; border: 1px solid var(--chat-divider); border-radius: 4px; color: var(--ink2); font: 9px/1 var(--mono); }
#talk-win .talk__chan { display: flex; flex-direction: column; align-items: stretch; gap: 2px; }
#talk-win .talk__chan button span { display: none; }
#talk-win .talk__chan button[aria-pressed="true"] { color: var(--ink); background: var(--chat-divider); }
#talk-win .talk__chan button b { font-weight: 400; }
#talk-win :is(.talk-channel-explainer,.talk-popover--voice p,.talk-popover--files p) { margin: 7px; color: var(--ink2); font: 11px/1.55 var(--sans); }
#talk-win #talk-channel-popover :is(button,button b,.talk-channel-explainer) { font-family: var(--mono); }
#talk-win .talk-tool-status { position: absolute; z-index: 6; left: 8px; bottom: 43px; display: flex; gap: 8px; max-width: calc(100% - 16px); padding: 10px 12px; border: 1px solid var(--chat-line); border-radius: 8px; background: var(--bg2); color: var(--ink2); font: 11px/1.55 var(--sans); box-shadow: 0 8px 24px #0002; }
#talk-win .talk-tool-status button { flex: 0 0 22px; height: 22px; padding: 0; border: 0; border-radius: 4px; background: none; color: var(--ink2); cursor: pointer; }
#talk-win .talk__states, #talk-win .talk__foot { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
#talk-win .talk__states:has(.is-err) { position: static; width: auto; height: auto; margin: -5px 18px 10px; clip-path: none; white-space: normal; }
#talk-win .talk__status { font-size: 10px; }
#talk-win .talk-attachments { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 8px; scrollbar-width: thin; }
#talk-win .talk-attachment { flex: 0 0 auto; max-width: 155px; display: flex; align-items: center; gap: 7px; padding: 4px; border: 1px solid var(--chat-divider); border-radius: 7px; }
#talk-win .talk-attachment img { width: 38px; height: 38px; object-fit: cover; border-radius: 4px; }
#talk-win .talk-attachment span { max-width: 75px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font: 10px/1.4 var(--sans); color: var(--ink2); }
#talk-win .talk-attachment button { border: 0; border-radius: 4px; background: none; color: var(--ink2); width: 22px; height: 24px; cursor: pointer; }
#talk-win .talk-attachment-note { color: var(--ink2); font: 9px/1.4 var(--sans); margin: 6px 0 1px; }
/* Bottom utility row stays visible and clickable below the conversation. */
#ov-talk.ov--dock { padding: 76px 24px 84px; place-items: end end; }
#ov-talk.ov--dock #talk-win { width: min(360px, 100%); height: min(440px, calc(100dvh - 160px)); max-height: calc(100dvh - 160px); }
#ov-talk.ov--dock .talk__head { padding: 11px 14px; }
#ov-talk.ov--dock .talk-thread { padding: 18px 14px; gap: 20px; }
#ov-talk.ov--dock .talk__composer { margin: 0 10px 10px; }
#ov-talk.ov--dock .talk-message__body > p { font-size: 12px; }
#talk-win [hidden] { display: none !important; }

/* A decorative connection, never an upload indicator. Keep both cards intact. */
.contact-relay { display: none; }
@media (min-width: 961px) {
  .contact { position: relative; }
  .contact-relay {
    display: block; position: absolute; left: var(--contact-relay-x, 50%); top: 50%;
    width: min(76px, var(--contact-relay-width, 44px)); height: 24px;
    transform: translate(-50%, -50%); color: var(--ink2);
    pointer-events: none; user-select: none;
  }
  .contact-relay svg { display: block; width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 1; stroke-linecap: round; stroke-linejoin: round; }
  .contact-relay__track { opacity: .3; }
  .contact-relay__packet { opacity: .32; animation: contact-relay-packet 2.8s ease-in-out infinite; animation-play-state: paused; transform-box: fill-box; transform-origin: center; }
  .contact-relay g:nth-of-type(2) .contact-relay__packet { animation-delay: .18s; }
  .contact-relay g:nth-of-type(3) .contact-relay__packet { animation-delay: .36s; }
  .contact-relay[data-running="true"] .contact-relay__packet { animation-play-state: running; }
  .contact:focus-within .contact-relay__packet,
  .contact:not(:has(#talk-win.talk--inline)) .contact-relay__packet { animation-play-state: paused; }
  .contact:not(:has(#talk-win.talk--inline)) .contact-relay { visibility: hidden; }
}
@keyframes contact-relay-packet {
  0%, 10% { opacity: 0; transform: translateX(-5px); }
  35% { opacity: .85; transform: translateX(0); }
  70%, 100% { opacity: 0; transform: translateX(6px); }
}
html[data-motion="reduced"] .contact-relay__packet { animation: none; transform: none; opacity: .4; }
html[data-motion="reduced"] #talk-win .talk-attach-detail { animation: none; }
html[data-motion="reduced"] #talk-win .talk-popover--attach { transition: none !important; }
@media (prefers-reduced-motion: reduce) {
  .contact-relay__packet { animation: none; transform: none; opacity: .4; }
  #talk-win .talk-attach-detail { animation: none; }
  #talk-win .talk-popover--attach { transition: none !important; }
}
