/* ==========================================================================
   导师面板
   一轮回复分三层：过程（折叠成一行）→ 答案 → 回执。
   要他决定的事、他排队的消息、正在同步的课堂摘要，放在输入框上方（照 Harness 的输入框上下文坞）。
   ========================================================================== */

.ai {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 0;
  color: var(--ink);
}
.ai-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 14px 12px 18px;
}
.ai-head .orb {
  width: 32px;
  height: 32px;
}
.ai-who {
  flex: 1;
  min-width: 0;
  display: grid;
}
.ai-who b {
  font: 400 17px/24px var(--font-kai);
}
.ai-status {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  color: var(--ink-3);
  font: var(--t-caption);
  white-space: nowrap;
}
.ai-status .num {
  margin-left: 2px;
}
.ai-head-tools {
  position: relative;
  display: flex;
  gap: 2px;
}

/* —— 对话 —— */
.ai-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 6px 18px 18px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.ai-empty {
  display: grid;
  justify-items: center;
  gap: 10px;
  margin: auto 0;
  padding: 24px 4px;
  text-align: center;
}
.orb.big {
  width: 52px;
  height: 52px;
  margin-bottom: 6px;
}
.ai-empty h3 {
  font: var(--t-section);
}
.ai-empty p {
  max-width: 30em;
  color: var(--ink-2);
  font: var(--t-small);
  text-wrap: pretty;
}
.suggest {
  display: grid;
  gap: 6px;
  width: 100%;
  margin-top: 12px;
}
.suggest button {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  padding: 8px 12px;
  border: 0;
  border-radius: var(--r-md);
  background: var(--panel-2);
  color: var(--ink-2);
  font: var(--t-small);
  text-align: left;
  transition: background var(--d-fast), color var(--d-fast);
}
.suggest button svg {
  flex: none;
  color: var(--ink-3);
}
.suggest button:hover {
  background: var(--panel-3);
  color: var(--ink);
}

.msg {
  min-width: 0;
  animation: msg-in 0.3s var(--ease-out);
}
@keyframes msg-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
}
.msg.user {
  display: flex;
  justify-content: flex-end;
}
.bubble {
  max-width: 86%;
  padding: 9px 14px;
  border-radius: var(--r-lg) var(--r-lg) var(--r-xs) var(--r-lg);
  background: var(--panel-2);
  color: var(--ink);
  font: var(--t-body);
  white-space: pre-wrap;
  word-break: break-word;
}
.vtags {
  display: flex;
  gap: 6px;
  margin-bottom: 2px;
}
.vtag {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  color: var(--ink-3);
  font: var(--t-caption);
}
.att {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
  padding: 8px 10px;
  border-radius: var(--r-md);
  background: var(--panel);
}
.att svg {
  flex: none;
  width: 20px;
  height: 20px;
  color: var(--accent);
}
.att span {
  display: grid;
  min-width: 0;
}
.att b {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font: 500 13px/18px var(--font);
}
.att small {
  color: var(--ink-3);
  font: var(--t-caption);
}

.msg.assistant {
  display: grid;
  gap: 8px;
}
/* 过程：一行摘要，点开是一行一个动作 */
.process .dis {
  min-height: 26px;
}
.process-body {
  display: grid;
  gap: 2px;
  margin: 2px 0 4px 6px;
  padding-left: 16px;
  border-left: 1px solid var(--line);
  animation: msg-in 0.24s var(--ease-out);
}
.tool {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 24px;
  color: var(--ink-3);
  font: var(--t-caption);
}
.tool .tool-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tool.error {
  color: var(--danger);
}
.think-toggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 24px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink-3);
  font: var(--t-caption);
}
.think-toggle:hover {
  color: var(--ink-2);
}
.think-text {
  max-height: 220px;
  overflow-y: auto;
  margin: 2px 0 6px;
  color: var(--ink-3);
  font: 400 12px/1.7 var(--font);
  white-space: pre-wrap;
}

