/* «Спросить учителя» (teacher.js): чат в общей шторке. Только токены из styles.css. */

/* Шторка с чатом выше обычной, тело — колонка: лента прокручивается, поле ввода внизу. */
.sheet.is-chat { height: min(86vh, 720px); max-height: min(86vh, 720px); }
.sheet.is-chat .sheet-body { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }

.tch { display: flex; flex-direction: column; flex: 1; min-height: 0; gap: 10px; }
.tch-log { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; display: flex; flex-direction: column; gap: 10px; padding-bottom: 4px; }

.tch-msg { max-width: 92%; padding: 10px 13px; border-radius: var(--r-md); font-size: 15px; line-height: 1.5; overflow-wrap: anywhere; }
.tch-msg p { margin: 0 0 8px; }
.tch-msg p:last-child, .tch-msg ul:last-child, .tch-msg ol:last-child { margin-bottom: 0; }
.tch-msg ul, .tch-msg ol { margin: 0 0 8px; padding-left: 20px; }
.tch-msg li { margin: 2px 0; }
.tch-ai { align-self: flex-start; background: var(--bg-sunk); color: var(--ink); border-bottom-left-radius: 4px; }
.tch-me { align-self: flex-end; background: var(--accent); color: var(--on-accent); border-bottom-right-radius: 4px; white-space: pre-wrap; }
.tch-ai.is-error { background: var(--bad-s); color: var(--bad-d); }

.tch-sugg { display: flex; flex-wrap: wrap; gap: 6px; }
.tch-sugg .block-chip { width: auto; margin: 0; font-size: 13.5px; }

.tch-refs { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.tch-refs .status-tag { cursor: pointer; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.tch-wait { color: var(--muted); display: flex; align-items: center; gap: 8px; }
.tch-dots { display: inline-flex; gap: 3px; }
.tch-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); animation: tchDot 1s ease-in-out infinite; }
.tch-dots i:nth-child(2) { animation-delay: .15s; }
.tch-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes tchDot { 0%, 100% { opacity: .3; } 50% { opacity: 1; } }

.tch-form { display: flex; gap: 8px; align-items: flex-end; flex: none; }
.tch-in {
    flex: 1; min-height: 46px; max-height: 140px; resize: none;
    padding: 11px 13px; border: 1px solid var(--line); border-radius: var(--r-md);
    background: var(--bg-sunk); color: var(--ink); font-size: 16px; line-height: 1.4;
}
/* Рамка фокуса — внутри поля: шторка обрезает всё, что за её краем (overflow: hidden), и внешняя рамка
   «съезжала» влево. Фон поля темнее шторки (--bg-sunk): в тёмной теме поле цвета шторки терялось. */
.tch-in:focus, .tch-in:focus-visible { outline: none; border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.tch-send { width: 48px; height: 46px; padding: 0; flex: none; }
.tch-note { margin: 0; color: var(--faint); flex: none; }
.tch-reset { font-size: 12.5px; }
.tch-cached { margin: 8px 0 0; color: var(--faint); }
.tch-cached .live-link { font-size: 12.5px; }

.tch-open { width: auto; margin: 14px 0 0; }

@media (prefers-reduced-motion: reduce) { .tch-dots i { animation: none; opacity: .7; } }
