/* 实时活动（AI 每一步、流式回话）的样式：由 ui/activity.js 用。变量都来自 tokens.css。 */

.act { display: flex; flex-direction: column; gap: 2px; min-width: 0; font-size: var(--fs-sm); color: var(--ink-2); }
.act-list { display: flex; flex-direction: column; gap: 1px; min-width: 0; }

/* 做完的折叠条（活的时间线收尾后、和聊天里存下的步骤共用） */
.act-sum {
  display: inline-flex; align-items: center; gap: 4px; align-self: flex-start; padding: 3px 8px 3px 4px; margin: 0 0 2px -4px;
  border-radius: var(--r-sm); color: var(--muted); font-size: var(--fs-sm); line-height: 1.5; cursor: pointer; list-style: none; user-select: none;
}
.act-sum::-webkit-details-marker { display: none; }
.act-sum:hover { background: var(--hover); color: var(--ink-2); }
.act-sum .ic { transition: transform var(--t-fast) var(--ease); }
.act.is-open .act-sum .ic, .act-fold[open] > .act-sum .ic { transform: rotate(90deg); }
.act-sum:focus-visible { outline: none; box-shadow: var(--focus); }
.act-fold { min-width: 0; }
.act-fold > .act-list { margin-top: 2px; padding-left: 2px; }

/* 一步 */
.act-step { display: grid; grid-template-columns: 20px minmax(0, 1fr); column-gap: 6px; padding: 3px 0; position: relative; }
.act-head { grid-column: 1 / -1; display: grid; grid-template-columns: 20px minmax(0, auto) minmax(0, 1fr) auto; column-gap: 6px; align-items: baseline; line-height: 1.55; }
.act-ic { grid-column: 1; align-self: center; display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; color: var(--muted); }
.act-ic .ic { font-size: 15px; }
.act-t { color: var(--ink); overflow-wrap: anywhere; min-width: 0; }
.act-d { color: var(--muted); font-size: var(--fs-xs); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.act-sec { color: var(--muted); font-size: var(--fs-xs); font-variant-numeric: tabular-nums; white-space: nowrap; text-align: right; }
.act-step.is-running .act-ic { color: var(--run); }
.act-step.is-running .act-d { color: var(--run); }
.act-step.is-error .act-ic, .act-step.is-error .act-t { color: var(--bad); }
.act-step.k-denied .act-ic { color: var(--warn); }
.act-step.is-done:not(.k-think) .act-t { color: var(--ink-2); }
.act-step.k-think .act-t { color: var(--muted); }
.act-err { grid-column: 2; margin-top: 1px; color: var(--bad); font-size: var(--fs-xs); line-height: 1.5; overflow-wrap: anywhere; }
.act-prev {
  grid-column: 2; margin: 3px 0 0; padding: 4px 8px; max-height: 3.9em; overflow: hidden; border-left: 2px solid var(--line-2);
  color: var(--muted); font-size: var(--fs-xs); line-height: 1.3; white-space: pre-wrap; overflow-wrap: anywhere; background: transparent;
}

/* 正在跑：转圈 */
.act-spin { width: 13px; height: 13px; border-radius: 50%; border: 2px solid color-mix(in srgb, var(--run) 25%, transparent); border-top-color: var(--run); animation: act-spin .8s linear infinite; }
@keyframes act-spin { to { transform: rotate(360deg); } }

/* 回话文字：流式 markdown，末尾闪光标 */
.act-text { margin: 4px 0 4px 26px; min-width: 0; }
.act-text .chat-md { font-size: var(--fs-md); }
.act-cursor { display: inline-block; width: 7px; height: 1.05em; margin-left: 2px; vertical-align: text-bottom; border-radius: 1px; background: var(--accent); animation: act-blink 1s steps(2, start) infinite; }
@keyframes act-blink { to { visibility: hidden; } }

/* 思考 */
.act-think { margin: 2px 0 2px 26px; color: var(--muted); font-size: var(--fs-xs); }
.act-think > summary { display: inline-flex; align-items: center; gap: 4px; cursor: pointer; list-style: none; user-select: none; padding: 1px 4px 1px 0; }
.act-think > summary::-webkit-details-marker { display: none; }
.act-think > summary:hover { color: var(--ink-2); }
.act-think > summary .ic, .act-think > summary svg { transition: transform var(--t-fast) var(--ease); }
.act-think[open] > summary .ic { transform: rotate(90deg); }
.act-think__body { margin: 4px 0 0; padding: 6px 10px; max-height: 220px; overflow: auto; border-left: 2px solid var(--line-2); background: color-mix(in srgb, var(--ink) 3%, transparent); border-radius: 0 var(--r-sm) var(--r-sm) 0; color: var(--ink-2); font-family: var(--font-ui); font-size: var(--fs-xs); line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; }

/* 任务日志里的一行人话 */
.act-note { margin: 1px 0 1px 26px; color: var(--muted); font-size: var(--fs-xs); line-height: 1.5; overflow-wrap: anywhere; }
.act-note.is-warn { color: var(--warn); }

/* 在想下一步… */
.act-wait { display: flex; align-items: center; gap: 8px; padding: 4px 0 2px 2px; color: var(--muted); font-variant-numeric: tabular-nums; }
.act-dots { display: inline-flex; gap: 3px; width: 20px; justify-content: center; }
.act-dots i { width: 4px; height: 4px; border-radius: 50%; background: var(--accent); animation: act-dot 1.2s ease-in-out infinite; }
.act-dots i:nth-child(2) { animation-delay: .15s; }
.act-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes act-dot { 0%, 80%, 100% { opacity: .25; transform: none; } 40% { opacity: 1; transform: translateY(-2px); } }

.act-foot { margin-top: 4px; padding-top: 4px; color: var(--muted); font-size: var(--fs-xs); border-top: 1px dashed var(--line); }

/* ↓ 有新内容 */
.act-jump {
  position: absolute; left: 50%; bottom: 10px; z-index: 5; display: inline-flex; align-items: center; gap: 4px; height: 28px; padding: 0 12px; border-radius: 14px;
  background: var(--panel); border: 1px solid var(--line-2); color: var(--ink-2); font-size: var(--fs-xs); box-shadow: var(--sh-2);
  opacity: 0; pointer-events: none; transform: translate(-50%, 6px); transition: opacity var(--t-mid) var(--ease), transform var(--t-mid) var(--ease);
}
.act-jump.is-on { opacity: 1; pointer-events: auto; transform: translate(-50%, 0); }
.act-jump:hover { color: var(--ink); }

/* 顶栏 runchip：当前一句话实时跳 */
.runchip__line { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }

/* 任务页：时间线盒子 */
.act-box { position: relative; }
.act-box__scroll { max-height: 420px; overflow-y: auto; padding: 10px 14px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--panel); overscroll-behavior: contain; }
.act-rawlog { margin-top: 14px; }
.act-rawlog > summary { cursor: pointer; color: var(--muted); font-size: var(--fs-sm); user-select: none; }
.act-rawlog > summary:hover { color: var(--ink-2); }
.act-rawlog[open] > summary { margin-bottom: 6px; }

@media (prefers-reduced-motion: reduce) {
  .act-spin { animation: none; border-top-color: var(--run); border-right-color: var(--run); }
  .act-cursor { animation: none; }
  .act-dots i { animation: none; opacity: .7; }
  .act-jump { transition: none; }
  .act-sum .ic { transition: none; }
}
