/* The AI's hands on the 작업 canvas (js/workhands.js): its cursor (the AI helper's own arrow,
   .agent-pointer in styles.css, with a small "AI" tag), the ring of what it presses (.agent-ring),
   its caret, the text it selects, what it drags, the menus it opens, and the line saying it is
   at work. None of it takes the pointer: the student's presses go through to the canvas. */

:root {
  --wh-ai: #6d4df2; /* (the AI helper's pointer and ring, styles.css) */
  --wh-ai-ring: #7c5cf6;
  --wh-ai-soft: rgb(124 92 246 / 0.26);
}

/* ---------- the cursor ---------- */

.wh-cursor {
  color: var(--wh-ai);
}
.wh-cursor svg {
  display: block;
  transform-origin: 5px 3px;
  transition: transform 0.08s;
}
.wh-cursor.down svg {
  transform: scale(0.86);
}
/* (stopped by the student: it stays where it was, dimmed, until 계속) */
.wh-cursor.on.frozen {
  opacity: 0.45;
}
.wh-tag {
  position: absolute;
  left: 17px;
  top: 21px;
  padding: 1px 5px;
  border-radius: 6px;
  background: var(--wh-ai);
  color: #fff;
  font: 700 10px/1.3 var(--font);
  letter-spacing: 0.02em;
  /* (the pointer it hangs from is only as wide as its arrow: the tag keeps to one line, "AI") */
  white-space: nowrap;
  width: max-content;
  box-shadow: 0 1px 3px rgb(0 0 0 / 0.25);
}
.wh-ring.soft {
  border-width: 1.5px;
  box-shadow: none;
}

/* ---------- the caret and the selection ---------- */

.wh-caret {
  position: fixed;
  z-index: 2147482998;
  width: 2px;
  margin-left: 1px;
  border-radius: 1px;
  background: var(--wh-ai);
  pointer-events: none;
  animation: wh-blink 1s steps(1) infinite;
}
.wh-caret[hidden] {
  display: none;
}
@keyframes wh-blink {
  50% {
    opacity: 0;
  }
}
/* (the canvas's own caret is the hands' while they type a part: it takes their colour) */
.wh-root .wc-caret {
  color: var(--wh-ai);
}
.wh-layer > * {
  pointer-events: none;
}
.wh-sel {
  position: fixed;
  z-index: 2147482990;
  border-radius: 2px;
  background: var(--wh-ai-soft);
}

/* ---------- pressing, dragging, resizing ---------- */

.wh-pressed {
  transform: scale(0.94);
  transition: transform 0.08s;
}
/* (a button shown only under the pointer shows while the hands use it) */
.wh-show {
  opacity: 1 !important;
  visibility: visible !important;
}
.wh-ghost {
  position: fixed;
  z-index: 2147482995;
  margin: 0;
  box-sizing: border-box;
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow-lg), 0 0 0 2px var(--wh-ai-ring);
  opacity: 0.94;
  pointer-events: none;
}
.wh-ghost.settle {
  opacity: 0;
}
.wh-lifted {
  opacity: 0.35;
}
.wh-grabbed {
  outline: 2px dashed var(--wh-ai-ring);
  outline-offset: 2px;
}

/* ---------- a menu the hands open (drawn by them; the real one is never opened) ---------- */

.wh-menu {
  z-index: 2147482996;
  animation: pop-in 0.12s ease-out;
}
.wh-menu .chat-menu-item.wh-pressed {
  background: var(--accent-soft);
  color: var(--accent-text);
}
.wh-menu .chat-menu-item.danger.wh-pressed {
  background: var(--bad-soft);
  color: var(--bad);
}

/* ---------- "AI가 작업하는 중" ---------- */

.wh-root {
  position: relative;
}
.wh-status {
  position: absolute;
  left: 50%;
  bottom: 14px;
  z-index: 30;
  max-width: calc(100% - 24px);
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  box-shadow: var(--shadow);
  color: var(--ink-2);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transform: translateX(-50%);
  pointer-events: none;
}
.wh-status[hidden] {
  display: none;
}
.wh-status-dot {
  flex: none;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--wh-ai-ring);
  animation: wh-pulse 1.4s ease-in-out infinite;
}
.wh-status-text {
  font-weight: 600;
}
/* "AI가 기다리는 중": stopped, nothing pulses */
.wh-status.frozen .wh-status-dot {
  background: var(--warn, #9a6200);
  animation: none;
}
.wh-status-hint {
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
}
.wh-status-hint::before {
  content: "· ";
}
@keyframes wh-pulse {
  50% {
    opacity: 0.35;
  }
}
@media (max-width: 560px) {
  .wh-status-hint {
    display: none;
  }
}

/* Reduced motion: the cursor jumps (workhands.js), nothing blinks or pulses. */
@media (prefers-reduced-motion: reduce) {
  .wh-caret,
  .wh-status-dot,
  .wh-menu {
    animation: none;
  }
  .wh-cursor,
  .wh-cursor svg,
  .wh-ghost,
  .wh-pressed {
    transition: none !important;
  }
  /* (the ring around what was pressed stays shown, still, until the hands take it away) */
  .wh-ring {
    animation: none !important;
    opacity: 1;
  }
}
