/* The tutor: a chat panel beside the reader and homework (js/tutor.js). */
/* The panel fills the pane holding it: a column of the reader, or a homework pane. */
.tutor {
  display: flex; flex-direction: column; height: 100%; min-height: 0;
  background: var(--surface); color: var(--fg);
}
.reader { --tutor-width: 380px; }
.reader-columns > .tutor-column {
  flex: 0 0 var(--tutor-width); width: var(--tutor-width); min-width: 0; align-self: stretch;
  position: sticky; top: 51px; height: calc(100vh - 51px);
}
/* Dragged (or moved with the arrow keys) to widen or narrow the tutor, like the dictionary's. */
.tutor-divider { flex: 0 0 8px; align-self: stretch; cursor: col-resize; touch-action: none; background: var(--surface); border-left: 1px solid var(--border); }
.tutor-divider:hover, .tutor-divider:focus-visible, .dictionary-resizing .tutor-divider:active { background: var(--accent); outline: none; }
.reader .reader-columns > .tutor-column { position: relative; top: auto; height: auto; }
.homework-tutor-body { flex: 1; min-height: 0; }
/* Room for the pane's grip at the top left. */
.homework-tutor-pane .tutor-head { padding-left: 26px; }
.homework-tutor-pane .tutor-head > strong { cursor: grab; user-select: none; }
.tutor-head {
  display: flex; align-items: center; gap: 8px; padding: 10px 12px 10px 16px;
  flex: none;
  background: linear-gradient(120deg, color-mix(in srgb, var(--accent) 16%, var(--surface)), color-mix(in srgb, var(--c3, var(--accent)) 12%, var(--surface)));
  border-bottom: 1px solid var(--border);
}
.tutor-head strong { flex: 1; min-width: 0; font-size: 1.02rem; }
.tutor-head button { flex: none; }
.tutor-history {
  flex: 0 1 140px; min-width: 0; max-width: 140px; font: inherit; font-size: 0.85rem; color: var(--muted);
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 3px 6px;
}
.tutor-history[hidden] { display: none; }
.tutor-head button { border: 0; background: transparent; color: var(--muted); border-radius: 8px; padding: 4px 10px; cursor: pointer; }
.tutor-head button:hover { background: var(--surface-2); color: var(--fg); }
.tutor-close { font-size: 1.3rem; line-height: 1; }
.tutor-log { flex: 1; min-height: 0; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.tutor-hello { color: var(--muted); line-height: 1.5; margin: auto 4px; text-align: center; }
.tutor-turn { max-width: 90%; padding: 9px 13px; border-radius: 14px; line-height: 1.5; overflow-wrap: anywhere; }
.tutor-turn p { margin: 0 0 0.6em; }
.tutor-turn p:last-child { margin-bottom: 0; }
/* A displayed formula wider than the panel scrolls rather than being cut off. */
.tutor-turn mjx-container[display="true"] { display: block; max-width: 100%; overflow-x: auto; overflow-y: hidden; padding-bottom: 2px; }
.tutor-user { align-self: flex-end; background: var(--accent); color: var(--accent-fg); border-bottom-right-radius: 4px; }
.tutor-assistant { align-self: flex-start; background: var(--surface-2); border-bottom-left-radius: 4px; }
.tutor-wait { color: var(--muted); animation: tutor-pulse 1.2s ease-in-out infinite; }
@keyframes tutor-pulse { 50% { opacity: 0.4; } }
.tutor-form { flex: none; border-top: 1px solid var(--border); padding: 10px 12px 12px; }
.tutor-input {
  width: 100%; box-sizing: border-box; resize: none; font: inherit;
  padding: 9px 11px; border: 1px solid var(--border-strong); border-radius: 10px;
  background: var(--bg); color: var(--fg);
}
.tutor-input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.tutor-error { margin: 6px 2px 0; color: var(--bad); font-size: 0.88rem; }
.tutor-error:empty { display: none; }
.tutor-foot { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.tutor-left { flex: 1; color: var(--muted); font-size: 0.84rem; }
.tutor-send {
  border: 0; border-radius: 999px; padding: 7px 18px; cursor: pointer;
  background: var(--accent); color: var(--accent-fg); font-weight: 600;
}
.tutor-send:disabled { opacity: 0.5; cursor: default; }
.homework-tutor { flex: none; }
.pane-thumb-tutor { background: color-mix(in srgb, var(--accent) 22%, var(--surface-2)); }
/* A reply the tutor gave after looking at the page (tutor.js lookedText). */
.tutor-turn p.tutor-looked { margin: 0 0 6px; font-size: 12px; color: var(--muted); }
.tutor-turn p.tutor-looked::before { content: "\1F441\FE0E  "; }
