/**
 * LibZen FloatingCard — fixed, non-modal, body-portaled tip / inspect card.
 * Uses host app CSS variables when present; includes dark-theme fallbacks.
 */

:root {
  --libzen-fc-surface: var(--surface, #1a2332);
  --libzen-fc-text: var(--text, #e8edf4);
  --libzen-fc-muted: var(--text-muted, #8b9cb3);
  --libzen-fc-border: var(--border, #2d3a4f);
  --libzen-fc-radius: 8px;
  --libzen-fc-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
}

.libzen-fc-card {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 3000;
  box-sizing: border-box;
  min-width: 12rem;
  max-width: min(20rem, calc(100vw - 16px));
  margin: 0;
  padding: 0;
  border: 1px solid var(--libzen-fc-border);
  border-radius: var(--libzen-fc-radius);
  background: color-mix(in srgb, var(--libzen-fc-surface) 92%, #000);
  color: var(--libzen-fc-text);
  box-shadow: var(--libzen-fc-shadow);
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-size: 12px;
  line-height: 1.35;
  overflow: hidden;
  touch-action: none;
}

/* Hosts often set display:flex on the card; that must not beat HTML hidden. */
.libzen-fc-card[hidden] {
  display: none !important;
}

.libzen-fc-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0.45rem 0.5rem 0.35rem 0.6rem;
  border-bottom: 1px solid var(--libzen-fc-border);
  cursor: grab;
  user-select: none;
}

.libzen-fc-card.libzen-fc-dragging .libzen-fc-header,
.libzen-fc-header:active {
  cursor: grabbing;
}

.libzen-fc-title {
  flex: 1;
  min-width: 0;
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.3;
  word-break: break-word;
}

.libzen-fc-close {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  margin: -2px -4px -2px 0;
  padding: 0;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--libzen-fc-muted);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}

.libzen-fc-close:hover {
  color: var(--libzen-fc-text);
  background: color-mix(in srgb, var(--libzen-fc-text) 10%, transparent);
}

.libzen-fc-body {
  padding: 0.4rem 0.6rem 0.5rem;
}

.libzen-fc-message {
  margin: 0;
}

.libzen-fc-card.libzen-fc-dragging {
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
  user-select: none;
}

.libzen-fc-card.libzen-fc-pinned {
  /* Host may style pinned state; drag grip stays the same. */
}
