/* Ask Niche — panel UI. Emil language: site sand palette, borders not fills,
   instant hovers, scale(0.97) presses, motion <300ms transform/opacity only. */

.niche-fab {
  position: fixed; right: 24px; bottom: 24px; z-index: 50;
  width: 46px; height: 46px;
  border-radius: 16px;
  background: var(--gray-100); border: 1px solid var(--gray-400);
  font: 500 15px ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color: var(--gray-1100);
  cursor: pointer;
  box-shadow: 0 2px 12px rgba(33, 32, 28, 0.06);
}
.niche-fab:hover { color: var(--gray-1200); border-color: var(--gray-800); }
.niche-fab:active { transform: scale(0.97); }
.niche-fab[data-open="true"] { opacity: 0; pointer-events: none; }

.niche-chip {
  position: absolute; z-index: 40;
  font: 500 13px Inter, -apple-system, sans-serif;
  color: var(--gray-1200);
  background: var(--gray-100); border: 1px solid var(--gray-400); border-radius: 6px;
  padding: 4px 10px; cursor: pointer;
  box-shadow: 0 2px 10px rgba(33, 32, 28, 0.07);
}
.niche-chip:active { transform: scale(0.97); }
.niche-chip[hidden] { display: none; }

.niche-panel {
  position: fixed; right: 24px; bottom: 24px; z-index: 60;
  width: min(390px, calc(100vw - 48px));
  background: var(--gray-100); border: 1px solid var(--gray-400); border-radius: 12px;
  box-shadow: 0 8px 32px rgba(33, 32, 28, 0.08);
  display: flex; flex-direction: column;
  transform-origin: bottom right;
  transition: transform 220ms cubic-bezier(0.16, 1, 0.3, 1), opacity 180ms cubic-bezier(0.16, 1, 0.3, 1);
  font-family: Inter, -apple-system, sans-serif;
}
.niche-panel[data-closed="true"] { transform: scale(0.96) translateY(6px); opacity: 0; pointer-events: none; }
@media (prefers-reduced-motion: reduce) { .niche-panel { transition: none; } }

.niche-panel header {
  display: flex; align-items: baseline; gap: 10px;
  padding: 12px 16px 9px; border-bottom: 1px solid var(--gray-400);
}
.niche-panel header .niche-name {
  font: 500 14px ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  flex: 1;
}
.niche-panel header .niche-close {
  font: 400 16px/1 Inter, sans-serif; color: var(--gray-1000);
  background: none; border: 0; cursor: pointer; padding: 2px 4px;
}
.niche-panel header .niche-close:hover { color: var(--gray-1200); }

.niche-attn { padding: 12px 16px 8px; border-bottom: 1px solid var(--gray-400); }
.niche-attn canvas { display: block; width: 100%; height: 44px; }
.niche-attn .niche-cap {
  font: 400 11px ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color: var(--gray-1000); margin-top: 6px;
}

.niche-dl { padding: 0 16px 10px; }
.niche-dl[hidden] { display: none; }
.niche-dl .niche-bar { height: 2px; background: var(--gray-400); border-radius: 1px; overflow: hidden; }
.niche-dl .niche-fill { height: 100%; width: 0%; background: var(--gray-1000); }
.niche-dl .niche-lbl {
  font: 400 11px ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color: var(--gray-1000); margin-top: 5px;
}

.niche-out {
  padding: 14px 16px; min-height: 96px; max-height: 180px; overflow-y: auto;
  font-size: 14px; line-height: 1.6; color: var(--gray-1200);
}
.niche-out .niche-prime { color: var(--gray-1100); font-style: italic; }
.niche-out .niche-idle { color: var(--gray-1000); }
.niche-out .niche-caret { color: var(--gray-900); }

.niche-in { border-top: 1px solid var(--gray-400); padding: 12px 16px 14px; }
.niche-in textarea {
  width: 100%; box-sizing: border-box; resize: none; height: 64px;
  font: 400 13px Inter, -apple-system, sans-serif; line-height: 1.5;
  color: var(--gray-1200);
  background: var(--gray-200); border: 1px solid var(--gray-400); border-radius: 6px;
  padding: 8px 10px;
}
.niche-in textarea:focus { outline: none; border-color: var(--gray-800); }
.niche-in .niche-row { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; }
.niche-in .niche-count {
  font: 400 11px ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color: var(--gray-1000);
}
.niche-in .niche-ask {
  font: 500 13px Inter, -apple-system, sans-serif; color: var(--gray-1200);
  background: var(--gray-200); border: 1px solid var(--gray-400); border-radius: 6px;
  padding: 5px 14px; cursor: pointer;
}
.niche-in .niche-ask:hover { border-color: var(--gray-800); }
.niche-in .niche-ask:active { transform: scale(0.97); }
.niche-in .niche-ask:disabled { color: var(--gray-1000); cursor: default; }

.niche-fab:focus-visible, .niche-chip:focus-visible, .niche-close:focus-visible,
.niche-ask:focus-visible {
  outline: 2px solid var(--gray-1200); outline-offset: 2px;
}

/* Niche is desktop-only: hidden on coarse pointers and narrow viewports */
@media (pointer: coarse), (max-width: 700px) {
  .niche-fab, .niche-panel, .niche-chip { display: none !important; }
}
