.ch-launch {
  --dot: #2447C8; --halo: rgba(36, 71, 200, .5);
  position: fixed; right: 1.5rem; bottom: 1.5rem; z-index: 30;
  display: inline-flex; align-items: center; gap: .6rem; height: 3.25rem; padding: 0 1.625rem 0 1.375rem;
  border: 0; border-radius: 999px; background: var(--ink); color: var(--on-ink); cursor: pointer;
  font: inherit; font-stretch: 125%; font-weight: 800; font-size: 1.1875rem; line-height: 1; letter-spacing: -.01em;
  box-shadow: 0 2px 4px rgba(2, 6, 18, .35), 0 14px 32px -10px rgba(2, 6, 18, .85);
}
.ch-launch::before {
  content: ""; flex: none; width: .5em; height: .5em; border-radius: 50%; background: var(--dot);
  animation: ch-call 2.4s ease-out 1.2s 3;
}
@keyframes ch-call { 0% { box-shadow: 0 0 0 0 var(--halo); } 75%, 100% { box-shadow: 0 0 0 .6em transparent; } }
.ch-launch:hover { background: var(--cobalt); }
.ch-launch:focus-visible { outline-offset: 4px; border-radius: 999px; }
.ch-launch[hidden] { display: none; }
body:has(#early :focus) .ch-launch { display: none; }
body:has(.ch-launch) { padding-bottom: 5.5rem; }
@media (max-width: 899px) { body:has(.tl-peek) .ch-launch { bottom: 5.5rem; } }

.ch-panel {
  --glass: color-mix(in srgb, #1A2849 88%, transparent);
  position: fixed; right: 1.5rem; bottom: 1.5rem; z-index: 31;
  display: flex; flex-direction: column;
  width: 24.5rem; max-height: min(37.5rem, calc(100dvh - 3rem));
  border-radius: 1.125rem; overflow: hidden;
  background: var(--glass); color: var(--ink);
  -webkit-backdrop-filter: blur(22px) saturate(1.5); backdrop-filter: blur(22px) saturate(1.5);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--cobalt) 34%, transparent), inset 0 1px 0 rgba(255, 255, 255, .06),
    0 0 0 1px rgba(2, 6, 18, .5), 0 12px 28px -10px rgba(2, 6, 18, .8), 0 36px 80px -20px rgba(2, 6, 18, .95);
  font-size: .9375rem; line-height: 1.55;
  transform-origin: 100% 100%; animation: ch-in .2s cubic-bezier(.2, .8, .2, 1);
}
.ch-panel[hidden] { display: none; }
.ch-panel :focus-visible { outline-offset: 2px; }
@keyframes ch-in { from { opacity: 0; transform: translateY(.5rem) scale(.97); } }

