/* «Наставник» chat inside the AI right-rail panel (frontend/js/ai/panel.js). The mentor's answers read like notes on
   the panel itself; only the user's questions sit in bubbles. Neutral tokens only (theme «Obsidian Black»). */
#aiPanel .mc-switch { align-self: flex-start; }
#aiPanel .ai-tpl { display: flex; flex-direction: column; gap: 8px; }
#aiPanel.mc-on { overflow: hidden; padding-bottom: 10px; }

#aiPanel .mc { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 8px; }
#aiPanel .mc[hidden] { display: none; }
#aiPanel .mc-log {
  flex: 1; min-height: 140px; overflow-y: auto; overscroll-behavior: contain;
  display: flex; flex-direction: column; gap: 14px; padding: 4px 2px 6px;
}

#aiPanel .mc-msg { font-size: var(--fs-sm); line-height: 1.5; color: var(--text); overflow-wrap: anywhere; }
#aiPanel .mc-msg.me {
  align-self: flex-end; max-width: 86%; padding: 7px 11px; white-space: pre-wrap;
  background: var(--surface3); border: 1px solid var(--border); border-radius: 12px 12px 4px 12px;
}
#aiPanel .mc-msg.bot { align-self: stretch; }
#aiPanel .mc-who { display: flex; align-items: center; gap: 6px; margin-bottom: 3px; font-size: var(--fs-2xs); color: var(--muted); }
#aiPanel .mc-who .ma { flex: none; }
#aiPanel .mc-text p { margin: 0 0 6px; }
#aiPanel .mc-text ul, #aiPanel .mc-text ol { margin: 0 0 6px; padding-left: 18px; }
#aiPanel .mc-text li + li { margin-top: 2px; }
#aiPanel .mc-text > :last-child { margin-bottom: 0; }
#aiPanel .mc-text strong { font-weight: 650; }
#aiPanel .mc-msg.err .mc-text { color: var(--muted); }
#aiPanel .mc-lesson { margin-top: 6px; gap: 6px; }

#aiPanel .mc-empty { display: flex; align-items: flex-start; gap: 10px; color: var(--muted); font-size: var(--fs-sm); line-height: 1.45; }
#aiPanel .mc-empty p { margin: 2px 0 0; }
#aiPanel .mc-empty .ma { flex: none; }
#aiPanel .mc-starters { display: flex; flex-direction: column; gap: 4px; }
#aiPanel .mc-starter {
  min-height: 32px; padding: 6px 10px; text-align: left; cursor: pointer;
  font: 450 var(--fs-sm)/1.35 var(--sans); color: var(--text);
  background: transparent; border: 1px solid var(--border); border-radius: var(--r-md);
  transition: background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
}
#aiPanel .mc-starter:hover { background: var(--hover); border-color: var(--border-strong); }
#aiPanel .mc-starter:focus-visible, #aiPanel .mc-send:focus-visible, #aiPanel .mc-clear:focus-visible { outline: none; box-shadow: var(--focus); }

#aiPanel .mc-typing .mc-dots { display: inline-flex; gap: 4px; padding: 6px 0 2px; }
#aiPanel .mc-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); animation: mc-dot 1.1s infinite ease-in-out; }
#aiPanel .mc-dots i:nth-child(2) { animation-delay: .15s; }
#aiPanel .mc-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes mc-dot { 0%, 80%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-2px); } }
@media (prefers-reduced-motion: reduce) { #aiPanel .mc-dots i { animation: none; opacity: .6; } }

#aiPanel .mc-form {
  flex: none; display: flex; align-items: flex-end; gap: 6px; padding: 5px 5px 5px 11px;
  background: var(--panel2); border: 1px solid var(--border); border-radius: 12px;
}
#aiPanel .mc-form:focus-within { border-color: var(--border-strong); }
#aiPanel .mc-input {
  flex: 1; min-width: 0; min-height: 24px; max-height: 120px; height: 24px; padding: 3px 0; margin: 0;
  resize: none; overflow-y: auto; border: 0; border-radius: 0; background: transparent; box-shadow: none; outline: none;
  color: var(--text); font: var(--fs-sm)/1.45 var(--sans);
}
#aiPanel .mc-input::placeholder { color: var(--muted); }
#aiPanel .mc-send {
  flex: none; width: 30px; height: 30px; display: grid; place-items: center; padding: 0; cursor: pointer;
  background: var(--btn-primary-bg); color: var(--btn-primary-fg); border: 0; border-radius: 50%;
}
#aiPanel .mc-send:hover { background: var(--btn-primary-hover); }
#aiPanel .mc-send:disabled { opacity: .4; cursor: default; }
#aiPanel .mc-send .icon { width: 16px; height: 16px; }

#aiPanel .mc-foot { flex: none; display: flex; align-items: baseline; justify-content: space-between; gap: 8px; font-size: var(--fs-2xs); color: var(--muted); }
#aiPanel .mc-clear { flex: none; padding: 2px 0; border: 0; background: none; color: var(--muted); font: inherit; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
#aiPanel .mc-clear:hover { color: var(--text); }
#aiPanel .mc-clear[hidden] { display: none; }

@media (pointer: coarse) {
  #aiPanel .mc-input { font-size: 16px; } /* no iOS zoom on focus */
  #aiPanel .mc-send { width: 36px; height: 36px; }
  #aiPanel .mc-starter { min-height: 40px; }
}