/* 答案：正文 15/26，段落之间留气口 */
.answer {
  font: 400 15px/1.75 var(--font);
  word-break: break-word;
}
.answer.cursor > :last-child::after {
  content: '';
  display: inline-block;
  width: 7px;
  height: 15px;
  margin-left: 3px;
  vertical-align: -2px;
  border-radius: 2px;
  background: rgba(var(--warm), 0.9);
  animation: caret 1s steps(1) infinite;
}
@keyframes caret {
  50% {
    opacity: 0;
  }
}

/* 回执：一张小票，列出这一轮改了什么 */
.receipt-slip {
  padding: 10px 12px 10px 12px;
  border-radius: var(--r-md);
  background: var(--panel-2);
  box-shadow: inset 0 0 0 0.5px var(--line);
  font: var(--t-small);
}
.receipt-head {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink-2);
}
.receipt-head b {
  color: var(--ink);
}
.receipt-slip ul {
  margin: 8px 0 0;
  padding: 8px 0 0 18px;
  border-top: 1px dashed var(--line-2);
  color: var(--ink-2);
  font: var(--t-caption);
}
.receipt-slip li + li {
  margin-top: 3px;
}
.receipt-slip.undone {
  opacity: 0.7;
}
.receipt-slip.undone ul {
  text-decoration: line-through;
  text-decoration-color: var(--line-2);
}
.note-line {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink-3);
  font: var(--t-caption);
}
.note-line svg {
  flex: none;
}
.note-line.ask {
  flex-wrap: wrap;
}
.note-line.ask b {
  color: var(--ink-2);
  font-weight: 500;
}
.note-line.undone span {
  text-decoration: line-through;
}
.err-card {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 12px;
  border-radius: var(--r-md);
  background: var(--danger-soft);
  color: color-mix(in srgb, var(--danger) 80%, var(--ink));
  font: var(--t-small);
}
.err-card .sd {
  margin-top: 5px;
}
.msg-actions {
  display: flex;
  align-items: center;
  gap: 0;
  margin-left: -6px;
  opacity: 0;
  transition: opacity var(--d);
}
.msg.assistant:hover .msg-actions,
.msg.assistant:focus-within .msg-actions,
.msg.assistant:last-child .msg-actions {
  opacity: 1;
}
.msg-time {
  margin-left: 4px;
  color: var(--ink-3);
  font: var(--t-caption);
}
.compact-divider,
.auto-line {
  color: var(--ink-3);
  font: var(--t-caption);
}
.compact-divider > summary,
.auto-line > summary {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  list-style: none;
}
.compact-divider > summary::-webkit-details-marker,
.auto-line > summary::-webkit-details-marker {
  display: none;
}
.compact-divider > summary::before,
.compact-divider > summary::after {
  content: '';
  flex: 1;
  height: 0.5px;
  background: var(--line-2);
}
.compact-divider .md,
.auto-line p {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: var(--r-md);
  background: var(--panel-2);
  color: var(--ink-2);
  font: var(--t-small);
}