.ch-head { position: relative; display: flex; align-items: center; gap: .75rem; padding: 1.125rem .625rem .5rem 1.125rem; }
.ch-head::before {
  content: ""; position: absolute; inset: 0 0 -1.5rem; pointer-events: none;
  background-image:
    linear-gradient(color-mix(in srgb, var(--cobalt) 26%, transparent) 1px, transparent 1px),
    linear-gradient(90deg, color-mix(in srgb, var(--cobalt) 26%, transparent) 1px, transparent 1px),
    linear-gradient(color-mix(in srgb, var(--cobalt) 11%, transparent) 1px, transparent 1px),
    linear-gradient(90deg, color-mix(in srgb, var(--cobalt) 11%, transparent) 1px, transparent 1px);
  background-size: 60px 60px, 60px 60px, 12px 12px, 12px 12px; background-position: -1px -1px;
  -webkit-mask-image: linear-gradient(#000, transparent); mask-image: linear-gradient(#000, transparent);
}
.ch-head > * { position: relative; }
.ch-head img { flex: none; width: 2.25rem; height: 2.25rem; }
.ch-title { font-stretch: 125%; font-weight: 800; font-size: 1.0625rem; line-height: 1.15; letter-spacing: -.005em; }
.ch-sub { margin-top: .1rem; color: var(--graphite); font-size: .8125rem; line-height: 1.3; }
.ch-close {
  flex: none; display: grid; place-items: center; width: 2.5rem; height: 2.5rem; margin-left: auto; padding: 0;
  border: 0; border-radius: .75rem; background: transparent; color: var(--graphite); cursor: pointer;
}
.ch-close svg { width: 1.125rem; height: 1.125rem; }
.ch-close:hover { background: color-mix(in srgb, var(--ink) 8%, transparent); color: var(--ink); }

.ch-log {
  flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain;
  display: flex; flex-direction: column; padding: 1.25rem 1.25rem 1rem 1.125rem;
  -webkit-mask-image: linear-gradient(transparent, #000 1.75rem); mask-image: linear-gradient(transparent, #000 1.75rem);
}
.ch-thread { display: flex; flex-direction: column; gap: 1rem; margin-top: auto; }
.ch-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.ch-a, .ch-say { position: relative; padding-left: 1.25rem; overflow-wrap: anywhere; }
.ch-a::before {
  content: ""; position: absolute; left: .125rem; top: .5em; width: .5rem; height: .5rem;
  border-radius: 50%; background: var(--cobalt);
}
.ch-a p { white-space: pre-line; }
.ch-a p + p { margin-top: .625rem; }
.ch-from { color: var(--graphite); font-size: .8125rem; }
.ch-stopped { color: var(--graphite); font-size: .875rem; }

.ch-q {
  align-self: flex-end; max-width: 82%; padding: .5rem .875rem; white-space: pre-line;
  border-radius: .875rem .875rem .25rem .875rem; background: var(--cobalt-tint); color: var(--ink); overflow-wrap: anywhere;
}

.ch-picks { margin: .125rem 0 0 1.25rem; }
.ch-pick {
  display: flex; align-items: center; gap: .75rem; width: 100%; padding: .55rem 0; border: 0;
  background: repeating-linear-gradient(90deg, var(--ruling-strong) 0 4px, transparent 4px 8px) 0 100% / 100% 1px no-repeat;
  color: var(--ink); font: inherit; font-size: .9375rem; font-weight: 500; text-align: left; cursor: pointer;
}
.ch-pick:last-child { background: none; }
.ch-pick::before {
  content: ""; flex: none; width: .75rem; height: .75rem; border-radius: 50%;
  box-shadow: inset 0 0 0 2px var(--cobalt); transition: background .12s;
}
.ch-pick:hover { color: var(--cobalt); }
.ch-pick:hover::before { background: var(--cobalt); }

.ch-wait { display: flex; align-items: center; gap: .75rem; color: var(--graphite); }
.ch-dots { position: relative; flex: none; width: 2.75rem; height: 1.625rem; }
.ch-dots::before {
  content: ""; position: absolute; inset: 0;
  background:
    repeating-linear-gradient(90deg, var(--ruling-strong) 0 3px, transparent 3px 6px) 0 .25rem / 100% 1px no-repeat,
    repeating-linear-gradient(90deg, var(--ruling-strong) 0 3px, transparent 3px 6px) 0 .8125rem / 100% 1px no-repeat,
    repeating-linear-gradient(90deg, var(--ruling-strong) 0 3px, transparent 3px 6px) 0 1.375rem / 100% 1px no-repeat;
}
.ch-dots i {
  position: absolute; width: .5625rem; height: .5625rem; border-radius: 50%; background: var(--cobalt);
  animation: ch-step 1.2s ease-in-out infinite;
}
.ch-dots i:nth-child(1) { left: .125rem; top: 0; }
.ch-dots i:nth-child(2) { left: 1.0625rem; top: .53rem; animation-delay: .2s; }
.ch-dots i:nth-child(3) { left: 2rem; top: 1.09rem; animation-delay: .4s; }
@keyframes ch-step { 0%, 70%, 100% { opacity: .2; } 25% { opacity: 1; } }

.ch-pen {
  display: inline-block; width: .55em; height: .55em; margin-left: .2em; border-radius: 50%;
  background: var(--cobalt); vertical-align: .05em; animation: ch-blink 1s steps(2, jump-none) infinite;
}
@keyframes ch-blink { 50% { opacity: .25; } }

.ch-person {
  display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: .05rem .75rem;
  margin-left: 1.25rem; padding: .75rem .875rem; border-radius: .875rem;
  background: color-mix(in srgb, var(--cobalt) 12%, transparent);
}
.ch-person svg { grid-row: span 2; width: 1.5rem; height: 1.5rem; color: var(--cobalt); }
.ch-person p { color: var(--graphite); font-size: .875rem; line-height: 1.4; }
.ch-person p:first-of-type { color: var(--ink); font-weight: 700; font-size: .9375rem; }

.ch-say::before {
  content: ""; position: absolute; left: .0625rem; top: .42em; width: .625rem; height: .625rem;
  border-radius: 50%; box-shadow: inset 0 0 0 2px var(--muted);
}
.ch-say p:first-child { font-weight: 700; }
.ch-say p + p { margin-top: .25rem; color: var(--graphite); }
.ch-again {
  margin-top: .75rem; padding: .5rem 1rem; border: 0; border-radius: 999px;
  background: var(--cobalt); color: var(--on-ink); font: inherit; font-weight: 600; font-size: .875rem; cursor: pointer;
}
.ch-again:hover { background: var(--ink); }

.ch-ask { padding: .25rem .75rem .75rem; }
.ch-row {
  display: flex; align-items: flex-end; gap: .5rem; padding: .3125rem .3125rem .3125rem .875rem;
  border-radius: .875rem; background: color-mix(in srgb, var(--paper) 72%, transparent);
  box-shadow: inset 0 0 0 1px var(--ruling);
}
.ch-row:focus-within { box-shadow: inset 0 0 0 2px var(--cobalt); }
.ch-row:has(:disabled:not(.ch-send)) { background: transparent; box-shadow: inset 0 0 0 1px var(--ruling); }
.ch-field {
  flex: 1; min-width: 0; height: 2.25rem; max-height: 8rem; padding: .45rem 0; border: 0; outline: 0;
  background: transparent; color: var(--ink); font: inherit; font-size: .9375rem; line-height: 1.4; resize: none;
}
@supports (field-sizing: content) { .ch-field { field-sizing: content; height: auto; min-height: 2.25rem; } }
.ch-field::placeholder { color: var(--muted); }
.ch-send {
  flex: none; display: grid; place-items: center; width: 2.25rem; height: 2.25rem; padding: 0;
  border: 0; border-radius: .625rem; background: var(--cobalt); color: var(--on-ink); cursor: pointer;
}
.ch-send svg { width: 1.125rem; height: 1.125rem; }
.ch-send:disabled { background: var(--ruling); color: var(--muted); cursor: default; }
.ch-count { margin-top: .3rem; color: var(--graphite); font-size: .75rem; text-align: right; font-variant-numeric: tabular-nums; }
.ch-note { margin-top: .5rem; padding-left: .125rem; color: var(--muted); font-size: .75rem; font-stretch: 87.5%; line-height: 1.4; }
.ch-note summary { display: inline; list-style: none; cursor: pointer; }
.ch-note summary::-webkit-details-marker { display: none; }
.ch-note summary:hover { color: var(--ink); text-decoration: underline; text-underline-offset: .2em; }
.ch-note svg { display: inline; width: .8125rem; height: .8125rem; margin-left: .25rem; vertical-align: -.15em; }
.ch-note p { margin-top: .35rem; color: var(--graphite); }

@media (prefers-color-scheme: light) {
  .ch-launch { --dot: #8FA8FF; --halo: rgba(143, 168, 255, .55); box-shadow: 0 2px 4px rgba(26, 39, 68, .2), 0 14px 32px -12px rgba(26, 39, 68, .6); }
  .ch-panel { --glass: color-mix(in srgb, #FFFFFF 82%, transparent);
    box-shadow: inset 0 0 0 1px rgba(26, 39, 68, .1), 0 10px 24px -12px rgba(26, 39, 68, .3), 0 30px 70px -24px rgba(26, 39, 68, .35); }
}

@media (max-width: 599px) {
  .ch-launch { right: .75rem; bottom: .75rem; width: 3rem; height: 3rem; padding: 0; justify-content: center; font-size: .9375rem; }
  .ch-launch::before { display: none; }
  body:has(.ch-launch) { padding-bottom: 4.25rem; }
  body:has(.tl-peek) .ch-launch { bottom: max(.75rem, env(safe-area-inset-bottom)); }
  body:has(.ch-launch) .tl-peek { padding-right: calc(var(--pad) + 3.5rem); }
  .ch-panel {
    inset: var(--ch-top, 0) 0 auto; width: auto; max-height: none; height: var(--ch-vh, 100dvh); border-radius: 0;
    background: var(--paper); -webkit-backdrop-filter: none; backdrop-filter: none; box-shadow: none;
    padding: env(safe-area-inset-top) env(safe-area-inset-right) 0 env(safe-area-inset-left); animation-name: ch-up;
  }
  .ch-head { padding: .75rem .375rem .75rem 1rem; }
  .ch-close { width: 2.75rem; height: 2.75rem; }
  .ch-log { padding-inline: 1rem; }
  .ch-field { font-size: 1rem; }
  .ch-ask { padding-bottom: calc(.75rem + env(safe-area-inset-bottom)); }
  html.ch-open, html.ch-open body { overflow: hidden; }
}
@keyframes ch-up { from { transform: translateY(1.5rem); opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  .ch-panel, .ch-launch::before, .ch-dots i, .ch-pen { animation: none; }
  .ch-dots i { opacity: .85; }
}
