/* The curator's chat bubble: the round button at the bottom right, and the chat window it opens. */

/* The button */
.cb-fab { position: fixed; right: 24px; bottom: 24px; z-index: 50; width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: #fff; box-shadow: 0 10px 28px rgba(0, 0, 0, .35), 0 0 0 1px rgba(255, 255, 255, .06) inset; transition: transform .18s var(--ease), box-shadow .18s; }
.cb-fab:hover { transform: translateY(-2px); box-shadow: 0 14px 32px rgba(0, 0, 0, .4); }
.cb-fab-ico { position: absolute; display: grid; place-items: center; transition: opacity .2s, transform .25s var(--ease); }
.cb-fab-ico .ico { width: 26px; height: 26px; }
.cb-fab-ico.is-b { opacity: 0; transform: rotate(-90deg) scale(.6); }
.cb-fab.is-open .cb-fab-ico.is-a { opacity: 0; transform: rotate(90deg) scale(.6); }
.cb-fab.is-open .cb-fab-ico.is-b { opacity: 1; transform: none; }
.cb-ring { position: absolute; inset: -4px; border-radius: 50%; border: 2px solid transparent; transition: border-color .2s; }
.cb-fab.is-working .cb-ring { border-color: color-mix(in srgb, var(--accent) 30%, transparent); border-top-color: var(--accent-text); animation: cb-spin 1s linear infinite; }
@keyframes cb-spin { to { transform: rotate(360deg); } }
.cb-badge { position: absolute; top: -4px; right: -4px; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px; display: grid; place-items: center; background: var(--warn); color: #1b1300; font-size: 12px; font-weight: 800; box-shadow: 0 0 0 3px var(--bg); }

/* The window */
.cb[hidden] { display: none; }
.cb-panel { position: fixed; right: 24px; bottom: 92px; z-index: 50; width: 400px; height: min(640px, calc(100vh - 120px)); display: flex; flex-direction: column; border-radius: 18px; background: var(--panel); border: 1px solid var(--line-2); box-shadow: 0 24px 60px rgba(0, 0, 0, .45); overflow: hidden; transform-origin: bottom right; }
.cb-panel[hidden] { display: none; }
.cb-head { display: flex; align-items: center; gap: 10px; padding: 12px 12px 12px 14px; border-bottom: 1px solid var(--line); }
.cb-avatar { position: relative; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-text); flex: none; }
.cb-avatar .ico { width: 18px; height: 18px; }
.cb-avatar.is-working::after { content: ''; position: absolute; inset: -3px; border-radius: 50%; border: 2px solid transparent; border-top-color: var(--accent-text); animation: cb-spin 1s linear infinite; }
.cb-title { display: grid; flex: 1; min-width: 0; }
.cb-title small { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cb-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--line-3); flex: none; }
.cb-dot.is-on { background: #4ac578; box-shadow: 0 0 0 3px rgba(74, 197, 120, .18); }
.cb-meter { width: 46px; height: 5px; border-radius: 3px; background: var(--hover-strong); overflow: hidden; flex: none; }
.cb-meter i { display: block; height: 100%; background: var(--accent); border-radius: inherit; }

.cb-body { flex: 1; min-height: 0; overflow-y: auto; scrollbar-gutter: stable; padding: 14px 6px 14px 14px; display: flex; flex-direction: column; gap: 10px; }
.cb-msg { max-width: 86%; padding: 10px 13px; border-radius: 14px; font-size: 13.5px; line-height: 1.5; }
.cb-msg small { display: block; margin-top: 4px; color: var(--muted); font-size: 11px; }
.cb-msg.is-me { align-self: flex-end; background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent); border-bottom-right-radius: 4px; }
.cb-msg.is-me small { text-align: right; }
.cb-msg.is-bot { align-self: flex-start; background: var(--hover); border-bottom-left-radius: 4px; }
.cb-msg.is-live { display: grid; gap: 6px; min-width: 160px; }
.cb-msg.is-live p[hidden] { display: none; }
.cb-now { display: inline-flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12.5px; }
.cb-sys { align-self: center; display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; }
.cb-sys .ico { width: 14px; height: 14px; color: #4ac578; }
.cb-sys small { font-size: 11px; opacity: .8; }

.cb-tools { align-self: flex-start; max-width: 86%; border-radius: 10px; border: 1px solid var(--line); }
.cb-tools summary { display: flex; align-items: center; gap: 7px; height: 30px; padding: 0 10px; list-style: none; cursor: pointer; color: var(--muted); font-size: 12.5px; font-weight: 600; }
.cb-tools summary::-webkit-details-marker { display: none; }
.cb-tools summary .ico { width: 14px; height: 14px; }
.cb-tools summary .ico:last-child { margin-left: auto; transition: transform .2s var(--ease); }
.cb-tools[open] summary .ico:last-child { transform: rotate(180deg); }
.cb-tools ul { margin: 0; padding: 0 12px 10px 31px; list-style: disc; color: var(--muted); font-size: 12.5px; display: grid; gap: 3px; }

.cb-act { align-self: stretch; display: flex; align-items: center; gap: 10px; padding: 10px 10px 10px 12px; border-radius: 12px; border: 1px solid color-mix(in srgb, #4ac578 35%, var(--line)); background: color-mix(in srgb, #4ac578 7%, transparent); transition: border-color .25s, background-color .25s, opacity .25s; }
.cb-act-ico { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: color-mix(in srgb, #4ac578 16%, transparent); color: #4ac578; flex: none; }
.cb-act-ico .ico { width: 16px; height: 16px; }
.cb-act-main { display: grid; flex: 1; min-width: 0; font-size: 13px; }
.cb-act-main small { color: var(--muted); font-size: 12px; }
.cb-act.is-undone { border-color: var(--line); background: transparent; opacity: .7; }
.cb-act.is-undone .cb-act-ico { background: var(--hover); color: var(--muted); }
.cb-act.is-refused { border-color: color-mix(in srgb, var(--danger) 35%, var(--line)); background: color-mix(in srgb, var(--danger) 7%, transparent); }
.cb-act.is-refused .cb-act-ico { background: color-mix(in srgb, var(--danger) 15%, transparent); color: var(--danger); }
.cb-undo { display: inline-flex; align-items: center; gap: 5px; height: 28px; padding: 0 9px; border-radius: 8px; color: var(--text-2); font-size: 12.5px; font-weight: 600; transition: background-color .15s, color .15s; flex: none; }
.cb-undo:hover { background: var(--hover-strong); color: var(--text); }
.cb-undo .ico { width: 14px; height: 14px; }

.cb-empty { margin: auto 0; display: grid; justify-items: center; gap: 8px; padding: 10px 14px; text-align: center; }
.cb-empty > .ico { width: 30px; height: 30px; color: var(--accent-text); }
.cb-empty > span { color: var(--muted); font-size: 13px; }
.cb-sugg { display: grid; gap: 6px; width: 100%; margin-top: 8px; }
.cb-sugg button { height: 36px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line-2); text-align: left; font-size: 13px; color: var(--text-2); transition: border-color .15s, background-color .15s; }
.cb-sugg button:hover { border-color: var(--line-3); background: var(--hover); }

.cb-compose { display: flex; align-items: flex-end; gap: 8px; margin: 0 12px; padding: 6px 6px 6px 12px; border-radius: 14px; border: 1px solid var(--line-2); background: var(--input); transition: border-color .18s, box-shadow .18s; }
.cb-compose:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.cb-compose textarea { flex: 1; resize: none; border: 0; background: none; padding: 7px 0; min-height: 34px; max-height: 140px; font: inherit; font-size: 13.5px; color: var(--text); outline: none; }
.cb-send { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--accent); color: #fff; flex: none; transition: background-color .18s; }
.cb-send .ico { width: 18px; height: 18px; }
.cb-send.is-stop { background: var(--hover-strong); color: var(--text); }
.cb-foot { display: flex; align-items: center; gap: 6px; margin: 0; padding: 8px 14px 12px; color: var(--muted); font-size: 11.5px; }
.cb-foot .ico { width: 13px; height: 13px; }

@media (max-width: 640px) {
	.cb-fab { right: 16px; bottom: 16px; }
	.cb-panel { inset: 0; width: auto; height: auto; border-radius: 0; border: 0; z-index: 85; }
	.cb-fab.is-open { opacity: 0; pointer-events: none; }
}
@media (prefers-reduced-motion: reduce) { .cb-fab.is-working .cb-ring, .cb-avatar.is-working::after { animation: none; } }

.cb-sys.is-error { color: var(--danger); }
.cb-sys.is-error .ico { color: var(--danger); }
.cb-dot.is-off { background: var(--danger); }
.cb-loading { margin: auto; }
.cb-msg p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.cb-msg.is-pending { opacity: .75; }
.cb-head .icon-btn:disabled { opacity: .4; }
.cu-row .cb-undo { margin-right: 4px; }
.cb-badge[hidden] { display: none; }

/* The curator's answers, as markdown */
.cb-md { display: grid; gap: 8px; min-width: 0; }
.cb-md > * { margin: 0; }
.cb-md h2, .cb-md h3, .cb-md h4 { font-size: 13.5px; font-weight: 700; }
.cb-md ul, .cb-md ol { padding-left: 18px; display: grid; gap: 3px; }
.cb-md code { padding: 1px 5px; border-radius: 5px; background: var(--hover-strong); font-size: 12.5px; overflow-wrap: anywhere; }
.cb-md .g-code { margin: 0; padding: 10px 12px; border-radius: 8px; background: var(--panel-2); overflow-x: auto; font-size: 12px; }
.cb-md .g-tablewrap { margin: 2px 0; background: var(--panel); }
.cb-md .g-mdtable { font-size: 12.5px; }
.cb-md .g-mdtable th, .cb-md .g-mdtable td { padding: 6px 9px; }
.cb-msg.is-bot:has(.g-tablewrap) { max-width: 100%; }