/* —— 输入框和它上方的坞 —— */
.composer {
  flex: none;
  padding: 0 12px 12px;
}
.docks {
  display: grid;
  gap: 8px;
  max-height: 46dvh;
  overflow-y: auto;
  margin-bottom: 8px;
}
.dock {
  padding: 10px 12px;
  border-radius: var(--r-lg);
  background: var(--panel-2);
  box-shadow: inset 0 0 0 0.5px var(--line);
  font: var(--t-small);
  animation: dock-in 0.3s var(--ease-out);
}
@keyframes dock-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}
.dock-head {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 22px;
  color: var(--ink-2);
}
.dock-head b {
  color: var(--ink);
  font-weight: 500;
}
.dock-head .orb {
  width: 14px;
  height: 14px;
}
.dock-list {
  margin: 6px 0 0;
  padding-left: 18px;
  color: var(--ink-2);
  font: var(--t-caption);
}
.dock-list li + li {
  margin-top: 2px;
}
.dock-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}
.dock-hint {
  color: var(--ink-3);
  font: var(--t-caption);
}
.dock-confirm {
  background: color-mix(in srgb, var(--warn) 9%, var(--panel-2));
}
.choice-opts {
  display: grid;
  gap: 6px;
  margin-top: 8px;
}
.choice-opt {
  display: grid;
  gap: 1px;
  padding: 8px 12px;
  border: 0;
  border-radius: var(--r-md);
  background: var(--panel);
  box-shadow: 0 0 0 0.5px var(--line-2);
  color: var(--ink);
  text-align: left;
  transition: background var(--d-fast), box-shadow var(--d-fast);
}
.choice-opt b {
  font: 500 14px/20px var(--font);
}
.choice-opt small {
  color: var(--ink-3);
  font: var(--t-caption);
}
.choice-opt:hover {
  background: var(--panel-3);
}
.choice-opt.on {
  box-shadow: 0 0 0 1.5px var(--accent);
}
.queue-row {
  display: flex;
  align-items: center;
  gap: 4px;
  min-height: 30px;
  margin-top: 4px;
}
.queue-text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink);
}
.lesson-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.lesson-step {
  margin: 2px 0 0 18px;
  font: var(--t-caption);
}

.composer-box {
  position: relative;
  display: grid;
  gap: 4px;
  padding: 12px 10px 8px 14px;
  border-radius: var(--r-xl);
  background: var(--panel-2);
  box-shadow: inset 0 0 0 0.5px var(--line-2);
  transition: box-shadow var(--d);
}
.composer-box:focus-within {
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 55%, var(--line-2));
}
.composer-box.rec {
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--danger) 50%, transparent);
}
.composer textarea {
  width: 100%;
  min-height: 24px;
  max-height: 168px;
  padding: 0;
  border: 0;
  outline: 0;
  resize: none;
  background: none;
  color: var(--ink);
  font: var(--t-body);
}
.composer textarea::placeholder {
  color: var(--ink-3);
}
.composer-row {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-left: -6px;
}
.c-btn {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 17px;
  background: none;
  color: var(--ink-3);
  display: grid;
  place-items: center;
  transition: background var(--d-fast), color var(--d-fast);
}
.c-btn svg {
  width: 18px;
  height: 18px;
}
.c-btn:hover {
  background: var(--hover);
  color: var(--ink);
}
.c-btn.mic.on {
  background: var(--danger);
  color: #fff;
}
.send {
  width: 34px;
  height: 34px;
  margin-left: 4px;
  border: 0;
  border-radius: 17px;
  background: var(--accent);
  color: var(--on-accent);
  display: grid;
  place-items: center;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 2px 0 color-mix(in srgb, var(--accent) 60%, #000);
  transition: transform var(--d-fast), opacity var(--d-fast);
}
.send svg {
  width: 17px;
  height: 17px;
}
.send:active {
  transform: translateY(1px);
}
.send:disabled {
  opacity: 0.35;
  box-shadow: none;
  cursor: default;
}
.send.stop {
  background: var(--ink);
  color: var(--panel);
  box-shadow: none;
}
.composer-hint {
  margin: 6px 4px 0;
  color: var(--ink-3);
  font: var(--t-caption);
  text-align: center;
}
/* 语音输入：一排小柱子跟着音量起伏 */
.rec-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--danger);
  font: var(--t-caption);
}
.rec-wave {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  height: 16px;
}
.rec-wave i {
  width: 3px;
  height: calc(4px + 12px * var(--lv, 0) * var(--k));
  border-radius: 2px;
  background: currentColor;
  transition: height 0.08s linear;
}

