/* ─── command orb ──────────────────────────────────────────────────────
   Fixed bottom-right assistant orb + reveal-on-tap text input + feedback
   toast. Round (deliberately not the rectangular Ui::ButtonComponent) — this
   is the seat the voice orb will eventually occupy. Uses the HUD tokens: cyan
   accent, mono text, soft glow, flat-with-light depth. */

.command-orb {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  z-index: 50;
  display: flex;
  flex-direction: row-reverse; /* orb pinned right; input grows to its left */
  align-items: center;
  gap: 0.5rem;
}

.command-orb__button {
  flex: none;
  position: relative;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: none;
  background: none;
  padding: 0;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: transform 0.08s ease;
}
.command-orb__button:active { transform: scale(0.96); }
.command-orb__button:focus-visible { outline: 2px solid var(--cyan); outline-offset: 3px; }

.command-orb__orb {
  display: block;
  width: 72px;
  height: 72px;
  border-radius: 50%;
}

/* Pulsing cyan ring while active (input open / "listening"). The ring lives on
   an ::after so it can scale/fade without nudging the orb image. */
.command-orb__button::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 3px solid var(--cyan);
  opacity: 0;
  pointer-events: none;
}
.command-orb--open .command-orb__button::after {
  animation: command-orb-pulse 1.5s ease-out infinite;
}

@keyframes command-orb-pulse {
  0%   { opacity: 0.8; transform: scale(1); }
  100% { opacity: 0; transform: scale(1.6); }
}

/* Spinning ring while awaiting the AI response. A near-complete cyan arc over a
   dim track reads as "thinking" — deliberately distinct from the open pulse.
   The ring sits just outside the orb (inset: -4px) so it doesn't clip. */
.command-orb--loading .command-orb__button::after {
  inset: -4px;
  opacity: 1;
  border-color: var(--cyan-dim);
  border-top-color: var(--cyan);
  border-right-color: var(--cyan);
  animation: command-orb-spin 0.7s linear infinite;
}

@keyframes command-orb-spin {
  to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  .command-orb--open .command-orb__button::after { animation: none; opacity: 0.6; }
  .command-orb--loading .command-orb__button::after { animation: none; opacity: 0.6; }
}

.command-orb__form {
  width: 0;
  overflow: hidden;
  transition: width 0.22s ease;
}
.command-orb--open .command-orb__form { width: min(70vw, 320px); }

.command-orb__input {
  width: 100%;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  letter-spacing: 0.01em;
  padding: 0.7rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
}
.command-orb__input::placeholder { color: var(--muted-2); }
.command-orb__input:focus {
  outline: none;
  border-color: var(--cyan);
  box-shadow: var(--cyan-glow-sm);
}

.command-orb__feedback {
  position: absolute;
  right: 0;
  bottom: calc(100% + 0.6rem);
  /* Explicit width, not max-width: the feedback's containing block collapses to
     the 72px orb when the input is closed, so max-width would let it shrink to
     that. A fixed width lets the toast extend leftward at full readable size. */
  width: min(80vw, 360px);
}

.command-toast {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  letter-spacing: 0.02em;
  line-height: 1.35;
  padding: 0.6rem 0.85rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: 0 2px 8px rgba(20, 30, 50, 0.08);
  opacity: 0.7;
}
.command-toast--ok {
  color: var(--accent);
  border-color: var(--cyan-dim);
  background: #E6F4FB;
}
.command-toast--warn {
  color: var(--red);
  border-color: var(--red);
  background: var(--red-bg);
}
