/* Faction chat translator: one sentence of choices above two message panes. */
.kb-chat {
    --chat-mono: Consolas, "SFMono-Regular", Menlo, monospace;
    --chat-field: color-mix(in srgb, var(--au-aether) 7%, var(--au-deep));
    --chat-field-line: color-mix(in srgb, var(--au-aether) 18%, transparent);
    max-width: 68rem;
    margin: 1.25rem 0 3rem;
    border: 1px solid var(--kb-border);
    border-radius: 10px;
    background: linear-gradient(180deg, var(--au-panel), var(--kb-surface));
    box-shadow: 0 18px 40px -28px #000;
    overflow: hidden;
}

/* "I'm an [Asmodian | Elyos] and I want to [Speak to | Understand] Elyos." */
.kb-chat__sentence {
    display: flex; flex-wrap: wrap; align-items: center; gap: .7rem 1rem;
    padding: 1rem clamp(1rem, 2.4vw, 1.5rem);
    border-bottom: 1px solid var(--kb-border);
}
.kb-chat__choice { display: flex; align-items: center; gap: .7rem 1rem; min-width: 0; margin: 0; padding: 0; border: 0; }
.kb-chat__choice legend { float: left; padding: 0; }
.kb-chat__words { color: var(--au-text); font-weight: 600; white-space: nowrap; }
.kb-chat__choice legend .kb-chat__words { color: var(--au-muted); font-weight: 500; }
.kb-chat__choice:first-child legend .kb-chat__words, .kb-chat__target { color: var(--au-text); font-weight: 650; }
.kb-chat__segments {
    display: inline-grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 3px;
    padding: 4px; border: 1px solid var(--au-line-strong); border-radius: 8px; background: var(--au-abyss);
}
.kb-chat__segments label { position: relative; display: block; cursor: pointer; }
.kb-chat__segments input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.kb-chat__segments span {
    display: flex; align-items: center; justify-content: center; gap: .4rem;
    min-height: 40px; padding: .4rem 1.1rem; border-radius: 5px;
    color: var(--au-soft); font-weight: 600; white-space: nowrap;
    transition: background-color .15s, color .15s;
}
.kb-chat__segments label:hover span { color: var(--au-text); background: color-mix(in srgb, var(--au-aether) 9%, transparent); }
.kb-chat__segments input:checked + span { background: var(--au-aether); color: #06111d; box-shadow: 0 6px 18px -10px var(--au-aether); }
.kb-chat__segments input:focus-visible + span { outline: 2px solid var(--au-gold-hi); outline-offset: 2px; }
.kb-chat svg { width: 1.05em; height: 1.05em; flex: none; fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }

/* Two spacious panes, side by side. */
.kb-chat__panes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.kb-chat__pane { display: flex; flex-direction: column; gap: .8rem; padding: 1.25rem clamp(1rem, 2.4vw, 1.5rem) 1.35rem; min-width: 0; }
.kb-chat__pane + .kb-chat__pane { border-inline-start: 1px solid var(--kb-border); }
.kb-chat__head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 2.25rem; }
.kb-chat__title { display: inline-flex; align-items: center; gap: .6rem; color: var(--au-text); font-weight: 650; }
.kb-chat__title::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--au-aether); box-shadow: 0 0 0 3px color-mix(in srgb, var(--au-aether) 18%, transparent); }
.kb-chat__title--source::before { background: var(--au-ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--au-ok) 18%, transparent); }
.kb-chat__clear {
    display: inline-flex; align-items: center; gap: .35rem; min-height: 36px; padding: .3rem .6rem; line-height: 1.2;
    border: 1px solid transparent; border-radius: 6px; background: none; color: var(--au-muted); font: inherit; cursor: pointer;
}
.kb-chat__clear:hover { color: var(--au-text); border-color: var(--au-line); }
.kb-chat__box {
    flex: 1; width: 100%; min-height: 11rem; resize: vertical;
    padding: .9rem 1rem; border: 1px solid var(--chat-field-line); border-radius: 8px;
    background: var(--chat-field); color: var(--au-text); font: 500 1rem/1.55 var(--au-ui); overflow-wrap: anywhere;
}
.kb-chat__box::placeholder { color: color-mix(in srgb, var(--au-muted) 75%, transparent); }
.kb-chat__box:focus { border-color: color-mix(in srgb, var(--au-aether) 55%, transparent); }
.kb-chat__box[readonly] { cursor: text; }
.kb-chat__box[aria-invalid=true] { border-color: var(--au-bad); }
.kb-chat :is(.kb-chat__box, .kb-chat__clear, .kb-chat__copy, summary):focus-visible { outline: 2px solid var(--au-aether); outline-offset: 2px; }
.kb-chat p.kb-chat__meta {
    display: flex; justify-content: space-between; gap: 1rem; margin: 0; min-height: 44px; align-items: center;
    color: var(--au-muted); font: 500 .72rem/1.3 var(--chat-mono); letter-spacing: .08em; text-transform: uppercase;
}
.kb-chat__count { color: var(--au-soft); font-variant-numeric: tabular-nums; white-space: nowrap; }
.kb-chat__box[aria-invalid=true] ~ .kb-chat__meta .kb-chat__count { color: var(--au-bad); }
.kb-chat__copy {
    display: flex; align-items: center; justify-content: center; gap: .55rem; width: 100%; min-height: 44px;
    padding: .55rem 1rem; border: 1px solid transparent; border-radius: 6px;
    background: var(--au-action-fill); color: #1a1205; font: 650 .9rem/1.3 var(--au-ui); cursor: pointer;
    transition: filter .15s;
}
.kb-chat__copy:hover:not(:disabled) { filter: brightness(1.1); }
.kb-chat__copy:disabled { background: color-mix(in srgb, var(--au-aether) 10%, var(--au-deep)); border-color: var(--au-line); color: var(--au-muted); cursor: not-allowed; }
.kb-chat__copy[data-copied] { background: var(--au-ok); }

.kb-chat__notes { padding: .9rem clamp(1rem, 2.4vw, 1.5rem) 1.1rem; border-top: 1px solid var(--kb-border); color: var(--au-muted); font-size: .86rem; }
.kb-chat__notes p { margin: .25rem 0; }
.kb-chat__status { color: var(--au-soft); }
.kb-chat__status:empty { display: none; }
.kb-chat__options { margin: 0 0 .5rem; color: var(--au-soft); }
.kb-chat__options summary { cursor: pointer; width: fit-content; }
.kb-chat__options ul { margin: .4rem 0 0; padding-inline-start: 1.2rem; font-family: var(--chat-mono); }
[data-chat-read-note][hidden] { display: none; }

@media (max-width: 720px) {
    .kb-chat { margin-top: 1rem; }
    .kb-chat__sentence { align-items: stretch; }
    .kb-chat__choice { flex: 1 1 100%; flex-wrap: wrap; }
    .kb-chat__choice legend { float: none; width: 100%; }
    .kb-chat__segments { flex: 1; display: grid; }
    .kb-chat__segments span { padding-inline: .6rem; }
    .kb-chat__panes { grid-template-columns: minmax(0, 1fr); }
    .kb-chat__pane + .kb-chat__pane { border-inline-start: 0; border-top: 1px solid var(--kb-border); }
    .kb-chat__box { min-height: 8.5rem; }
}
@media (prefers-reduced-motion: reduce) { .kb-chat * { transition: none !important; } }