/* 拖进课堂摘要 */
.ai-dropzone {
  position: absolute;
  inset: 8px;
  z-index: 5;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 6px;
  border-radius: var(--r-xl);
  background: color-mix(in srgb, var(--panel) 88%, transparent);
  box-shadow: inset 0 0 0 1.5px var(--accent);
  color: var(--ink-2);
  font: var(--t-small);
  text-align: center;
  pointer-events: none;
}
.ai-dropzone svg {
  width: 30px;
  height: 30px;
  color: var(--accent);
}
.ai-dropzone b {
  color: var(--ink);
  font: var(--t-item);
}

.ai-drag {
  display: none;
}
@media (max-width: 760px) {
  .ai-drag {
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 22px;
    z-index: 2;
    touch-action: none;
  }
  .ai-drag::after {
    content: '';
    display: block;
    width: 38px;
    height: 5px;
    margin: 7px auto 0;
    border-radius: 3px;
    background: var(--line-2);
  }
  .ai-head {
    padding-top: 22px;
  }
  .composer {
    padding-bottom: calc(10px + var(--safe-b));
  }
  .hint-wide {
    display: none;
  }
}

/* —— 语音通话：屋里只剩一颗光 —— */
.call {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 26px 22px calc(26px + var(--safe-b));
  color: #ede5d7;
  background: radial-gradient(70% 46% at 50% 40%, rgba(var(--warm), 0.14), rgba(var(--warm), 0.03) 60%, transparent 80%), #15110d;
  animation: fade-in 0.6s var(--ease);
}
.call-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  color: #a09381;
  font: var(--t-caption);
}
.call-orb-wrap {
  flex: 1;
  display: grid;
  place-items: center;
  width: 100%;
}
.call-orb {
  position: relative;
  width: 132px;
  height: 132px;
  border: 0;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 45%, #fff8e8 0%, #f7d9a2 34%, #e6a24c 70%, #b9732a 100%);
  box-shadow: 0 0 calc(50px + var(--ring, 0) * 90px) calc(8px + var(--ring, 0) * 30px) rgba(247, 200, 120, calc(0.28 + var(--ring, 0) * 0.3));
  transform: scale(var(--s, 1));
  transition: transform 0.12s linear, box-shadow 0.12s linear;
}
.call-orb::before {
  content: '';
  position: absolute;
  inset: -90px;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(247, 214, 160, 0.18), transparent);
  opacity: calc(0.4 + var(--ring, 0) * 0.6);
  pointer-events: none;
}
.call-orb.thinking {
  animation: orb-breathe 1.3s var(--ease) infinite;
}
.call-state {
  margin-top: 42px;
  font: 400 20px/1.3 var(--font-kai);
  text-align: center;
}
.call-caption {
  width: 100%;
  min-height: 70px;
  max-height: 150px;
  overflow-y: auto;
  margin-top: 12px;
  color: #c0b4a2;
  font: 400 16px/1.7 var(--font-kai);
  text-align: center;
}
.call-caption .me {
  color: #ede5d7;
}
.call-slips {
  display: grid;
  gap: 4px;
  width: min(100%, 420px);
  margin: 10px auto 0;
  padding: 0;
  list-style: none;
  color: #c0b4a2;
  font: var(--t-small);
}
.call-slips li {
  display: flex;
  align-items: flex-start;
  gap: 6px;
}
.call-slips li svg {
  flex: none;
  margin-top: 3px;
  color: #96b884;
}
.call-slips li.pending svg {
  color: #e8a046;
}
.call-slips li.error svg {
  color: #ec806b;
}
.call-actions {
  display: flex;
  gap: 22px;
  margin-top: 18px;
}
.call-btn {
  display: grid;
  justify-items: center;
  gap: 6px;
  border: 0;
  background: none;
  color: #c0b4a2;
  font: var(--t-caption);
}
.call-btn i {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: #2b241e;
  color: #ede5d7;
  transition: transform var(--d-fast);
}
.call-btn:active i {
  transform: scale(0.92);
}
.call-btn i svg {
  width: 24px;
  height: 24px;
}
.call-btn.end i {
  background: #c4553f;
  color: #fff;
}
.call-btn.on i {
  background: #e8a046;
  color: #24170a;
}
